@knpkv/control-center 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/.vite/manifest.json +127 -125
- package/dist/client/assets/{ActiveWorkPage-Bvji6Tys.js → ActiveWorkPage-C6QwDV1Y.js} +2 -2
- package/dist/client/assets/{ActiveWorkPage-Bvji6Tys.js.map → ActiveWorkPage-C6QwDV1Y.js.map} +1 -1
- package/dist/client/assets/{AgentPage-Bom41la2.js → AgentPage-OqwP6uRi.js} +2 -2
- package/dist/client/assets/{AgentPage-Bom41la2.js.map → AgentPage-OqwP6uRi.js.map} +1 -1
- package/dist/client/assets/{AtlassianOAuthCallbackPage-dr-B9-DD.js → AtlassianOAuthCallbackPage-Bm7UhU-h.js} +2 -2
- package/dist/client/assets/{AtlassianOAuthCallbackPage-dr-B9-DD.js.map → AtlassianOAuthCallbackPage-Bm7UhU-h.js.map} +1 -1
- package/dist/client/assets/{AuthorizedSharePage-C-P-PNfm.js → AuthorizedSharePage-DblP3USU.js} +2 -2
- package/dist/client/assets/{AuthorizedSharePage-C-P-PNfm.js.map → AuthorizedSharePage-DblP3USU.js.map} +1 -1
- package/dist/client/assets/{BrowserCrypto-BPiuCuW-.js → BrowserCrypto-BGGRC6iW.js} +2 -2
- package/dist/client/assets/{BrowserCrypto-BPiuCuW-.js.map → BrowserCrypto-BGGRC6iW.js.map} +1 -1
- package/dist/client/assets/{BrowserSessionHydrator-C8F_LGhg.js → BrowserSessionHydrator-39UDbHf0.js} +2 -2
- package/dist/client/assets/{BrowserSessionHydrator-C8F_LGhg.js.map → BrowserSessionHydrator-39UDbHf0.js.map} +1 -1
- package/dist/client/assets/{CommandSearch-D6iFcdvj.js → CommandSearch-D4Fnjsl-.js} +2 -2
- package/dist/client/assets/{CommandSearch-D6iFcdvj.js.map → CommandSearch-D4Fnjsl-.js.map} +1 -1
- package/dist/client/assets/{ItemsPage-x39U11an.js → ItemsPage-BZQiTh9b.js} +2 -2
- package/dist/client/assets/{ItemsPage-x39U11an.js.map → ItemsPage-BZQiTh9b.js.map} +1 -1
- package/dist/client/assets/{PairPage-D5vlz4OG.js → PairPage-Dvfse5ky.js} +2 -2
- package/dist/client/assets/{PairPage-D5vlz4OG.js.map → PairPage-Dvfse5ky.js.map} +1 -1
- package/dist/client/assets/{PortfolioOverview-DSUabOmm.js → PortfolioOverview-DeJcfXcw.js} +2 -2
- package/dist/client/assets/{PortfolioOverview-DSUabOmm.js.map → PortfolioOverview-DeJcfXcw.js.map} +1 -1
- package/dist/client/assets/{ReleaseRoute-DyDm5s85.js → ReleaseRoute-D9q8_sCk.js} +2 -2
- package/dist/client/assets/{ReleaseRoute-DyDm5s85.js.map → ReleaseRoute-D9q8_sCk.js.map} +1 -1
- package/dist/client/assets/ReleaseWorkset-Bs_FXlbC.js +2 -0
- package/dist/client/assets/ReleaseWorkset-Bs_FXlbC.js.map +1 -0
- package/dist/client/assets/{ServicesPage-CoMVH2Si.js → ServicesPage-Co6GJHgc.js} +2 -2
- package/dist/client/assets/{ServicesPage-CoMVH2Si.js.map → ServicesPage-Co6GJHgc.js.map} +1 -1
- package/dist/client/assets/{TimelinePage-D8Fj_351.js → TimelinePage-CM2og72M.js} +2 -2
- package/dist/client/assets/{TimelinePage-D8Fj_351.js.map → TimelinePage-CM2og72M.js.map} +1 -1
- package/dist/client/assets/{WorkspaceEntityLink-BRifdJHn.js → WorkspaceEntityLink-CTw_He-8.js} +2 -2
- package/dist/client/assets/{WorkspaceEntityLink-BRifdJHn.js.map → WorkspaceEntityLink-CTw_He-8.js.map} +1 -1
- package/dist/client/assets/{WorkspaceEntityRoute-BwpujSqk.css → WorkspaceEntityRoute-Bdmv6ki4.css} +1 -1
- package/dist/client/assets/WorkspaceEntityRoute-BnsmaeS2.js +30 -0
- package/dist/client/assets/WorkspaceEntityRoute-BnsmaeS2.js.map +1 -0
- package/dist/client/assets/{WorkspaceReleaseLayout-DDLdY0rU.js → WorkspaceReleaseLayout-Ba6keUju.js} +2 -2
- package/dist/client/assets/{WorkspaceReleaseLayout-DDLdY0rU.js.map → WorkspaceReleaseLayout-Ba6keUju.js.map} +1 -1
- package/dist/client/assets/{authenticatedMutationClient-D5yD0rch.js → authenticatedMutationClient-CJklf3iD.js} +2 -2
- package/dist/client/assets/{authenticatedMutationClient-D5yD0rch.js.map → authenticatedMutationClient-CJklf3iD.js.map} +1 -1
- package/dist/client/assets/{authorizedShareTransport-Dyj53kJf.js → authorizedShareTransport-Xg20SHJ5.js} +2 -2
- package/dist/client/assets/{authorizedShareTransport-Dyj53kJf.js.map → authorizedShareTransport-Xg20SHJ5.js.map} +1 -1
- package/dist/client/assets/{client-OmvShYdC.js → client-P7FaPwzJ.js} +2 -2
- package/dist/client/assets/{client-OmvShYdC.js.map → client-P7FaPwzJ.js.map} +1 -1
- package/dist/client/assets/{connectionTestTransport-c25QXx7A.js → connectionTestTransport-C9iPOkKM.js} +2 -2
- package/dist/client/assets/{connectionTestTransport-c25QXx7A.js.map → connectionTestTransport-C9iPOkKM.js.map} +1 -1
- package/dist/client/assets/{index-DLoOV6Hp.js → index-DpW_ckau.js} +3 -3
- package/dist/client/assets/{index-DLoOV6Hp.js.map → index-DpW_ckau.js.map} +1 -1
- package/dist/client/assets/{patterns-DEbg7R-A-Cw0A2uKS.js → patterns-DEbg7R-A-BhsMyh9D.js} +2 -2
- package/dist/client/assets/{patterns-DEbg7R-A-Cw0A2uKS.js.map → patterns-DEbg7R-A-BhsMyh9D.js.map} +1 -1
- package/dist/client/assets/{presentPortfolio-CkRqd_zz.js → presentPortfolio-D-v615bg.js} +2 -2
- package/dist/client/assets/{presentPortfolio-CkRqd_zz.js.map → presentPortfolio-D-v615bg.js.map} +1 -1
- package/dist/client/assets/presentWorkspaceItems-IAp5SnpB.js +2 -0
- package/dist/client/assets/presentWorkspaceItems-IAp5SnpB.js.map +1 -0
- package/dist/client/assets/{releaseRoutes-DSWkTh-E.js → releaseRoutes-CfaNElmG.js} +2 -2
- package/dist/client/assets/{releaseRoutes-DSWkTh-E.js.map → releaseRoutes-CfaNElmG.js.map} +1 -1
- package/dist/client/assets/{serviceOnboarding-B9pvdyWf.js → serviceOnboarding-BZ2U_Ugw.js} +2 -2
- package/dist/client/assets/{serviceOnboarding-B9pvdyWf.js.map → serviceOnboarding-BZ2U_Ugw.js.map} +1 -1
- package/dist/client/assets/{useWorkspaceItems-D0FuHGto.js → useWorkspaceItems-DQTYaq1R.js} +2 -2
- package/dist/client/assets/{useWorkspaceItems-D0FuHGto.js.map → useWorkspaceItems-DQTYaq1R.js.map} +1 -1
- package/dist/client/assets/workspaceEntityRoutes-Biw67kRR.js +2 -0
- package/dist/client/assets/workspaceEntityRoutes-Biw67kRR.js.map +1 -0
- package/dist/client/build-graph.json +32 -2
- package/dist/client/index.html +1 -1
- package/dist/server/api/deliveryGraph.d.ts +126 -0
- package/dist/server/api/deliveryGraph.d.ts.map +1 -1
- package/dist/server/api/index.js +2 -2
- package/dist/server/api/shares.d.ts +14 -0
- package/dist/server/api/shares.d.ts.map +1 -1
- package/dist/server/assets/{BindConfig-BjK10BEb.js → BindConfig-Dk3vjYZc.js} +7 -7
- package/dist/server/assets/{BindConfig-BjK10BEb.js.map → BindConfig-Dk3vjYZc.js.map} +1 -1
- package/dist/server/assets/{controlCenterApi-tZPvRPRH.js → controlCenterApi-Dsug4Rzi.js} +2 -2
- package/dist/server/assets/{controlCenterApi-tZPvRPRH.js.map → controlCenterApi-Dsug4Rzi.js.map} +1 -1
- package/dist/server/assets/{domainEvent-x7yeq-gU.js → domainEvent-CZLKMqgn.js} +13 -2
- package/dist/server/assets/{domainEvent-x7yeq-gU.js.map → domainEvent-CZLKMqgn.js.map} +1 -1
- package/dist/server/assets/{firstPartyServices-Y41P8uke.js → firstPartyServices-BWdrzdfD.js} +2 -2
- package/dist/server/assets/{firstPartyServices-Y41P8uke.js.map → firstPartyServices-BWdrzdfD.js.map} +1 -1
- package/dist/server/assets/{manualPluginSynchronization-C0aHB4UM.js → manualPluginSynchronization-CDnX9qXi.js} +64 -23
- package/dist/server/assets/manualPluginSynchronization-CDnX9qXi.js.map +1 -0
- package/dist/server/assets/{portfolioInvalidation-Ds9Xm4_P.js → portfolioInvalidation-iTUo5N4r.js} +26 -6
- package/dist/server/assets/portfolioInvalidation-iTUo5N4r.js.map +1 -0
- package/dist/server/assets/{readiness-CzU3vjYQ.js → readiness-CZBkcjLP.js} +2 -2
- package/dist/server/assets/{readiness-CzU3vjYQ.js.map → readiness-CZBkcjLP.js.map} +1 -1
- package/dist/server/build-graph.json +1 -0
- package/dist/server/domain/deliveryGraph.d.ts +14 -0
- package/dist/server/domain/deliveryGraph.d.ts.map +1 -1
- package/dist/server/domain/index.js +3 -3
- package/dist/server/index.js +4 -4
- package/dist/server/server/application/normalizedPluginPageMaterialization.d.ts +1 -1
- package/dist/server/server/application/normalizedPluginPageMaterialization.d.ts.map +1 -1
- package/dist/server/server/cli.js +4 -4
- package/dist/server/server/index.js +3 -3
- package/dist/server/server/persistence/Persistence.d.ts +35 -0
- package/dist/server/server/persistence/Persistence.d.ts.map +1 -1
- package/dist/server/server/persistence/repositories/delivery-graph/contract.d.ts +56 -0
- package/dist/server/server/persistence/repositories/delivery-graph/contract.d.ts.map +1 -1
- package/dist/server/server/persistence/repositories/delivery-graph/decode.d.ts +7 -0
- package/dist/server/server/persistence/repositories/delivery-graph/decode.d.ts.map +1 -1
- package/dist/server/server/persistence/repositories/delivery-graph/read.d.ts +35 -0
- package/dist/server/server/persistence/repositories/delivery-graph/read.d.ts.map +1 -1
- package/dist/server/server/persistence/repositories/delivery-graph/rows.d.ts +7 -0
- package/dist/server/server/persistence/repositories/delivery-graph/rows.d.ts.map +1 -1
- package/dist/server/server/persistence/repositories/delivery-graph/write.d.ts +14 -0
- package/dist/server/server/persistence/repositories/delivery-graph/write.d.ts.map +1 -1
- package/dist/server/server/persistence/repositories/deliveryGraphRepository.d.ts +35 -0
- package/dist/server/server/persistence/repositories/deliveryGraphRepository.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/client/assets/ReleaseWorkset-BhGacsgb.js +0 -2
- package/dist/client/assets/ReleaseWorkset-BhGacsgb.js.map +0 -1
- package/dist/client/assets/WorkspaceEntityRoute-DPci8Q8I.js +0 -30
- package/dist/client/assets/WorkspaceEntityRoute-DPci8Q8I.js.map +0 -1
- package/dist/client/assets/presentWorkspaceItems-BU__8LcC.js +0 -2
- package/dist/client/assets/presentWorkspaceItems-BU__8LcC.js.map +0 -1
- package/dist/client/assets/workspaceEntityRoutes-CRcfSq7c.js +0 -2
- package/dist/client/assets/workspaceEntityRoutes-CRcfSq7c.js.map +0 -1
- package/dist/server/assets/manualPluginSynchronization-C0aHB4UM.js.map +0 -1
- package/dist/server/assets/portfolioInvalidation-Ds9Xm4_P.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manualPluginSynchronization-CDnX9qXi.js","names":[],"sources":["../../../src/server/application/pluginSynchronizationAuthority.ts","../../../src/server/application/relationshipInference.ts","../../../src/server/application/relationshipInferenceMaterialization.ts","../../../src/server/application/normalizedPluginPageMaterialization.ts","../../../src/server/application/manualPluginSynchronization.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\"\nimport * as Option from \"effect/Option\"\n\nimport type { PluginConnectionId, WorkspaceId } from \"../../domain/identifiers.js\"\nimport type { ProviderId } from \"../../domain/sourceRevision.js\"\nimport type { PersistenceOperationFailure, PersistenceService } from \"../persistence/Persistence.js\"\nimport type { PluginConnectionRecord } from \"../persistence/repositories/models.js\"\nimport { PluginConflictFailure } from \"../plugins/failures.js\"\n\n/** Exact mutable host state that authorized one manual synchronization runtime. */\nexport interface PluginSynchronizationAuthority {\n readonly workspaceId: WorkspaceId\n readonly pluginConnectionId: PluginConnectionId\n readonly providerId: ProviderId\n readonly connectionRevision: number\n readonly configurationRevision: number | null\n}\n\nconst conflict = () =>\n new PluginConflictFailure({\n operation: \"manual-sync\",\n diagnosticCode: \"manual-sync-runtime-authority-changed\"\n })\n\nconst authorityFor = Effect.fn(\"PluginSynchronizationAuthority.forConnection\")(function*(\n persistence: PersistenceService,\n connection: PluginConnectionRecord\n) {\n const configuration = yield* persistence.pluginConfigurations.get(\n connection.workspaceId,\n connection.pluginConnectionId\n )\n return {\n workspaceId: connection.workspaceId,\n pluginConnectionId: connection.pluginConnectionId,\n providerId: connection.providerId,\n connectionRevision: connection.revision,\n configurationRevision: Option.isSome(configuration) ? configuration.value.revision : null\n } satisfies PluginSynchronizationAuthority\n})\n\n/** Capture connection and configuration revisions in one durable read transaction. */\nexport const capturePluginSynchronizationAuthority = Effect.fn(\n \"PluginSynchronizationAuthority.capture\"\n)(function*(\n persistence: PersistenceService,\n workspaceId: WorkspaceId,\n pluginConnectionId: PluginConnectionId\n): Effect.fn.Return<\n { readonly connection: PluginConnectionRecord; readonly authority: PluginSynchronizationAuthority },\n PersistenceOperationFailure\n> {\n return yield* persistence.transact(Effect.gen(function*() {\n const connection = yield* persistence.pluginConnections.get(workspaceId, pluginConnectionId)\n const authority = yield* authorityFor(persistence, connection)\n return { connection, authority }\n }))\n})\n\n/** Reject a write transaction when its runtime no longer owns current connection authority. */\nexport const verifyPluginSynchronizationAuthority = Effect.fn(\n \"PluginSynchronizationAuthority.verify\"\n)(function*(\n persistence: PersistenceService,\n expected: PluginSynchronizationAuthority\n): Effect.fn.Return<void, PluginConflictFailure | PersistenceOperationFailure> {\n const connection = yield* persistence.pluginConnections.get(\n expected.workspaceId,\n expected.pluginConnectionId\n ).pipe(\n Effect.catchTag(\"RecordNotFoundError\", () => conflict())\n )\n const current = yield* authorityFor(persistence, connection)\n if (\n !connection.isEnabled ||\n current.providerId !== expected.providerId ||\n current.connectionRevision !== expected.connectionRevision ||\n current.configurationRevision !== expected.configurationRevision\n ) {\n return yield* conflict()\n }\n})\n","import type {\n DeliveryEntityKind,\n DeliveryEntityProjection,\n DeliveryRelationship,\n RelationshipEndpointKind,\n RelationshipKind\n} from \"../../domain/deliveryGraph.js\"\nimport type { EntityId, GraphNodeId, ReleaseId } from \"../../domain/identifiers.js\"\n\n/** One current canonical entity exposed to provider-neutral relationship rules. */\nexport interface RelationshipInferenceEntity {\n readonly nodeId: GraphNodeId\n readonly projection: DeliveryEntityProjection\n readonly releaseIds: ReadonlyArray<ReleaseId>\n}\n\n/** One canonical release exposed without provider-specific version objects. */\nexport interface RelationshipInferenceRelease {\n readonly nodeId: GraphNodeId\n readonly releaseId: ReleaseId\n readonly version: string\n}\n\nexport type RelationshipInferenceEndpoint =\n | Readonly<{ readonly _tag: \"resolved\"; readonly kind: RelationshipEndpointKind; readonly nodeId: GraphNodeId }>\n | Readonly<{\n readonly _tag: \"missing\"\n readonly identityKey: string\n readonly kind: DeliveryEntityKind\n readonly missingKey: string\n }>\n\n/** Explainable candidate ready for evidence and ledger materialization. */\nexport interface RelationshipInferenceCandidate {\n readonly confidence: Readonly<{ readonly score: number; readonly rationale: string }> | null\n readonly evidenceEntityId: EntityId | null\n readonly identityKey: string\n readonly kind: RelationshipKind\n readonly lifecycle: \"inferred\" | \"missing\"\n readonly observationKey: string\n readonly releaseId: ReleaseId\n readonly ruleId: string\n readonly source: RelationshipInferenceEndpoint\n readonly target: RelationshipInferenceEndpoint\n}\n\nexport interface RelationshipInferenceResult {\n readonly candidates: ReadonlyArray<RelationshipInferenceCandidate>\n readonly obsoleteGapIdentityKeys: ReadonlyArray<string>\n readonly obsoleteRelationshipIds: ReadonlyArray<DeliveryRelationship[\"relationshipId\"]>\n readonly truncated: boolean\n}\n\nconst MAXIMUM_INFERENCE_CANDIDATES = 2_000\n\ninterface CandidateAccumulator {\n readonly candidates: Array<RelationshipInferenceCandidate>\n truncated: boolean\n}\n\nconst addCandidate = (\n accumulator: CandidateAccumulator,\n candidate: RelationshipInferenceCandidate\n): void => {\n if (accumulator.candidates.length >= MAXIMUM_INFERENCE_CANDIDATES) {\n accumulator.truncated = true\n return\n }\n accumulator.candidates.push(candidate)\n}\n\nconst OWNED_RULE_IDS = new Set([\n \"codepipeline-trigger-revision-v1\",\n \"confluence-jira-link-v1\",\n \"confluence-release-link-v1\",\n \"jira-key-in-clockify-description-v1\",\n \"jira-key-in-confluence-metadata-v1\",\n \"jira-key-in-pull-request-metadata-v1\",\n \"release-in-confluence-metadata-v1\"\n])\n\nconst present = (entity: RelationshipInferenceEntity): boolean => entity.projection.entityState === \"present\"\n\nconst resolved = (kind: RelationshipEndpointKind, nodeId: GraphNodeId): RelationshipInferenceEndpoint => ({\n _tag: \"resolved\",\n kind,\n nodeId\n})\n\nconst missing = (\n kind: DeliveryEntityKind,\n missingKey: string,\n identityKey: string\n): RelationshipInferenceEndpoint => ({\n _tag: \"missing\",\n identityKey,\n kind,\n missingKey\n})\n\nconst currentRelationship = (relationship: DeliveryRelationship): boolean =>\n relationship.lifecycle._tag !== \"missing\" &&\n relationship.lifecycle._tag !== \"rejected\" &&\n relationship.lifecycle._tag !== \"superseded\"\n\nconst currentExternalRelationship = (relationship: DeliveryRelationship): boolean =>\n currentRelationship(relationship) &&\n !(\n relationship.lifecycle._tag === \"inferred\" &&\n relationship.provenance._tag === \"rule\" &&\n OWNED_RULE_IDS.has(relationship.provenance.ruleId)\n )\n\nconst currentOwnedRelationship = (relationship: DeliveryRelationship): boolean =>\n currentRelationship(relationship) &&\n relationship.lifecycle._tag === \"inferred\" &&\n relationship.provenance._tag === \"rule\" &&\n OWNED_RULE_IDS.has(relationship.provenance.ruleId)\n\nconst currentInferenceRelationship = (relationship: DeliveryRelationship): boolean =>\n relationship.lifecycle._tag !== \"rejected\" &&\n relationship.lifecycle._tag !== \"superseded\" &&\n relationship.provenance._tag === \"rule\" &&\n (relationship.provenance.ruleId === \"delivery-gap-v1\" || OWNED_RULE_IDS.has(relationship.provenance.ruleId))\n\nconst relationshipInRelease = (relationship: DeliveryRelationship, releaseId: ReleaseId): boolean =>\n relationship.scope?._tag === \"release\" && relationship.scope.releaseId === releaseId\n\nconst containsToken = (text: string, token: string): boolean => {\n const normalizedText = text.toUpperCase()\n const normalizedToken = token.toUpperCase()\n let offset = normalizedText.indexOf(normalizedToken)\n while (offset >= 0) {\n const before = normalizedText[offset - 1]\n const after = normalizedText[offset + normalizedToken.length]\n const boundary = (character: string | undefined) => character === undefined || !/[A-Z0-9]/u.test(character)\n if (boundary(before) && boundary(after)) return true\n offset = normalizedText.indexOf(normalizedToken, offset + normalizedToken.length)\n }\n return false\n}\n\nconst containsReleaseVersion = (text: string, version: string): boolean => {\n const normalizedText = text.toUpperCase()\n const normalizedVersion = version.toUpperCase()\n let offset = normalizedText.indexOf(normalizedVersion)\n while (offset >= 0) {\n const before = normalizedText[offset - 1]\n const after = normalizedText[offset + normalizedVersion.length]\n const boundary = (character: string | undefined) => character === undefined || !/[A-Z0-9._+-]/u.test(character)\n if (boundary(before) && boundary(after)) return true\n offset = normalizedText.indexOf(normalizedVersion, offset + normalizedVersion.length)\n }\n return false\n}\n\nconst metadata = (entity: RelationshipInferenceEntity): string => {\n const details = entity.projection.details\n return details._tag === \"pull-request\"\n ? [entity.projection.title, entity.projection.displayKey, details.sourceBranch, details.targetBranch].join(\"\\n\")\n : [entity.projection.title, entity.projection.displayKey].join(\"\\n\")\n}\n\nconst observationKey = (...entities: ReadonlyArray<RelationshipInferenceEntity>): string =>\n entities\n .map(({ projection }) => `${projection.entityId}@${String(projection.projectionRevision)}`)\n .sort()\n .join(\"+\")\n\nconst inferred = (input: Omit<RelationshipInferenceCandidate, \"lifecycle\">): RelationshipInferenceCandidate => ({\n ...input,\n lifecycle: \"inferred\"\n})\n\nconst gap = (input: {\n readonly identityKey: string\n readonly kind: RelationshipKind\n readonly releaseId: ReleaseId\n readonly source: RelationshipInferenceEndpoint\n readonly target: RelationshipInferenceEndpoint\n}): RelationshipInferenceCandidate => ({\n ...input,\n confidence: null,\n evidenceEntityId: null,\n lifecycle: \"missing\",\n observationKey: input.identityKey,\n ruleId: \"delivery-gap-v1\"\n})\n\nconst candidateIdentity = (\n kind: RelationshipKind,\n releaseId: ReleaseId,\n source: GraphNodeId,\n target: GraphNodeId\n): string => `relationship:${kind}:${releaseId}:${source}:${target}`\n\nconst issueGapIdentity = (releaseId: ReleaseId, issueNodeId: GraphNodeId): string =>\n `gap:implements:${releaseId}:${issueNodeId}`\n\nconst pipelineGapIdentity = (releaseId: ReleaseId, pullRequestNodeId: GraphNodeId): string =>\n `gap:delivered-by:${releaseId}:${pullRequestNodeId}`\n\nconst candidateGapKey = (candidate: RelationshipInferenceCandidate): string | null => {\n if (candidate.lifecycle !== \"missing\") return null\n if (candidate.kind === \"implements\" && candidate.target._tag === \"resolved\") {\n return `${candidate.kind}:${candidate.releaseId}:${candidate.target.nodeId}`\n }\n if (candidate.kind === \"delivered-by\" && candidate.source._tag === \"resolved\") {\n return `${candidate.kind}:${candidate.releaseId}:${candidate.source.nodeId}`\n }\n return null\n}\n\nconst relationshipGapKey = (relationship: DeliveryRelationship): string | null => {\n if (\n relationship.lifecycle._tag !== \"missing\" ||\n relationship.provenance._tag !== \"rule\" ||\n relationship.provenance.ruleId !== \"delivery-gap-v1\" ||\n relationship.scope?._tag !== \"release\"\n ) return null\n if (relationship.kind === \"implements\") {\n return `${relationship.kind}:${relationship.scope.releaseId}:${relationship.targetNodeId}`\n }\n if (relationship.kind === \"delivered-by\") {\n return `${relationship.kind}:${relationship.scope.releaseId}:${relationship.sourceNodeId}`\n }\n return null\n}\n\nconst hasRelationship = (\n relationships: ReadonlyArray<DeliveryRelationship>,\n releaseId: ReleaseId,\n kind: RelationshipKind,\n sourceNodeId: GraphNodeId | null,\n targetNodeId: GraphNodeId | null\n): boolean =>\n relationships.some(\n (relationship) =>\n currentExternalRelationship(relationship) &&\n relationshipInRelease(relationship, releaseId) &&\n relationship.kind === kind &&\n (sourceNodeId === null || relationship.sourceNodeId === sourceNodeId) &&\n (targetNodeId === null || relationship.targetNodeId === targetNodeId)\n )\n\nconst addIssueAndTimeCandidates = (\n entities: ReadonlyArray<RelationshipInferenceEntity>,\n accumulator: CandidateAccumulator\n) => {\n const issues = entities.filter((entity) => entity.projection.details._tag === \"issue\")\n const timeEntries = entities.filter((entity) => entity.projection.details._tag === \"time-entry\")\n for (const timeEntry of timeEntries) {\n for (const issue of issues) {\n const details = issue.projection.details\n if (details._tag !== \"issue\" || !containsToken(metadata(timeEntry), details.key)) continue\n for (const releaseId of issue.releaseIds) {\n addCandidate(\n accumulator,\n inferred({\n confidence: { score: 0.95, rationale: `The Clockify description contains Jira key ${details.key}.` },\n evidenceEntityId: timeEntry.projection.entityId,\n identityKey: candidateIdentity(\"tracks-time-for\", releaseId, timeEntry.nodeId, issue.nodeId),\n kind: \"tracks-time-for\",\n observationKey: observationKey(timeEntry, issue),\n releaseId,\n ruleId: \"jira-key-in-clockify-description-v1\",\n source: resolved(\"time-entry\", timeEntry.nodeId),\n target: resolved(\"issue\", issue.nodeId)\n })\n )\n }\n }\n }\n}\n\nconst addDocumentationCandidates = (\n entities: ReadonlyArray<RelationshipInferenceEntity>,\n releases: ReadonlyArray<RelationshipInferenceRelease>,\n accumulator: CandidateAccumulator\n) => {\n const issues = entities.filter((entity) => entity.projection.details._tag === \"issue\")\n const releaseVersionCounts = new Map<string, number>()\n for (const release of releases) {\n const version = release.version.toUpperCase()\n releaseVersionCounts.set(version, (releaseVersionCounts.get(version) ?? 0) + 1)\n }\n const pages = entities.filter(\n (entity) => entity.projection.details._tag === \"page\" && entity.projection.details.status === \"current\"\n )\n for (const page of pages) {\n const pageDetails = page.projection.details\n if (pageDetails._tag !== \"page\") continue\n const pageMetadata = metadata(page)\n for (const issue of issues) {\n const details = issue.projection.details\n if (details._tag !== \"issue\") continue\n const explicitLink = pageDetails.linkedIssueKeys?.some((key) =>\n key.toUpperCase() === details.key.toUpperCase()\n ) ?? false\n if (!explicitLink && !containsToken(pageMetadata, details.key)) continue\n for (const releaseId of issue.releaseIds) {\n addCandidate(\n accumulator,\n inferred({\n confidence: {\n score: explicitLink ? 0.97 : 0.9,\n rationale: explicitLink\n ? `Confluence metadata links Jira key ${details.key}.`\n : `Confluence page metadata contains Jira key ${details.key}.`\n },\n evidenceEntityId: page.projection.entityId,\n identityKey: candidateIdentity(\"documented-by\", releaseId, issue.nodeId, page.nodeId),\n kind: \"documented-by\",\n observationKey: observationKey(page, issue),\n releaseId,\n ruleId: explicitLink ? \"confluence-jira-link-v1\" : \"jira-key-in-confluence-metadata-v1\",\n source: resolved(\"issue\", issue.nodeId),\n target: resolved(\"page\", page.nodeId)\n })\n )\n }\n }\n for (const release of releases) {\n if ((releaseVersionCounts.get(release.version.toUpperCase()) ?? 0) > 1) continue\n const explicitLink = pageDetails.linkedReleaseVersions?.some(\n (version) => version.toUpperCase() === release.version.toUpperCase()\n ) ?? false\n if (!explicitLink && !containsReleaseVersion(pageMetadata, release.version)) continue\n addCandidate(\n accumulator,\n inferred({\n confidence: {\n score: explicitLink ? 0.96 : 0.88,\n rationale: explicitLink\n ? `Confluence metadata links release ${release.version}.`\n : `Confluence page metadata contains release ${release.version}.`\n },\n evidenceEntityId: page.projection.entityId,\n identityKey: candidateIdentity(\"documented-by\", release.releaseId, release.nodeId, page.nodeId),\n kind: \"documented-by\",\n observationKey: observationKey(page),\n releaseId: release.releaseId,\n ruleId: explicitLink ? \"confluence-release-link-v1\" : \"release-in-confluence-metadata-v1\",\n source: resolved(\"release\", release.nodeId),\n target: resolved(\"page\", page.nodeId)\n })\n )\n }\n }\n}\n\n/**\n * Infer a deterministic relationship set from current canonical facts. Rules\n * only propose `inferred` or `missing`; confirmation remains governed.\n */\nexport const deriveRelationshipInference = (input: {\n readonly entities: ReadonlyArray<RelationshipInferenceEntity>\n readonly rejectedCandidateIdentityKeys?: ReadonlySet<string>\n readonly releases: ReadonlyArray<RelationshipInferenceRelease>\n readonly relationships: ReadonlyArray<DeliveryRelationship>\n}): RelationshipInferenceResult => {\n const entities = input.entities.filter(present).map((entity) => ({\n ...entity,\n releaseIds: entity.releaseIds.filter((releaseId) => {\n const touchesEntity = (relationship: DeliveryRelationship) =>\n relationshipInRelease(relationship, releaseId) &&\n (relationship.sourceNodeId === entity.nodeId || relationship.targetNodeId === entity.nodeId)\n const inferenceMembership = input.relationships.some(\n (relationship) => currentInferenceRelationship(relationship) && touchesEntity(relationship)\n )\n return !inferenceMembership ||\n input.relationships.some((relationship) =>\n currentExternalRelationship(relationship) &&\n touchesEntity(relationship)\n )\n })\n }))\n const issues = entities.filter((entity) => entity.projection.details._tag === \"issue\")\n const pullRequests = entities.filter((entity) => entity.projection.details._tag === \"pull-request\")\n const pipelines = entities.filter((entity) => entity.projection.details._tag === \"pipeline-execution\")\n const accumulator: CandidateAccumulator = { candidates: [], truncated: false }\n const obsoleteGaps = new Set<string>()\n const inferredIssueLinks = new Set<string>()\n const pullRequestReleases = new Map<GraphNodeId, Set<ReleaseId>>()\n\n for (const pullRequest of pullRequests) {\n const details = pullRequest.projection.details\n if (details._tag !== \"pull-request\") continue\n const releaseIds = new Set(\n pullRequest.releaseIds.filter((releaseId) => {\n const touchesPullRequest = (relationship: DeliveryRelationship) =>\n relationshipInRelease(relationship, releaseId) &&\n (relationship.sourceNodeId === pullRequest.nodeId || relationship.targetNodeId === pullRequest.nodeId)\n const ownedMembership = input.relationships.some(\n (relationship) => currentOwnedRelationship(relationship) && touchesPullRequest(relationship)\n )\n return !ownedMembership || input.relationships.some(\n (relationship) => currentExternalRelationship(relationship) && touchesPullRequest(relationship)\n )\n })\n )\n for (const issue of issues) {\n const issueDetails = issue.projection.details\n if (issueDetails._tag !== \"issue\" || !containsToken(metadata(pullRequest), issueDetails.key)) continue\n for (const releaseId of issue.releaseIds) {\n const identityKey = candidateIdentity(\"implements\", releaseId, pullRequest.nodeId, issue.nodeId)\n if (!(input.rejectedCandidateIdentityKeys?.has(identityKey) ?? false)) {\n releaseIds.add(releaseId)\n inferredIssueLinks.add(`${releaseId}:${issue.nodeId}`)\n obsoleteGaps.add(issueGapIdentity(releaseId, issue.nodeId))\n }\n addCandidate(\n accumulator,\n inferred({\n confidence: {\n score: containsToken(pullRequest.projection.title, issueDetails.key) ? 0.98 : 0.94,\n rationale: `The immutable pull-request metadata contains Jira key ${issueDetails.key}.`\n },\n evidenceEntityId: pullRequest.projection.entityId,\n identityKey,\n kind: \"implements\",\n observationKey: observationKey(pullRequest, issue),\n releaseId,\n ruleId: \"jira-key-in-pull-request-metadata-v1\",\n source: resolved(\"pull-request\", pullRequest.nodeId),\n target: resolved(\"issue\", issue.nodeId)\n })\n )\n }\n }\n for (const relationship of input.relationships) {\n if (\n currentExternalRelationship(relationship) &&\n relationship.kind === \"implements\" &&\n relationship.sourceNodeId === pullRequest.nodeId &&\n relationship.scope?._tag === \"release\"\n ) {\n releaseIds.add(relationship.scope.releaseId)\n }\n }\n pullRequestReleases.set(pullRequest.nodeId, releaseIds)\n }\n\n for (const issue of issues) {\n for (const releaseId of issue.releaseIds) {\n const identityKey = issueGapIdentity(releaseId, issue.nodeId)\n if (\n inferredIssueLinks.has(`${releaseId}:${issue.nodeId}`) ||\n hasRelationship(input.relationships, releaseId, \"implements\", null, issue.nodeId)\n ) {\n obsoleteGaps.add(identityKey)\n } else {\n const details = issue.projection.details\n if (details._tag !== \"issue\") continue\n addCandidate(\n accumulator,\n gap({\n identityKey,\n kind: \"implements\",\n releaseId,\n source: missing(\"pull-request\", `${details.key}:pull-request`, issue.nodeId),\n target: resolved(\"issue\", issue.nodeId)\n })\n )\n }\n }\n }\n\n const inferredPipelineLinks = new Set<string>()\n for (const pullRequest of pullRequests) {\n const pullRequestDetails = pullRequest.projection.details\n if (pullRequestDetails._tag !== \"pull-request\") continue\n for (const pipeline of pipelines) {\n const pipelineDetails = pipeline.projection.details\n if (\n pipelineDetails._tag !== \"pipeline-execution\" ||\n pipelineDetails.triggerRevision !== pullRequestDetails.headRevision\n ) {\n continue\n }\n for (const releaseId of pullRequestReleases.get(pullRequest.nodeId) ?? []) {\n const identityKey = candidateIdentity(\"delivered-by\", releaseId, pullRequest.nodeId, pipeline.nodeId)\n if (!(input.rejectedCandidateIdentityKeys?.has(identityKey) ?? false)) {\n inferredPipelineLinks.add(`${releaseId}:${pullRequest.nodeId}`)\n obsoleteGaps.add(pipelineGapIdentity(releaseId, pullRequest.nodeId))\n }\n addCandidate(\n accumulator,\n inferred({\n confidence: {\n score: 0.99,\n rationale:\n `The pipeline trigger revision exactly matches pull-request head ${pullRequestDetails.headRevision}.`\n },\n evidenceEntityId: pipeline.projection.entityId,\n identityKey,\n kind: \"delivered-by\",\n observationKey: observationKey(pullRequest, pipeline),\n releaseId,\n ruleId: \"codepipeline-trigger-revision-v1\",\n source: resolved(\"pull-request\", pullRequest.nodeId),\n target: resolved(\"pipeline-execution\", pipeline.nodeId)\n })\n )\n }\n }\n }\n\n for (const pullRequest of pullRequests) {\n for (const releaseId of pullRequestReleases.get(pullRequest.nodeId) ?? []) {\n const identityKey = pipelineGapIdentity(releaseId, pullRequest.nodeId)\n if (\n inferredPipelineLinks.has(`${releaseId}:${pullRequest.nodeId}`) ||\n hasRelationship(input.relationships, releaseId, \"delivered-by\", pullRequest.nodeId, null) ||\n hasRelationship(input.relationships, releaseId, \"verified-by\", pullRequest.nodeId, null)\n ) {\n obsoleteGaps.add(identityKey)\n } else {\n addCandidate(\n accumulator,\n gap({\n identityKey,\n kind: \"delivered-by\",\n releaseId,\n source: resolved(\"pull-request\", pullRequest.nodeId),\n target: missing(\n \"pipeline-execution\",\n `${pullRequest.projection.displayKey}:pipeline-execution`,\n pullRequest.nodeId\n )\n })\n )\n }\n }\n }\n\n addIssueAndTimeCandidates(entities, accumulator)\n addDocumentationCandidates(entities, input.releases, accumulator)\n const unique = new Map(accumulator.candidates.map((candidate) => [candidate.identityKey, candidate]))\n const candidateEdges = new Set(\n [...unique.values()].flatMap((candidate) =>\n candidate.lifecycle === \"inferred\" && candidate.source._tag === \"resolved\" && candidate.target._tag === \"resolved\"\n ? [`${candidate.kind}:${candidate.releaseId}:${candidate.source.nodeId}:${candidate.target.nodeId}`]\n : []\n )\n )\n const candidateGaps = new Set(\n [...unique.values()].flatMap((candidate) => {\n const key = candidateGapKey(candidate)\n return key === null ? [] : [key]\n })\n )\n const obsoleteRelationshipIds = input.relationships.flatMap((relationship) => {\n const gapKey = relationshipGapKey(relationship)\n const obsoleteInference = relationship.lifecycle._tag === \"inferred\" &&\n relationship.provenance._tag === \"rule\" &&\n OWNED_RULE_IDS.has(relationship.provenance.ruleId) &&\n relationship.scope?._tag === \"release\" &&\n !candidateEdges.has(\n `${relationship.kind}:${relationship.scope.releaseId}:${relationship.sourceNodeId}:${relationship.targetNodeId}`\n )\n const obsoleteGap = gapKey !== null && !candidateGaps.has(gapKey)\n return obsoleteInference || obsoleteGap ? [relationship.relationshipId] : []\n })\n return {\n candidates: [...unique.values()].sort((left, right) => left.identityKey.localeCompare(right.identityKey)),\n obsoleteGapIdentityKeys: [...obsoleteGaps].sort(),\n obsoleteRelationshipIds: [...new Set(obsoleteRelationshipIds)].sort(),\n truncated: accumulator.truncated\n }\n}\n","import * as DateTime from \"effect/DateTime\"\nimport * as Effect from \"effect/Effect\"\nimport * as Result from \"effect/Result\"\nimport * as Schema from \"effect/Schema\"\n\nimport {\n type DeliveryNode,\n type DeliveryRelationship,\n type EvidenceClaim,\n type EvidenceItem,\n LedgerRevision\n} from \"../../domain/deliveryGraph.js\"\nimport type { PluginHealth } from \"../../domain/freshness.js\"\nimport { EvidenceClaimId, EvidenceId, GraphNodeId, RelationshipId, type WorkspaceId } from \"../../domain/identifiers.js\"\nimport type { UtcTimestamp } from \"../../domain/utcTimestamp.js\"\nimport { PersistenceOperationError } from \"../persistence/errors.js\"\nimport type { PersistenceOperationFailure, PersistenceService } from \"../persistence/Persistence.js\"\nimport { DeliveryGraphWriteBatch } from \"../persistence/repositories/deliveryGraphRepository.js\"\nimport type { EntityRecord } from \"../persistence/repositories/models.js\"\nimport { PluginStreamKey } from \"../persistence/repositories/pluginRuntimeModels.js\"\nimport { firstPartySyncStreamKey } from \"../plugins/firstPartySynchronization.js\"\nimport {\n deriveRelationshipInference,\n type RelationshipInferenceCandidate,\n type RelationshipInferenceEndpoint,\n type RelationshipInferenceEntity,\n type RelationshipInferenceRelease\n} from \"./relationshipInference.js\"\n\nconst MAXIMUM_INFERENCE_ENTITIES = 500\nconst MAXIMUM_INFERENCE_RELEASES = 50\nconst MAXIMUM_INFERENCE_RELATIONSHIPS = 2_000\nconst COMPONENT = \"relationship-inference\"\n\nexport interface RelationshipInferenceMaterializationScope {\n readonly committedAt: UtcTimestamp\n readonly streamKey: PluginStreamKey\n readonly successfulHealth: Extract<PluginHealth, { readonly _tag: \"healthy\" | \"degraded\" }>\n readonly workspaceId: WorkspaceId\n}\n\nexport interface RelationshipInferenceMaterializationReceipt {\n readonly evidenceClaimCount: number\n readonly evidenceItemCount: number\n readonly nodeCount: number\n readonly relationshipCount: number\n readonly skippedDueToBounds: boolean\n}\n\ntype StableIdentity<IdentityError> = (identity: string) => Effect.Effect<string, IdentityError>\n\nconst readRelationship = Effect.fn(\"RelationshipInferenceMaterialization.readRelationship\")(function*(\n persistence: PersistenceService,\n workspaceId: WorkspaceId,\n relationshipId: RelationshipId\n) {\n const result = yield* persistence.deliveryGraph\n .read(workspaceId, {\n _tag: \"relationship\",\n relationshipId,\n revision: null\n })\n .pipe(Effect.result)\n if (Result.isFailure(result)) {\n if (result.failure._tag === \"RecordNotFoundError\") return null\n return yield* result.failure\n }\n return result.success._tag === \"relationship\" ? result.success.value : null\n})\n\nconst nodeExists = Effect.fn(\"RelationshipInferenceMaterialization.nodeExists\")(function*(\n persistence: PersistenceService,\n workspaceId: WorkspaceId,\n nodeId: GraphNodeId\n) {\n const result = yield* persistence.deliveryGraph\n .read(workspaceId, {\n _tag: \"node\",\n nodeId\n })\n .pipe(Effect.result)\n if (Result.isSuccess(result)) return true\n if (result.failure._tag === \"RecordNotFoundError\") return false\n return yield* result.failure\n})\n\nconst writeGraph = Effect.fn(\"RelationshipInferenceMaterialization.writeGraph\")(function*(\n persistence: PersistenceService,\n workspaceId: WorkspaceId,\n batch: typeof DeliveryGraphWriteBatch.Type\n) {\n const encoded = yield* Schema.encodeEffect(DeliveryGraphWriteBatch)(batch).pipe(\n Effect.mapError(() => new PersistenceOperationError({ operation: \"relationship-inference.encode\" }))\n )\n return yield* persistence.deliveryGraph.write(workspaceId, encoded)\n})\n\nconst relationshipIdentity = (workspaceId: WorkspaceId, identityKey: string): string =>\n `${workspaceId}\\u0000relationship-inference\\u0000relationship\\u0000${identityKey}`\n\nconst missingNodeIdentity = (workspaceId: WorkspaceId, endpointKind: string, missingKey: string): string =>\n `${workspaceId}\\u0000relationship-inference\\u0000missing-node\\u0000${endpointKind}\\u0000${missingKey}`\n\nconst evidenceIdentity = (\n workspaceId: WorkspaceId,\n identityKey: string,\n observationKey: string,\n kind: \"claim\" | \"item\"\n): string =>\n `${workspaceId}\\u0000relationship-inference\\u0000evidence-${kind}\\u0000${identityKey}\\u0000${observationKey}`\n\nconst entityNodeIdentity = (workspaceId: WorkspaceId, entity: EntityRecord): string => {\n const source = entity.sourceRevision\n return `${workspaceId}\\u0000${source.pluginConnectionId}\\u0000${source.providerId}\\u0000entity-node\\u0000${source.vendorImmutableId}`\n}\n\nconst releaseNodeIdentity = (\n workspaceId: WorkspaceId,\n pluginConnectionId: string,\n providerId: string,\n vendorImmutableId: string\n): string => `${workspaceId}\\u0000${pluginConnectionId}\\u0000${providerId}\\u0000release-node\\u0000${vendorImmutableId}`\n\nconst relationshipIdFor = <IdentityError>(\n identity: StableIdentity<IdentityError>,\n workspaceId: WorkspaceId,\n identityKey: string\n) => identity(relationshipIdentity(workspaceId, identityKey)).pipe(Effect.map(RelationshipId.make))\n\nconst endpointNode = <IdentityError>(\n identity: StableIdentity<IdentityError>,\n scope: RelationshipInferenceMaterializationScope,\n endpoint: RelationshipInferenceEndpoint\n) =>\n endpoint._tag === \"resolved\"\n ? Effect.succeed({ node: null, nodeId: endpoint.nodeId })\n : identity(missingNodeIdentity(scope.workspaceId, endpoint.kind, endpoint.identityKey)).pipe(\n Effect.map((value) => {\n const nodeId = GraphNodeId.make(value)\n const node: DeliveryNode = {\n workspaceId: scope.workspaceId,\n nodeId,\n endpointKind: endpoint.kind,\n resolution: {\n _tag: \"missing\",\n expectedKind: \"entity\",\n expectedEntityKind: endpoint.kind,\n missingKey: endpoint.missingKey\n },\n createdAt: scope.committedAt\n }\n return {\n nodeId,\n node\n }\n })\n )\n\nconst evidenceFor = Effect.fn(\"RelationshipInferenceMaterialization.evidenceFor\")(function*<IdentityError>(\n persistence: PersistenceService,\n identity: StableIdentity<IdentityError>,\n scope: RelationshipInferenceMaterializationScope,\n candidate: RelationshipInferenceCandidate,\n sourceNodeId: GraphNodeId,\n targetNodeId: GraphNodeId,\n entity: EntityRecord\n): Effect.fn.Return<\n { readonly claim: EvidenceClaim; readonly item: EvidenceItem },\n IdentityError | PersistenceOperationFailure\n> {\n const evidenceId = EvidenceId.make(\n yield* identity(evidenceIdentity(scope.workspaceId, candidate.identityKey, candidate.observationKey, \"item\"))\n )\n const evidenceClaimId = EvidenceClaimId.make(\n yield* identity(evidenceIdentity(scope.workspaceId, candidate.identityKey, candidate.observationKey, \"claim\"))\n )\n const source = entity.sourceRevision\n const sourceStreamKey = yield* Schema.decodeUnknownEffect(PluginStreamKey)(\n firstPartySyncStreamKey(source.providerId)\n ).pipe(Effect.mapError(() => new PersistenceOperationError({ operation: \"relationship-inference.source-stream\" })))\n const pluginHealth = yield* persistence.pluginRuntime.getLastSuccessfulHealth(\n scope.workspaceId,\n source.pluginConnectionId,\n sourceStreamKey\n )\n if (pluginHealth === null) {\n return yield* new PersistenceOperationError({ operation: \"relationship-inference.source-health\" })\n }\n const sourceAgeSeconds = Math.max(\n 0,\n (DateTime.toEpochMillis(scope.committedAt) - DateTime.toEpochMillis(source.lastObservedAt)) / 1_000\n )\n return {\n item: {\n workspaceId: scope.workspaceId,\n evidenceId,\n schemaVersion: 1,\n attribution: { _tag: \"system\", component: COMPONENT },\n verifier: { _tag: \"system\", component: COMPONENT },\n observedAt: source.lastObservedAt,\n recordedAt: scope.committedAt,\n validUntil: null,\n freshness: {\n _tag: \"current\",\n evaluatedAt: scope.committedAt,\n pluginHealth,\n provenance: { _tag: \"provider\", sourceRevision: source },\n sourceObservedAt: source.lastObservedAt,\n staleAfterSeconds: Math.max(1, Math.ceil(sourceAgeSeconds) + 86_400),\n synchronizedAt: source.synchronizedAt\n },\n retention: { classification: \"evidence\", retainUntil: null, legalHold: false }\n },\n claim: {\n workspaceId: scope.workspaceId,\n evidenceClaimId,\n evidenceId,\n subjectNodeId: sourceNodeId,\n predicate: \"relationship-observed\",\n value: { _tag: \"reference\", targetNodeId },\n recordedAt: scope.committedAt,\n supersedesEvidenceClaimId: null\n }\n }\n})\n\nconst unchanged = (\n previous: DeliveryRelationship | null,\n candidate: RelationshipInferenceCandidate,\n sourceNodeId: GraphNodeId,\n targetNodeId: GraphNodeId,\n claimId: EvidenceClaimId | null\n): boolean =>\n previous !== null &&\n previous.kind === candidate.kind &&\n previous.sourceNodeId === sourceNodeId &&\n previous.targetNodeId === targetNodeId &&\n previous.scope?._tag === \"release\" &&\n previous.scope.releaseId === candidate.releaseId &&\n previous.lifecycle._tag === candidate.lifecycle &&\n (claimId === null || previous.evidenceClaimIds.includes(claimId))\n\nconst protectedByDecision = (previous: DeliveryRelationship | null): boolean =>\n previous?.lifecycle._tag === \"governed\" ||\n previous?.lifecycle._tag === \"verified\" ||\n previous?.lifecycle._tag === \"rejected\"\n\nconst materializeCandidate = Effect.fn(\"RelationshipInferenceMaterialization.materializeCandidate\")(function*<\n IdentityError\n>(\n persistence: PersistenceService,\n identity: StableIdentity<IdentityError>,\n scope: RelationshipInferenceMaterializationScope,\n candidate: RelationshipInferenceCandidate,\n entityById: ReadonlyMap<string, EntityRecord>\n): Effect.fn.Return<RelationshipInferenceMaterializationReceipt, IdentityError | PersistenceOperationFailure> {\n const relationshipId = yield* relationshipIdFor(identity, scope.workspaceId, candidate.identityKey)\n const previous = yield* readRelationship(persistence, scope.workspaceId, relationshipId)\n if (protectedByDecision(previous)) {\n return {\n evidenceClaimCount: 0,\n evidenceItemCount: 0,\n nodeCount: 0,\n relationshipCount: 0,\n skippedDueToBounds: false\n }\n }\n const source = yield* endpointNode(identity, scope, candidate.source)\n const target = yield* endpointNode(identity, scope, candidate.target)\n const evidenceEntity = candidate.evidenceEntityId === null\n ? null\n : (entityById.get(candidate.evidenceEntityId) ?? null)\n const evidence = evidenceEntity === null\n ? null\n : yield* evidenceFor(persistence, identity, scope, candidate, source.nodeId, target.nodeId, evidenceEntity)\n if (unchanged(previous, candidate, source.nodeId, target.nodeId, evidence?.claim.evidenceClaimId ?? null)) {\n return {\n evidenceClaimCount: 0,\n evidenceItemCount: 0,\n nodeCount: 0,\n relationshipCount: 0,\n skippedDueToBounds: false\n }\n }\n const nodes = []\n if (source.node !== null && !(yield* nodeExists(persistence, scope.workspaceId, source.nodeId))) {\n nodes.push(source.node)\n }\n if (target.node !== null && !(yield* nodeExists(persistence, scope.workspaceId, target.nodeId))) {\n nodes.push(target.node)\n }\n const confidence: DeliveryRelationship[\"confidence\"] = candidate.confidence === null\n ? { _tag: \"unknown\", rationale: \"No matching provider evidence is currently synchronized.\" }\n : { _tag: \"inferred\", ...candidate.confidence }\n const relationship: DeliveryRelationship = {\n workspaceId: scope.workspaceId,\n relationshipId,\n relationshipSchemaVersion: 1,\n revision: LedgerRevision.make((previous?.revision ?? 0) + 1),\n supersedesRevision: previous?.revision ?? null,\n kind: candidate.kind,\n sourceNodeId: source.nodeId,\n sourceNodeKind: candidate.source.kind,\n targetNodeId: target.nodeId,\n targetNodeKind: candidate.target.kind,\n scope: { _tag: \"release\", releaseId: candidate.releaseId },\n lifecycle: candidate.lifecycle === \"missing\"\n ? {\n _tag: \"missing\",\n effectiveAt: scope.committedAt,\n reason: \"No synchronized provider evidence currently resolves this required delivery link.\"\n }\n : { _tag: \"inferred\", effectiveAt: scope.committedAt },\n confidence,\n provenance: {\n _tag: \"rule\",\n ruleId: candidate.ruleId,\n ruleVersion: 1,\n rationale: candidate.confidence?.rationale ?? \"Required delivery link has no synchronized match.\"\n },\n recordedBy: { _tag: \"system\", component: COMPONENT },\n evidenceClaimIds: evidence === null ? [] : [evidence.claim.evidenceClaimId],\n recordedAt: scope.committedAt\n }\n const receipt = yield* writeGraph(persistence, scope.workspaceId, {\n entityProjections: [],\n nodes,\n evidenceItems: evidence === null ? [] : [evidence.item],\n evidenceClaims: evidence === null ? [] : [evidence.claim],\n relationships: [relationship]\n })\n return { ...receipt, skippedDueToBounds: false }\n})\n\nconst supersedeObsoleteGap = Effect.fn(\"RelationshipInferenceMaterialization.supersedeObsoleteGap\")(function*<\n IdentityError\n>(\n persistence: PersistenceService,\n identity: StableIdentity<IdentityError>,\n scope: RelationshipInferenceMaterializationScope,\n identityKey: string\n): Effect.fn.Return<number, IdentityError | PersistenceOperationFailure> {\n const relationshipId = yield* relationshipIdFor(identity, scope.workspaceId, identityKey)\n const previous = yield* readRelationship(persistence, scope.workspaceId, relationshipId)\n if (previous?.lifecycle._tag !== \"missing\") return 0\n const relationship: DeliveryRelationship = {\n ...previous,\n revision: LedgerRevision.make(previous.revision + 1),\n supersedesRevision: previous.revision,\n lifecycle: {\n _tag: \"superseded\",\n effectiveAt: scope.committedAt,\n reason: \"New synchronized evidence resolved the previously missing link.\"\n },\n recordedAt: scope.committedAt\n }\n return (yield* writeGraph(persistence, scope.workspaceId, {\n entityProjections: [],\n nodes: [],\n evidenceItems: [],\n evidenceClaims: [],\n relationships: [relationship]\n })).relationshipCount\n})\n\nconst supersedeObsoleteRelationship = Effect.fn(\"RelationshipInferenceMaterialization.supersedeObsoleteRelationship\")(\n function*(\n persistence: PersistenceService,\n scope: RelationshipInferenceMaterializationScope,\n relationshipId: RelationshipId,\n reason?: string\n ) {\n const previous = yield* readRelationship(persistence, scope.workspaceId, relationshipId)\n if (previous?.lifecycle._tag !== \"inferred\" && previous?.lifecycle._tag !== \"missing\") return 0\n const relationship: DeliveryRelationship = {\n ...previous,\n revision: LedgerRevision.make(previous.revision + 1),\n supersedesRevision: previous.revision,\n lifecycle: {\n _tag: \"superseded\",\n effectiveAt: scope.committedAt,\n reason: reason ?? (previous.lifecycle._tag === \"missing\"\n ? \"The entity is no longer in the release scope that required this missing link.\"\n : \"Current synchronized metadata no longer supports this inferred link.\")\n },\n recordedAt: scope.committedAt\n }\n return (yield* writeGraph(persistence, scope.workspaceId, {\n entityProjections: [],\n nodes: [],\n evidenceItems: [],\n evidenceClaims: [],\n relationships: [relationship]\n })).relationshipCount\n }\n)\n\nconst emptyReceipt = (skippedDueToBounds: boolean): RelationshipInferenceMaterializationReceipt => ({\n evidenceClaimCount: 0,\n evidenceItemCount: 0,\n nodeCount: 0,\n relationshipCount: 0,\n skippedDueToBounds\n})\n\nconst retireInferenceForReleases = Effect.fn(\n \"RelationshipInferenceMaterialization.retireInferenceForReleases\"\n)(function*(\n persistence: PersistenceService,\n scope: RelationshipInferenceMaterializationScope,\n releaseIds: ReadonlyArray<RelationshipInferenceRelease[\"releaseId\"]> | null,\n reason: string\n) {\n const reads = yield* Effect.forEach(\n releaseIds ?? [null],\n (releaseId) =>\n persistence.deliveryGraph.read(scope.workspaceId, {\n _tag: \"componentRelationships\",\n releaseId,\n component: COMPONENT,\n limit: MAXIMUM_INFERENCE_RELATIONSHIPS\n })\n )\n if (\n reads.some((read) => read._tag !== \"componentRelationships\" || read.value.truncated)\n ) return emptyReceipt(true)\n const relationshipIds = new Set(\n reads.flatMap((read) =>\n read._tag === \"componentRelationships\"\n ? read.value.relationships.map(({ relationshipId }) => relationshipId)\n : []\n )\n )\n let relationshipCount = 0\n for (const relationshipId of relationshipIds) {\n relationshipCount += yield* supersedeObsoleteRelationship(\n persistence,\n scope,\n relationshipId,\n reason\n )\n }\n return { ...emptyReceipt(true), relationshipCount }\n})\n\nconst retireInferenceAtEntityBound = Effect.fn(\n \"RelationshipInferenceMaterialization.retireInferenceAtEntityBound\"\n)(function*(\n persistence: PersistenceService,\n scope: RelationshipInferenceMaterializationScope\n) {\n return yield* retireInferenceForReleases(\n persistence,\n scope,\n null,\n \"Inference inputs exceeded the bounded workspace snapshot, so this relationship can no longer be proven.\"\n )\n})\n\n/** Persist current rule candidates after a normalized page has committed. */\nexport const materializeRelationshipInference = Effect.fn(\"RelationshipInferenceMaterialization.reconcile\")(function*<\n IdentityError\n>(\n persistence: PersistenceService,\n identity: StableIdentity<IdentityError>,\n scope: RelationshipInferenceMaterializationScope\n): Effect.fn.Return<RelationshipInferenceMaterializationReceipt, IdentityError | PersistenceOperationFailure> {\n const projectionResult = yield* persistence.deliveryGraph.read(scope.workspaceId, {\n _tag: \"workspaceEntityProjections\",\n owner: null,\n query: null,\n service: null,\n status: null,\n type: null,\n limit: MAXIMUM_INFERENCE_ENTITIES\n })\n if (projectionResult._tag !== \"workspaceEntityProjections\") return emptyReceipt(true)\n if (projectionResult.value.truncated) return yield* retireInferenceAtEntityBound(persistence, scope)\n const records = yield* Effect.forEach(\n projectionResult.value.items,\n ({ projection }) => persistence.entities.get(scope.workspaceId, projection.entityId),\n { concurrency: 10 }\n )\n const entityById = new Map(records.map((record) => [record.entityId, record]))\n const entities: Array<RelationshipInferenceEntity> = []\n for (const item of projectionResult.value.items) {\n const entity = entityById.get(item.projection.entityId)\n if (entity === undefined) continue\n entities.push({\n projection: item.projection,\n releaseIds: item.releaseIds,\n nodeId: GraphNodeId.make(yield* identity(entityNodeIdentity(scope.workspaceId, entity)))\n })\n }\n const releases = yield* persistence.releases.list(scope.workspaceId, MAXIMUM_INFERENCE_RELEASES + 1)\n if (releases.length > MAXIMUM_INFERENCE_RELEASES) {\n return yield* retireInferenceAtEntityBound(persistence, scope)\n }\n const inferenceReleases: Array<{\n readonly inferenceRelease: RelationshipInferenceRelease\n readonly node: DeliveryNode | null\n }> = []\n for (const { release } of releases) {\n const candidates = yield* Effect.forEach(release.sourceRevisions, (source) =>\n Effect.gen(function*() {\n const nodeId = GraphNodeId.make(\n yield* identity(\n releaseNodeIdentity(\n scope.workspaceId,\n source.pluginConnectionId,\n source.providerId,\n source.vendorImmutableId\n )\n )\n )\n return { exists: yield* nodeExists(persistence, scope.workspaceId, nodeId), nodeId }\n }))\n const selected = candidates.find(({ exists }) => exists) ?? candidates[0]\n if (selected === undefined) continue\n inferenceReleases.push({\n inferenceRelease: { nodeId: selected.nodeId, releaseId: release.id, version: release.version },\n node: selected.exists\n ? null\n : {\n workspaceId: scope.workspaceId,\n nodeId: selected.nodeId,\n endpointKind: \"release\",\n resolution: { _tag: \"resolved\", target: { _tag: \"release\", releaseId: release.id } },\n createdAt: scope.committedAt\n }\n })\n }\n const releaseIds = releases.map(({ release }) => release.id)\n const slices = yield* Effect.forEach(releaseIds, (releaseId) =>\n persistence.deliveryGraph.read(scope.workspaceId, {\n _tag: \"releaseSlice\",\n releaseId,\n environmentId: null,\n limit: MAXIMUM_INFERENCE_ENTITIES\n }))\n const truncatedReleaseIds = slices.flatMap((slice, index) => {\n const releaseId = releaseIds[index]\n return releaseId !== undefined && (slice._tag !== \"releaseSlice\" || slice.value.truncated) ? [releaseId] : []\n })\n if (truncatedReleaseIds.length > 0) {\n return yield* retireInferenceForReleases(\n persistence,\n scope,\n truncatedReleaseIds,\n \"The bounded release relationship snapshot was incomplete, so this inference can no longer be proven.\"\n )\n }\n const relationships = slices.flatMap((slice) => (slice._tag === \"releaseSlice\" ? slice.value.relationships : []))\n const inferenceInput = {\n entities,\n releases: inferenceReleases.map(({ inferenceRelease }) => inferenceRelease),\n relationships\n }\n const initialInference = deriveRelationshipInference(inferenceInput)\n const rejectedCandidateIdentityKeys = new Set<string>()\n for (const candidate of initialInference.candidates) {\n if (candidate.lifecycle !== \"inferred\") continue\n const relationshipId = yield* relationshipIdFor(identity, scope.workspaceId, candidate.identityKey)\n const previous = yield* readRelationship(persistence, scope.workspaceId, relationshipId)\n if (previous?.lifecycle._tag === \"rejected\") rejectedCandidateIdentityKeys.add(candidate.identityKey)\n }\n const inference = rejectedCandidateIdentityKeys.size === 0\n ? initialInference\n : deriveRelationshipInference({ ...inferenceInput, rejectedCandidateIdentityKeys })\n if (inference.truncated) return yield* retireInferenceAtEntityBound(persistence, scope)\n let receipt = emptyReceipt(false)\n const missingReleaseNodes = inferenceReleases.flatMap(({ node }) => node === null ? [] : [node])\n if (missingReleaseNodes.length > 0) {\n const current = yield* writeGraph(persistence, scope.workspaceId, {\n entityProjections: [],\n nodes: missingReleaseNodes,\n evidenceItems: [],\n evidenceClaims: [],\n relationships: []\n })\n receipt = { ...receipt, nodeCount: current.nodeCount }\n }\n for (const candidate of inference.candidates) {\n const current = yield* materializeCandidate(persistence, identity, scope, candidate, entityById)\n receipt = {\n evidenceClaimCount: receipt.evidenceClaimCount + current.evidenceClaimCount,\n evidenceItemCount: receipt.evidenceItemCount + current.evidenceItemCount,\n nodeCount: receipt.nodeCount + current.nodeCount,\n relationshipCount: receipt.relationshipCount + current.relationshipCount,\n skippedDueToBounds: false\n }\n }\n for (const identityKey of inference.obsoleteGapIdentityKeys) {\n receipt = {\n ...receipt,\n relationshipCount: receipt.relationshipCount +\n (yield* supersedeObsoleteGap(persistence, identity, scope, identityKey))\n }\n }\n for (const relationshipId of inference.obsoleteRelationshipIds) {\n receipt = {\n ...receipt,\n relationshipCount: receipt.relationshipCount +\n (yield* supersedeObsoleteRelationship(persistence, scope, relationshipId))\n }\n }\n return receipt\n})\n","import * as Crypto from \"effect/Crypto\"\nimport * as DateTime from \"effect/DateTime\"\nimport * as Effect from \"effect/Effect\"\nimport * as Encoding from \"effect/Encoding\"\nimport * as Result from \"effect/Result\"\nimport * as Schema from \"effect/Schema\"\n\nimport { derivePersonInitials, Person } from \"../../domain/actors.js\"\nimport {\n type DeliveryEntityDetails,\n type DeliveryEntityKind,\n type DeliveryNode,\n type DeliveryRelationship,\n EvidencePredicate,\n EvidenceValue,\n LedgerRevision,\n RelationshipKind\n} from \"../../domain/deliveryGraph.js\"\nimport type { PluginHealth } from \"../../domain/freshness.js\"\nimport {\n EntityId,\n EnvironmentId,\n EvidenceClaimId,\n EvidenceId,\n GraphNodeId,\n PersonId,\n type PluginConnectionId,\n RelationshipId,\n ReleaseId,\n type WorkspaceId\n} from \"../../domain/identifiers.js\"\nimport { NormalizedIssueAttributes } from \"../../domain/normalizedIssue.js\"\nimport type { NormalizedPluginEventV1, PluginSyncPageV1 } from \"../../domain/plugins/events.js\"\nimport { Release } from \"../../domain/release.js\"\nimport { deriveReleaseRelay } from \"../../domain/releaseRelay.js\"\nimport { NormalizationSchemaVersion, type ProviderId, VendorImmutableId } from \"../../domain/sourceRevision.js\"\nimport { UtcTimestamp } from \"../../domain/utcTimestamp.js\"\nimport type { PersistenceOperationFailure, PersistenceService } from \"../persistence/Persistence.js\"\nimport { Persistence } from \"../persistence/Persistence.js\"\nimport { DeliveryGraphWriteBatch } from \"../persistence/repositories/deliveryGraphRepository.js\"\nimport type { EntityRecord } from \"../persistence/repositories/models.js\"\nimport type { PluginStreamKey } from \"../persistence/repositories/pluginRuntimeModels.js\"\nimport type { PluginConflictFailure } from \"../plugins/failures.js\"\nimport {\n type PluginSynchronizationAuthority,\n verifyPluginSynchronizationAuthority\n} from \"./pluginSynchronizationAuthority.js\"\nimport { materializeRelationshipInference } from \"./relationshipInferenceMaterialization.js\"\n\ntype EntityUpsert = Extract<NormalizedPluginEventV1, { readonly _tag: \"UpsertEntity\" }>\ntype EntityTombstone = Extract<NormalizedPluginEventV1, { readonly _tag: \"TombstoneEntity\" }>\ntype EvidenceAppend = Extract<NormalizedPluginEventV1, { readonly _tag: \"AppendEvidence\" }>\ntype PersonUpsert = Extract<NormalizedPluginEventV1, { readonly _tag: \"UpsertPerson\" }>\ntype RelationshipProposal = Extract<NormalizedPluginEventV1, { readonly _tag: \"ProposeRelationship\" }>\n\ninterface RelationshipEndpointResolution {\n readonly entity: EntityRecord | null\n readonly kind: DeliveryRelationship[\"sourceNodeKind\"]\n readonly node: DeliveryNode | null\n readonly nodeId: GraphNodeId\n readonly releaseId: ReleaseId | null\n}\n\nconst OptionalText = Schema.optionalKey(Schema.NullOr(Schema.String))\nconst OptionalUnknown = Schema.optionalKey(Schema.NullOr(Schema.Unknown))\nconst NamedText = Schema.Union([\n Schema.String,\n Schema.Struct({ name: Schema.optionalKey(Schema.NullOr(Schema.String)) })\n])\nconst EntityAttributes = Schema.Struct({\n key: OptionalText,\n status: Schema.optionalKey(Schema.NullOr(NamedText)),\n priority: Schema.optionalKey(Schema.NullOr(NamedText)),\n estimatePoints: Schema.optionalKey(Schema.NullOr(Schema.Number)),\n repository: OptionalText,\n sourceBranch: OptionalText,\n targetBranch: OptionalText,\n headRevision: OptionalText,\n baseRevision: OptionalText,\n mergeBase: OptionalText,\n description: OptionalText,\n authorArn: OptionalText,\n creationDate: OptionalUnknown,\n lastActivityDate: OptionalUnknown,\n reviewState: OptionalText,\n spaceKey: OptionalText,\n spaceId: OptionalText,\n currentVersion: Schema.optionalKey(Schema.NullOr(Schema.Number)),\n linkedIssueKeys: Schema.optionalKey(Schema.Array(Schema.String)),\n linkedReleaseVersions: Schema.optionalKey(Schema.Array(Schema.String)),\n pipelineName: OptionalText,\n executionId: OptionalText,\n triggerRevision: OptionalText,\n sourceRevisions: Schema.optionalKey(Schema.Array(Schema.Struct({ revisionId: OptionalText }))),\n environmentId: OptionalText,\n revision: OptionalText,\n durationMinutes: Schema.optionalKey(Schema.NullOr(Schema.Number)),\n billable: Schema.optionalKey(Schema.Boolean),\n approvalState: OptionalText,\n interval: Schema.optionalKey(Schema.Struct({\n duration: OptionalText,\n state: OptionalText\n }))\n})\nconst LegacyIssueAttributes = Schema.Struct({\n key: OptionalText,\n status: Schema.optionalKey(Schema.NullOr(NamedText)),\n priority: Schema.optionalKey(Schema.NullOr(NamedText)),\n estimatePoints: Schema.optionalKey(Schema.NullOr(Schema.Number))\n})\nconst LegacyIssueAttributeKeys: ReadonlySet<string> = new Set([\n \"key\",\n \"status\",\n \"priority\",\n \"estimatePoints\",\n \"schemaVersion\",\n \"summary\"\n])\nconst ReleaseAttributes = Schema.Struct({\n serviceName: Schema.String.check(Schema.isTrimmed(), Schema.isNonEmpty(), Schema.isMaxLength(200)),\n version: Schema.String.check(Schema.isTrimmed(), Schema.isNonEmpty(), Schema.isMaxLength(100)),\n lifecycle: Schema.Literals([\"assembling\", \"candidate\", \"deploying\", \"released\", \"cancelled\"])\n})\nconst JiraIssueRelationshipSnapshot = Schema.Struct({\n fixVersions: Schema.Array(Schema.Struct({\n sourceId: Schema.NullOr(Schema.String)\n })),\n truncatedFields: Schema.Array(Schema.String)\n})\nconst EvidenceData = Schema.Struct({\n predicate: Schema.optionalKey(EvidencePredicate),\n value: Schema.optionalKey(EvidenceValue)\n})\n\n/** Redacted failure raised before a normalized page can become a canonical projection. */\nexport class NormalizedPluginPageMaterializationError extends Schema.TaggedErrorClass<\n NormalizedPluginPageMaterializationError\n>()(\"NormalizedPluginPageMaterializationError\", {\n diagnosticCode: Schema.String.check(Schema.isTrimmed(), Schema.isNonEmpty(), Schema.isMaxLength(100)),\n eventId: Schema.NullOr(Schema.String.check(Schema.isTrimmed(), Schema.isNonEmpty(), Schema.isMaxLength(512)))\n}) {}\n\nconst malformed = (diagnosticCode: string, eventId: string | null = null) =>\n new NormalizedPluginPageMaterializationError({ diagnosticCode, eventId })\n\nconst decodedAttributes = Effect.fn(\"NormalizedPluginPageMaterialization.decodeAttributes\")(function*(\n event: EntityUpsert\n) {\n return yield* Schema.decodeUnknownEffect(EntityAttributes)(event.attributes).pipe(\n Effect.mapError(() => malformed(\"normalized-entity-attributes-invalid\", event.eventId))\n )\n})\n\nconst bounded = (value: string | null | undefined, fallback: string, maximum: number): string => {\n const normalized = value?.trim()\n return (normalized === undefined || normalized.length === 0 ? fallback : normalized).slice(0, maximum)\n}\n\nconst optionalBounded = (value: string | null | undefined, maximum: number): string | null => {\n const normalized = value?.trim()\n return normalized === undefined || normalized.length === 0 ? null : normalized.slice(0, maximum)\n}\n\nconst namedText = (value: typeof NamedText.Type | null | undefined): string | null =>\n typeof value === \"string\" ? value : (value?.name ?? null)\n\nconst decodedPullRequestTimestamp = Effect.fn(\n \"NormalizedPluginPageMaterialization.decodePullRequestTimestamp\"\n)(function*(\n value: unknown,\n eventId: string\n): Effect.fn.Return<UtcTimestamp | null, NormalizedPluginPageMaterializationError> {\n if (value === null || value === undefined) return null\n return yield* Schema.decodeUnknownEffect(UtcTimestamp)(value).pipe(\n Effect.mapError(() => malformed(\"normalized-pull-request-timestamp-invalid\", eventId))\n )\n})\n\nconst decodedIssueAttributes = Effect.fn(\"NormalizedPluginPageMaterialization.decodeIssueAttributes\")(function*(\n event: EntityUpsert\n) {\n const normalized = Schema.decodeUnknownResult(NormalizedIssueAttributes)(event.attributes)\n if (Result.isSuccess(normalized)) return normalized.success\n if (Object.keys(event.attributes).some((key) => !LegacyIssueAttributeKeys.has(key))) {\n return yield* malformed(\"normalized-issue-attributes-invalid\", event.eventId)\n }\n\n const legacy = yield* Schema.decodeUnknownEffect(LegacyIssueAttributes)(event.attributes).pipe(\n Effect.mapError(() => malformed(\"normalized-issue-attributes-invalid\", event.eventId))\n )\n const key = bounded(legacy.key, event.vendorImmutableId, 100)\n return yield* Schema.decodeUnknownEffect(NormalizedIssueAttributes)({\n key,\n status: bounded(namedText(legacy.status), \"unknown\", 100),\n priority: legacy.priority === null || legacy.priority === undefined\n ? null\n : bounded(namedText(legacy.priority), \"unknown\", 100),\n estimatePoints: legacy.estimatePoints ?? null\n }).pipe(Effect.mapError(() => malformed(\"normalized-issue-attributes-invalid\", event.eventId)))\n})\n\nconst canonicalKind = (entityType: string): typeof DeliveryEntityKind.Type | null => {\n switch (entityType) {\n case \"issue\":\n case \"jira.issue\":\n return \"issue\"\n case \"pull-request\":\n return \"pull-request\"\n case \"page\":\n case \"confluence-page\":\n return \"page\"\n case \"pipeline-execution\":\n case \"aws.codepipeline.execution\":\n return \"pipeline-execution\"\n case \"deployment\":\n return \"deployment\"\n case \"time-entry\":\n case \"clockify.time-entry\":\n return \"time-entry\"\n default:\n return null\n }\n}\n\nconst reviewState = (\n value: string | null | undefined\n): \"approved\" | \"changes-requested\" | \"merged\" | \"not-requested\" | \"requested\" => {\n switch (value?.toLowerCase()) {\n case \"requested\":\n return \"requested\"\n case \"changes-requested\":\n case \"changes requested\":\n return \"changes-requested\"\n case \"approved\":\n return \"approved\"\n case \"merged\":\n return \"merged\"\n default:\n return \"not-requested\"\n }\n}\n\nconst pullRequestLifecycle = (value: string | null | undefined): \"closed\" | \"merged\" | \"open\" | null => {\n switch (value?.toLowerCase()) {\n case \"open\":\n return \"open\"\n case \"closed\":\n return \"closed\"\n case \"merged\":\n return \"merged\"\n default:\n return null\n }\n}\n\nconst pipelineStatus = (\n value: string | null | undefined\n): \"failed\" | \"queued\" | \"running\" | \"stopped\" | \"succeeded\" => {\n switch (value?.toLowerCase()) {\n case \"inprogress\":\n case \"in-progress\":\n case \"running\":\n return \"running\"\n case \"succeeded\":\n case \"success\":\n return \"succeeded\"\n case \"failed\":\n case \"failure\":\n return \"failed\"\n case \"stopped\":\n case \"stopping\":\n case \"superseded\":\n case \"abandoned\":\n return \"stopped\"\n default:\n return \"queued\"\n }\n}\n\nconst isoDurationMinutes = (value: string | null | undefined): number => {\n if (value === null || value === undefined) return 0\n const match = /^PT(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?$/u.exec(value)\n if (match === null) return 0\n const hours = Number(match[1] ?? 0)\n const minutes = Number(match[2] ?? 0)\n const seconds = Number(match[3] ?? 0)\n return Math.max(0, Math.round(hours * 60 + minutes + seconds / 60))\n}\n\nconst entityPresentation = Effect.fn(\"NormalizedPluginPageMaterialization.entityPresentation\")(function*(\n event: EntityUpsert,\n kind: typeof DeliveryEntityKind.Type\n): Effect.fn.Return<\n { readonly details: DeliveryEntityDetails; readonly displayKey: string },\n NormalizedPluginPageMaterializationError\n> {\n const attributes = yield* decodedAttributes(event)\n switch (kind) {\n case \"issue\": {\n const issueAttributes = yield* decodedIssueAttributes(event)\n return {\n displayKey: issueAttributes.key,\n details: {\n _tag: \"issue\",\n ...issueAttributes\n }\n }\n }\n case \"pull-request\": {\n const creationDate = yield* decodedPullRequestTimestamp(attributes.creationDate, event.eventId)\n const lastActivityDate = yield* decodedPullRequestTimestamp(attributes.lastActivityDate, event.eventId)\n const status = namedText(attributes.status)\n return {\n displayKey: bounded(event.vendorImmutableId, event.vendorImmutableId, 200),\n details: {\n _tag: \"pull-request\",\n repository: bounded(attributes.repository, \"unknown\", 200),\n sourceBranch: bounded(attributes.sourceBranch, \"unknown\", 500),\n targetBranch: bounded(attributes.targetBranch, \"unknown\", 500),\n headRevision: bounded(attributes.headRevision, event.revision, 512),\n reviewState: reviewState(attributes.reviewState ?? (pullRequestLifecycle(status) === null ? status : null)),\n lifecycle: pullRequestLifecycle(status),\n description: optionalBounded(attributes.description, 50_000),\n authorReference: optionalBounded(attributes.authorArn, 512),\n baseRevision: optionalBounded(attributes.baseRevision, 512),\n mergeBaseRevision: optionalBounded(attributes.mergeBase, 512),\n createdAt: creationDate === null ? null : DateTime.formatIso(creationDate),\n updatedAt: lastActivityDate === null ? null : DateTime.formatIso(lastActivityDate)\n }\n }\n }\n case \"page\":\n return {\n displayKey: bounded(event.vendorImmutableId, event.vendorImmutableId, 200),\n details: {\n _tag: \"page\",\n spaceKey: bounded(attributes.spaceKey ?? attributes.spaceId, \"unknown\", 100),\n revision: bounded(\n attributes.currentVersion === null || attributes.currentVersion === undefined\n ? attributes.revision\n : String(attributes.currentVersion),\n event.revision,\n 512\n ),\n status: namedText(attributes.status)?.toLowerCase() === \"superseded\" ? \"superseded\" : \"current\",\n linkedIssueKeys: attributes.linkedIssueKeys\n ?.map((key) => key.trim())\n .filter((key, index, keys) => key.length > 0 && key.length <= 100 && keys.indexOf(key) === index)\n .slice(0, 100),\n linkedReleaseVersions: attributes.linkedReleaseVersions\n ?.map((version) => version.trim())\n .filter(\n (version, index, versions) =>\n version.length > 0 && version.length <= 100 && versions.indexOf(version) === index\n )\n .slice(0, 100)\n }\n }\n case \"pipeline-execution\": {\n const executionId = bounded(attributes.executionId, event.vendorImmutableId, 512)\n const pipelineName = bounded(attributes.pipelineName, \"unknown\", 200)\n const sourceRevision = attributes.sourceRevisions?.find(({ revisionId }) => revisionId !== null)?.revisionId\n return {\n displayKey: bounded(`${pipelineName}/${executionId}`, executionId, 200),\n details: {\n _tag: \"pipeline-execution\",\n pipelineName,\n executionId,\n status: pipelineStatus(namedText(attributes.status)),\n triggerRevision: bounded(attributes.triggerRevision ?? sourceRevision, event.revision, 512)\n }\n }\n }\n case \"deployment\": {\n const environmentId = yield* Schema.decodeUnknownEffect(EnvironmentId)(attributes.environmentId).pipe(\n Effect.mapError(() => malformed(\"normalized-deployment-environment-invalid\", event.eventId))\n )\n const status = pipelineStatus(namedText(attributes.status))\n return {\n displayKey: bounded(event.vendorImmutableId, event.vendorImmutableId, 200),\n details: {\n _tag: \"deployment\",\n environmentId,\n revision: bounded(attributes.revision, event.revision, 512),\n status: status === \"queued\" ? \"pending\" : status === \"running\" ?\n \"deploying\" :\n status === \"stopped\"\n ? \"rolled-back\"\n : status\n }\n }\n }\n case \"time-entry\":\n return {\n displayKey: bounded(event.vendorImmutableId, event.vendorImmutableId, 200),\n details: {\n _tag: \"time-entry\",\n durationMinutes: Math.max(\n 0,\n Math.round(attributes.durationMinutes ?? isoDurationMinutes(attributes.interval?.duration))\n ),\n billable: attributes.billable ?? false,\n approvalState: attributes.approvalState === \"approved\" || attributes.approvalState === \"rejected\"\n ? attributes.approvalState\n : attributes.interval?.state === \"running\"\n ? \"pending\"\n : \"not-required\"\n }\n }\n }\n})\n\nconst stableUuid = Effect.fn(\"NormalizedPluginPageMaterialization.stableUuid\")(function*(\n cryptoService: Crypto.Crypto,\n identity: string,\n eventId: string\n) {\n const bytes = yield* Effect.fromResult(Encoding.decodeBase64(Encoding.encodeBase64(identity))).pipe(\n Effect.mapError(() => malformed(\"normalized-identity-encoding-failed\", eventId))\n )\n const digest = yield* cryptoService.digest(\"SHA-256\", bytes).pipe(\n Effect.mapError(() => malformed(\"normalized-identity-digest-failed\", eventId))\n )\n const hex = Encoding.encodeHex(digest)\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-7${hex.slice(13, 16)}-8${hex.slice(17, 20)}-${hex.slice(20, 32)}`\n})\n\nconst sourceIdentity = (\n scope: NormalizedPluginPageMaterializationScope,\n vendorImmutableId: typeof VendorImmutableId.Type\n) => ({\n pluginConnectionId: scope.pluginConnectionId,\n providerId: scope.providerId,\n vendorImmutableId\n})\n\nconst findEntity = Effect.fn(\"NormalizedPluginPageMaterialization.findEntity\")(function*(\n persistence: PersistenceService,\n scope: NormalizedPluginPageMaterializationScope,\n vendorImmutableId: typeof VendorImmutableId.Type\n) {\n const found = yield* persistence.entities.findBySourceIdentity(\n scope.workspaceId,\n sourceIdentity(scope, vendorImmutableId)\n ).pipe(Effect.result)\n if (Result.isSuccess(found)) return found.success\n if (found.failure._tag === \"RecordNotFoundError\") return null\n return yield* found.failure\n})\n\nconst readProjection = Effect.fn(\"NormalizedPluginPageMaterialization.readProjection\")(function*(\n persistence: PersistenceService,\n workspaceId: WorkspaceId,\n entityId: EntityId\n) {\n const found = yield* persistence.deliveryGraph.read(workspaceId, {\n _tag: \"entityProjection\",\n entityId,\n revision: null\n }).pipe(Effect.result)\n if (Result.isSuccess(found)) {\n return found.success._tag === \"entityProjection\" ? found.success.value : null\n }\n if (found.failure._tag === \"RecordNotFoundError\") return null\n return yield* found.failure\n})\n\nconst materializationKey = (\n scope: NormalizedPluginPageMaterializationScope,\n kind: string,\n externalId: string\n) => `${scope.workspaceId}\\u0000${scope.pluginConnectionId}\\u0000${scope.providerId}\\u0000${kind}\\u0000${externalId}`\n\nconst entityIdFor = Effect.fn(\"NormalizedPluginPageMaterialization.entityIdFor\")(function*(\n cryptoService: Crypto.Crypto,\n scope: NormalizedPluginPageMaterializationScope,\n vendorImmutableId: string,\n eventId: string\n) {\n return EntityId.make(\n yield* stableUuid(\n cryptoService,\n materializationKey(scope, \"entity\", vendorImmutableId),\n eventId\n )\n )\n})\n\nconst nodeIdFor = Effect.fn(\"NormalizedPluginPageMaterialization.nodeIdFor\")(function*(\n cryptoService: Crypto.Crypto,\n scope: NormalizedPluginPageMaterializationScope,\n vendorImmutableId: string,\n eventId: string\n) {\n return GraphNodeId.make(\n yield* stableUuid(cryptoService, materializationKey(scope, \"entity-node\", vendorImmutableId), eventId)\n )\n})\n\nconst releaseIdFor = Effect.fn(\"NormalizedPluginPageMaterialization.releaseIdFor\")(function*(\n cryptoService: Crypto.Crypto,\n scope: NormalizedPluginPageMaterializationScope,\n vendorImmutableId: string,\n eventId: string\n) {\n return ReleaseId.make(\n yield* stableUuid(\n cryptoService,\n materializationKey(scope, \"release\", vendorImmutableId),\n eventId\n )\n )\n})\n\nconst releaseNodeIdFor = Effect.fn(\"NormalizedPluginPageMaterialization.releaseNodeIdFor\")(function*(\n cryptoService: Crypto.Crypto,\n scope: NormalizedPluginPageMaterializationScope,\n vendorImmutableId: string,\n eventId: string\n) {\n return GraphNodeId.make(\n yield* stableUuid(\n cryptoService,\n materializationKey(scope, \"release-node\", vendorImmutableId),\n eventId\n )\n )\n})\n\nconst sourceRevision = (\n scope: NormalizedPluginPageMaterializationScope,\n event: EntityUpsert | EntityTombstone,\n firstObservedAt: UtcTimestamp,\n sourceUrl: EntityUpsert[\"sourceUrl\"]\n) => ({\n ...sourceIdentity(scope, event.vendorImmutableId),\n revision: event.revision,\n sourceUrl,\n firstObservedAt,\n lastObservedAt: event.observedAt,\n synchronizedAt: scope.committedAt,\n normalizationSchemaVersion: NormalizationSchemaVersion.make(1)\n})\n\nconst laterTimestamp = (left: UtcTimestamp, right: UtcTimestamp): UtcTimestamp =>\n DateTime.Order(left, right) >= 0 ? left : right\n\nconst sameSourceUrl = (\n left: EntityUpsert[\"sourceUrl\"],\n right: EntityUpsert[\"sourceUrl\"]\n): boolean => left?.href === right?.href\n\nconst projectionSchemaVersion = (kind: DeliveryEntityKind): number => kind === \"pull-request\" ? 2 : 1\n\nconst writeGraph = Effect.fn(\"NormalizedPluginPageMaterialization.writeGraph\")(function*(\n persistence: PersistenceService,\n workspaceId: WorkspaceId,\n batch: typeof DeliveryGraphWriteBatch.Type,\n eventId: string\n) {\n const encoded = yield* Schema.encodeEffect(DeliveryGraphWriteBatch)(batch).pipe(\n Effect.mapError(() => malformed(\"normalized-delivery-graph-batch-invalid\", eventId))\n )\n return yield* persistence.deliveryGraph.write(workspaceId, encoded)\n})\n\nconst materializeUpsertEntity = Effect.fn(\n \"NormalizedPluginPageMaterialization.upsertEntity\"\n)(function*(\n persistence: PersistenceService,\n cryptoService: Crypto.Crypto,\n scope: NormalizedPluginPageMaterializationScope,\n event: EntityUpsert\n) {\n const kind = canonicalKind(event.entityType)\n if (kind === null) return { entityProjectionCount: 0, nodeCount: 0, skippedEntityCount: 1 }\n const presentation = yield* entityPresentation(event, kind)\n const existing = yield* findEntity(persistence, scope, event.vendorImmutableId)\n const entityId = existing?.entityId ??\n (yield* entityIdFor(cryptoService, scope, event.vendorImmutableId, event.eventId))\n const currentProjection = existing === null\n ? null\n : yield* readProjection(persistence, scope.workspaceId, entityId)\n const schemaVersion = projectionSchemaVersion(kind)\n const refreshedSource = existing === null\n ? null\n : {\n ...sourceRevision(\n scope,\n event,\n existing.sourceRevision.firstObservedAt,\n event.sourceUrl\n ),\n lastObservedAt: laterTimestamp(existing.sourceRevision.lastObservedAt, event.observedAt),\n synchronizedAt: laterTimestamp(existing.sourceRevision.synchronizedAt, scope.committedAt)\n }\n const sourceMetadataChanged = existing !== null && refreshedSource !== null && (\n !sameSourceUrl(existing.sourceRevision.sourceUrl, refreshedSource.sourceUrl) ||\n !DateTime.Equivalence(existing.sourceRevision.lastObservedAt, refreshedSource.lastObservedAt) ||\n !DateTime.Equivalence(existing.sourceRevision.synchronizedAt, refreshedSource.synchronizedAt)\n )\n if (\n existing !== null &&\n existing.sourceRevision.revision === event.revision &&\n currentProjection?.projection.entityState === \"present\" &&\n currentProjection.projection.projectionSchemaVersion === schemaVersion &&\n !sourceMetadataChanged\n ) {\n return { entityProjectionCount: 0, nodeCount: 0, skippedEntityCount: 0 }\n }\n\n const persisted = existing === null\n ? yield* persistence.entities.create(scope.workspaceId, {\n entityId,\n entityType: kind,\n sourceRevision: sourceRevision(scope, event, event.observedAt, event.sourceUrl),\n createdAt: scope.committedAt\n })\n : yield* persistence.entities.updateSourceRevision(scope.workspaceId, entityId, {\n sourceRevision: refreshedSource ?? sourceRevision(\n scope,\n event,\n existing.sourceRevision.firstObservedAt,\n event.sourceUrl\n ),\n expectedRevision: existing.revision,\n updatedAt: scope.committedAt\n })\n const projectionRevision = LedgerRevision.make((currentProjection?.projection.projectionRevision ?? 0) + 1)\n const nodeId = yield* nodeIdFor(cryptoService, scope, event.vendorImmutableId, event.eventId)\n const batch = {\n entityProjections: [{\n projection: {\n workspaceId: scope.workspaceId,\n entityId,\n projectionRevision,\n sourceEntityRevision: LedgerRevision.make(persisted.revision),\n supersedesProjectionRevision: currentProjection?.projection.projectionRevision ?? null,\n projectionSchemaVersion: schemaVersion,\n entityState: \"present\",\n entityType: kind,\n displayKey: presentation.displayKey,\n title: event.title,\n details: presentation.details\n },\n recordedAt: scope.committedAt\n }],\n nodes: currentProjection === null\n ? [{\n workspaceId: scope.workspaceId,\n nodeId,\n endpointKind: kind,\n resolution: { _tag: \"resolved\", target: { _tag: \"entity\", entityId, entityKind: kind } },\n createdAt: scope.committedAt\n }]\n : [],\n evidenceItems: [],\n evidenceClaims: [],\n relationships: []\n } satisfies typeof DeliveryGraphWriteBatch.Type\n const receipt = yield* writeGraph(persistence, scope.workspaceId, batch, event.eventId)\n return { ...receipt, skippedEntityCount: 0 }\n})\n\nconst materializeRelease = Effect.fn(\"NormalizedPluginPageMaterialization.upsertRelease\")(function*(\n persistence: PersistenceService,\n cryptoService: Crypto.Crypto,\n scope: NormalizedPluginPageMaterializationScope,\n event: EntityUpsert\n) {\n const attributes = yield* Schema.decodeUnknownEffect(ReleaseAttributes)(event.attributes).pipe(\n Effect.mapError(() => malformed(\"normalized-release-attributes-invalid\", event.eventId))\n )\n const releaseId = yield* releaseIdFor(cryptoService, scope, event.vendorImmutableId, event.eventId)\n const existing = yield* persistence.releases.get(scope.workspaceId, releaseId).pipe(Effect.result)\n if (Result.isFailure(existing) && existing.failure._tag !== \"RecordNotFoundError\") {\n return yield* existing.failure\n }\n const previous = Result.isSuccess(existing) ? existing.success : null\n const previousSource = previous?.release.sourceRevisions.find(\n ({ pluginConnectionId, providerId, vendorImmutableId }) =>\n pluginConnectionId === scope.pluginConnectionId &&\n providerId === scope.providerId &&\n vendorImmutableId === event.vendorImmutableId\n )\n const observedAt = previousSource === undefined\n ? event.observedAt\n : laterTimestamp(previousSource.lastObservedAt, event.observedAt)\n const source = sourceRevision(\n scope,\n event,\n previousSource?.firstObservedAt ?? event.observedAt,\n event.sourceUrl\n )\n const refreshedSource = { ...source, lastObservedAt: observedAt }\n const sourceAgeSeconds = Math.max(\n 0,\n (DateTime.toEpochMillis(scope.committedAt) - DateTime.toEpochMillis(observedAt)) / 1_000\n )\n const release = yield* Schema.decodeUnknownEffect(Schema.toType(Release))({\n createdAt: previous?.release.createdAt ?? event.observedAt,\n freshness: {\n _tag: \"current\",\n evaluatedAt: scope.committedAt,\n pluginHealth: scope.successfulHealth,\n provenance: { _tag: \"provider\", sourceRevision: refreshedSource },\n sourceObservedAt: observedAt,\n staleAfterSeconds: Math.max(1, Math.ceil(sourceAgeSeconds) + 86_400),\n synchronizedAt: scope.committedAt\n },\n id: releaseId,\n lifecycle: attributes.lifecycle,\n relay: deriveReleaseRelay(releaseId),\n roleAssignments: previous?.release.roleAssignments ?? [],\n serviceName: attributes.serviceName,\n sourceRevisions: [\n ...(previous?.release.sourceRevisions.filter(\n ({ pluginConnectionId, providerId, vendorImmutableId }) =>\n pluginConnectionId !== scope.pluginConnectionId ||\n providerId !== scope.providerId ||\n vendorImmutableId !== event.vendorImmutableId\n ) ?? []),\n refreshedSource\n ],\n targetEnvironmentIds: previous?.release.targetEnvironmentIds ?? [],\n updatedAt: scope.committedAt,\n version: attributes.version,\n workspaceId: scope.workspaceId\n }).pipe(Effect.mapError(() => malformed(\"normalized-release-invalid\", event.eventId)))\n if (previous === null) {\n yield* persistence.releases.create(scope.workspaceId, release)\n } else if (\n previousSource === undefined ||\n previousSource.revision !== refreshedSource.revision ||\n !sameSourceUrl(previousSource.sourceUrl, refreshedSource.sourceUrl) ||\n !DateTime.Equivalence(previousSource.lastObservedAt, refreshedSource.lastObservedAt) ||\n !DateTime.Equivalence(previousSource.synchronizedAt, refreshedSource.synchronizedAt) ||\n previous.release.serviceName !== release.serviceName ||\n previous.release.version !== release.version ||\n previous.release.lifecycle !== release.lifecycle\n ) {\n yield* persistence.releases.append(scope.workspaceId, release, previous.revision)\n }\n const nodeId = yield* releaseNodeIdFor(cryptoService, scope, event.vendorImmutableId, event.eventId)\n const existingNode = yield* persistence.deliveryGraph.read(scope.workspaceId, {\n _tag: \"node\",\n nodeId\n }).pipe(Effect.result)\n if (Result.isSuccess(existingNode)) return { nodeCount: 0 }\n if (existingNode.failure._tag !== \"RecordNotFoundError\") return yield* existingNode.failure\n const receipt = yield* writeGraph(persistence, scope.workspaceId, {\n entityProjections: [],\n nodes: [{\n workspaceId: scope.workspaceId,\n nodeId,\n endpointKind: \"release\",\n resolution: { _tag: \"resolved\", target: { _tag: \"release\", releaseId } },\n createdAt: scope.committedAt\n }],\n evidenceItems: [],\n evidenceClaims: [],\n relationships: []\n }, event.eventId)\n return { nodeCount: receipt.nodeCount }\n})\n\nconst materializeTombstoneEntity = Effect.fn(\n \"NormalizedPluginPageMaterialization.tombstoneEntity\"\n)(function*(\n persistence: PersistenceService,\n scope: NormalizedPluginPageMaterializationScope,\n event: EntityTombstone\n) {\n const existing = yield* findEntity(persistence, scope, event.vendorImmutableId)\n if (existing === null) return { entityProjectionCount: 0 }\n const current = yield* readProjection(persistence, scope.workspaceId, existing.entityId)\n if (current === null) return yield* malformed(\"normalized-tombstone-projection-missing\", event.eventId)\n if (existing.sourceRevision.revision === event.revision && current.projection.entityState === \"deleted\") {\n return { entityProjectionCount: 0 }\n }\n const persisted = existing.sourceRevision.revision === event.revision\n ? existing\n : yield* persistence.entities.updateSourceRevision(scope.workspaceId, existing.entityId, {\n sourceRevision: sourceRevision(\n scope,\n event,\n existing.sourceRevision.firstObservedAt,\n existing.sourceRevision.sourceUrl\n ),\n expectedRevision: existing.revision,\n updatedAt: scope.committedAt\n })\n const projectionRevision = LedgerRevision.make(current.projection.projectionRevision + 1)\n const receipt = yield* writeGraph(persistence, scope.workspaceId, {\n entityProjections: [{\n projection: {\n ...current.projection,\n projectionRevision,\n sourceEntityRevision: LedgerRevision.make(persisted.revision),\n supersedesProjectionRevision: current.projection.projectionRevision,\n entityState: \"deleted\"\n },\n recordedAt: scope.committedAt\n }],\n nodes: [],\n evidenceItems: [],\n evidenceClaims: [],\n relationships: []\n }, event.eventId)\n return { entityProjectionCount: receipt.entityProjectionCount }\n})\n\nconst materializePerson = Effect.fn(\"NormalizedPluginPageMaterialization.upsertPerson\")(function*(\n persistence: PersistenceService,\n cryptoService: Crypto.Crypto,\n scope: NormalizedPluginPageMaterializationScope,\n event: PersonUpsert\n) {\n const identity = {\n pluginConnectionId: scope.pluginConnectionId,\n providerId: scope.providerId,\n vendorPersonId: VendorImmutableId.make(event.vendorPersonId)\n }\n const existing = yield* persistence.people.findPersonBySourceIdentity(scope.workspaceId, identity).pipe(\n Effect.result\n )\n if (Result.isFailure(existing) && existing.failure._tag !== \"RecordNotFoundError\") {\n return yield* existing.failure\n }\n const personId = Result.isSuccess(existing)\n ? existing.success.person.personId\n : PersonId.make(\n yield* stableUuid(\n cryptoService,\n materializationKey(scope, \"person\", event.vendorPersonId),\n event.eventId\n )\n )\n const avatar = event.avatarUrl !== null && event.avatarUrl.toString().length <= 500\n ? { _tag: \"reference\", reference: event.avatarUrl.toString() }\n : { _tag: \"initials\", text: derivePersonInitials(event.displayName) }\n const person = yield* Schema.decodeUnknownEffect(Schema.toType(Person))({\n personId,\n displayName: event.displayName,\n avatar,\n isActive: event.active,\n sourceIdentities: Result.isSuccess(existing) ? existing.success.person.sourceIdentities : [identity]\n }).pipe(Effect.mapError(() => malformed(\"normalized-person-invalid\", event.eventId)))\n if (\n Result.isSuccess(existing) &&\n existing.success.person.displayName === person.displayName &&\n existing.success.person.isActive === person.isActive &&\n existing.success.person.avatar._tag === person.avatar._tag &&\n (existing.success.person.avatar._tag === \"initials\"\n ? existing.success.person.avatar.text === (person.avatar._tag === \"initials\" ? person.avatar.text : \"\")\n : existing.success.person.avatar.reference ===\n (person.avatar._tag === \"reference\" ? person.avatar.reference : \"\"))\n ) {\n return 0\n }\n if (Result.isSuccess(existing)) {\n yield* persistence.people.updatePerson(\n scope.workspaceId,\n person,\n existing.success.revision,\n scope.committedAt\n )\n } else {\n yield* persistence.people.createPerson(scope.workspaceId, person, scope.committedAt)\n }\n return 1\n})\n\nconst evidencePredicate = (event: EvidenceAppend): typeof EvidencePredicate.Type => {\n const decoded = Schema.decodeUnknownResult(EvidencePredicate)(event.evidenceType)\n if (Result.isSuccess(decoded)) return decoded.success\n return \"status-observed\"\n}\n\nconst materializeEvidence = Effect.fn(\"NormalizedPluginPageMaterialization.appendEvidence\")(function*(\n persistence: PersistenceService,\n cryptoService: Crypto.Crypto,\n scope: NormalizedPluginPageMaterializationScope,\n event: EvidenceAppend\n) {\n const subject = yield* findEntity(persistence, scope, event.subject.vendorImmutableId)\n if (subject === null) return yield* malformed(\"normalized-evidence-subject-missing\", event.eventId)\n const subjectKind = canonicalKind(event.subject.entityType)\n if (subjectKind === null) return yield* malformed(\"normalized-evidence-subject-unsupported\", event.eventId)\n const nodeId = yield* nodeIdFor(cryptoService, scope, event.subject.vendorImmutableId, event.eventId)\n const evidenceId = EvidenceId.make(\n yield* stableUuid(\n cryptoService,\n materializationKey(scope, \"evidence\", event.evidenceId),\n event.eventId\n )\n )\n const evidenceClaimId = EvidenceClaimId.make(\n yield* stableUuid(\n cryptoService,\n materializationKey(scope, \"evidence-claim\", event.evidenceId),\n event.eventId\n )\n )\n const decodedData = Schema.decodeUnknownResult(EvidenceData)(event.data)\n const predicate = Result.isSuccess(decodedData) && decodedData.success.predicate !== undefined\n ? decodedData.success.predicate\n : evidencePredicate(event)\n const value: typeof EvidenceValue.Type = Result.isSuccess(decodedData) && decodedData.success.value !== undefined\n ? decodedData.success.value\n : { _tag: \"state\", value: event.summary }\n const source = subject.sourceRevision\n const ageSeconds = Math.max(\n 0,\n (DateTime.toEpochMillis(scope.committedAt) - DateTime.toEpochMillis(source.lastObservedAt)) / 1_000\n )\n const health: Extract<PluginHealth, { readonly _tag: \"degraded\" | \"healthy\" }> =\n scope.successfulHealth._tag === \"healthy\"\n ? { _tag: \"healthy\", checkedAt: scope.committedAt }\n : { ...scope.successfulHealth, checkedAt: scope.committedAt }\n const receipt = yield* writeGraph(persistence, scope.workspaceId, {\n entityProjections: [],\n nodes: [],\n evidenceItems: [{\n workspaceId: scope.workspaceId,\n evidenceId,\n schemaVersion: 1,\n attribution: {\n _tag: \"plugin\",\n pluginConnectionId: scope.pluginConnectionId,\n sourceEntityId: subject.entityId,\n sourceEntityRevision: LedgerRevision.make(subject.revision)\n },\n verifier: { _tag: \"system\", component: \"normalized-plugin-page-materializer\" },\n observedAt: event.capturedAt,\n recordedAt: scope.committedAt,\n validUntil: null,\n freshness: {\n _tag: \"current\",\n evaluatedAt: scope.committedAt,\n pluginHealth: health,\n provenance: { _tag: \"provider\", sourceRevision: source },\n sourceObservedAt: source.lastObservedAt,\n staleAfterSeconds: Math.max(1, Math.ceil(ageSeconds) + 1),\n synchronizedAt: scope.committedAt\n },\n retention: { classification: \"evidence\", retainUntil: null, legalHold: false }\n }],\n evidenceClaims: [{\n workspaceId: scope.workspaceId,\n evidenceClaimId,\n evidenceId,\n subjectNodeId: nodeId,\n predicate,\n value,\n recordedAt: scope.committedAt,\n supersedesEvidenceClaimId: null\n }],\n relationships: []\n }, event.eventId)\n return {\n evidenceItemCount: receipt.evidenceItemCount,\n evidenceClaimCount: receipt.evidenceClaimCount\n }\n})\n\nconst materializeRelationship = Effect.fn(\n \"NormalizedPluginPageMaterialization.proposeRelationship\"\n)(function*(\n persistence: PersistenceService,\n cryptoService: Crypto.Crypto,\n scope: NormalizedPluginPageMaterializationScope,\n event: RelationshipProposal\n) {\n const resolveEndpoint = Effect.fn(\"NormalizedPluginPageMaterialization.resolveRelationshipEndpoint\")(function*(\n reference: RelationshipProposal[\"from\"]\n ) {\n if (reference.entityType === \"release\") {\n const releaseId = yield* releaseIdFor(cryptoService, scope, reference.vendorImmutableId, event.eventId)\n const release = yield* persistence.releases.get(scope.workspaceId, releaseId).pipe(Effect.result)\n if (Result.isFailure(release)) {\n if (release.failure._tag === \"RecordNotFoundError\") {\n return yield* malformed(\"normalized-relationship-endpoint-missing\", event.eventId)\n }\n return yield* release.failure\n }\n const nodeId = yield* releaseNodeIdFor(cryptoService, scope, reference.vendorImmutableId, event.eventId)\n const existingNode = yield* persistence.deliveryGraph.read(scope.workspaceId, {\n _tag: \"node\",\n nodeId\n }).pipe(Effect.result)\n if (Result.isFailure(existingNode) && existingNode.failure._tag !== \"RecordNotFoundError\") {\n return yield* existingNode.failure\n }\n return {\n entity: null,\n kind: \"release\",\n node: Result.isSuccess(existingNode)\n ? null\n : {\n workspaceId: scope.workspaceId,\n nodeId,\n endpointKind: \"release\",\n resolution: { _tag: \"resolved\", target: { _tag: \"release\", releaseId } },\n createdAt: scope.committedAt\n },\n nodeId,\n releaseId\n } satisfies RelationshipEndpointResolution\n }\n const entity = yield* findEntity(persistence, scope, reference.vendorImmutableId)\n const kind = canonicalKind(reference.entityType)\n if (entity === null) return yield* malformed(\"normalized-relationship-endpoint-missing\", event.eventId)\n if (kind === null) return yield* malformed(\"normalized-relationship-endpoint-unsupported\", event.eventId)\n return {\n entity,\n kind,\n node: null,\n nodeId: yield* nodeIdFor(cryptoService, scope, reference.vendorImmutableId, event.eventId),\n releaseId: null\n } satisfies RelationshipEndpointResolution\n })\n const source = yield* resolveEndpoint(event.from)\n const target = yield* resolveEndpoint(event.to)\n const kind = yield* Schema.decodeUnknownEffect(RelationshipKind)(event.relationshipType).pipe(\n Effect.mapError(() => malformed(\"normalized-relationship-kind-invalid\", event.eventId))\n )\n const provenanceEntity = source.entity ?? target.entity\n if (provenanceEntity === null) {\n return yield* malformed(\"normalized-relationship-provenance-entity-missing\", event.eventId)\n }\n const relationshipScope: DeliveryRelationship[\"scope\"] = source.releaseId !== null\n ? { _tag: \"release\", releaseId: source.releaseId }\n : null\n const relationshipId = RelationshipId.make(\n yield* stableUuid(\n cryptoService,\n materializationKey(scope, \"relationship\", event.relationshipId),\n event.eventId\n )\n )\n const existing = yield* persistence.deliveryGraph.read(scope.workspaceId, {\n _tag: \"relationship\",\n relationshipId,\n revision: null\n }).pipe(Effect.result)\n if (Result.isFailure(existing) && existing.failure._tag !== \"RecordNotFoundError\") {\n return yield* existing.failure\n }\n const previous = Result.isSuccess(existing) && existing.success._tag === \"relationship\"\n ? existing.success.value\n : null\n const revision = LedgerRevision.make((previous?.revision ?? 0) + 1)\n const nodes: Array<DeliveryNode> = []\n if (source.node !== null) nodes.push(source.node)\n if (target.node !== null && target.node.nodeId !== source.nodeId) nodes.push(target.node)\n const receipt = yield* writeGraph(\n persistence,\n scope.workspaceId,\n {\n entityProjections: [],\n nodes,\n evidenceItems: [],\n evidenceClaims: [],\n relationships: [\n {\n workspaceId: scope.workspaceId,\n relationshipId,\n relationshipSchemaVersion: 1,\n revision,\n supersedesRevision: previous?.revision ?? null,\n kind,\n sourceNodeId: source.nodeId,\n sourceNodeKind: source.kind,\n targetNodeId: target.nodeId,\n targetNodeKind: target.kind,\n scope: relationshipScope,\n lifecycle: { _tag: \"proposed\", effectiveAt: event.observedAt },\n confidence: {\n _tag: \"inferred\",\n score: event.confidence,\n rationale: `Proposed by ${scope.providerId} normalized synchronization.`\n },\n provenance: {\n _tag: \"plugin\",\n pluginConnectionId: scope.pluginConnectionId,\n sourceEntityId: provenanceEntity.entityId,\n sourceEntityRevision: LedgerRevision.make(provenanceEntity.revision)\n },\n recordedBy: { _tag: \"system\", component: \"normalized-plugin-page-materializer\" },\n evidenceClaimIds: yield* Effect.forEach(\n event.evidenceIds,\n (evidenceId) =>\n stableUuid(cryptoService, materializationKey(scope, \"evidence-claim\", evidenceId), event.eventId).pipe(\n Effect.map(EvidenceClaimId.make)\n )\n ),\n recordedAt: scope.committedAt\n }\n ]\n },\n event.eventId\n )\n return { nodeCount: receipt.nodeCount, relationshipCount: receipt.relationshipCount }\n})\n\nconst hasAuthoritativeJiraFixVersions = (event: NormalizedPluginEventV1): event is EntityUpsert => {\n if (event._tag !== \"UpsertEntity\" || event.entityType !== \"jira.issue\") return false\n const snapshot = Schema.decodeUnknownResult(JiraIssueRelationshipSnapshot)(event.attributes)\n return Result.isSuccess(snapshot) && !snapshot.success.truncatedFields.includes(\"fixVersions\")\n}\n\nconst isReleaseContainmentForIssue = (\n event: NormalizedPluginEventV1,\n issue: EntityUpsert\n): event is RelationshipProposal =>\n event._tag === \"ProposeRelationship\" &&\n event.relationshipType === \"contains\" &&\n event.from.entityType === \"release\" &&\n event.to.entityType === issue.entityType &&\n event.to.vendorImmutableId === issue.vendorImmutableId\n\nconst retireMissingJiraReleaseContainments = Effect.fn(\n \"NormalizedPluginPageMaterialization.retireMissingJiraReleaseContainments\"\n)(function*(\n persistence: PersistenceService,\n cryptoService: Crypto.Crypto,\n scope: NormalizedPluginPageMaterializationScope,\n acceptedEvents: ReadonlyArray<NormalizedPluginEventV1>\n) {\n let relationshipCount = 0\n for (const issue of acceptedEvents) {\n if (!hasAuthoritativeJiraFixVersions(issue)) continue\n const source = yield* findEntity(persistence, scope, issue.vendorImmutableId)\n if (source === null) return yield* malformed(\"normalized-relationship-endpoint-missing\", issue.eventId)\n const issueNodeId = yield* nodeIdFor(cryptoService, scope, issue.vendorImmutableId, issue.eventId)\n const neighborhood = yield* persistence.deliveryGraph.read(scope.workspaceId, {\n _tag: \"nodeRelationships\",\n nodeId: issueNodeId,\n limit: 500\n })\n if (neighborhood._tag !== \"nodeRelationships\") continue\n if (neighborhood.value.truncated) {\n return yield* malformed(\"normalized-jira-containment-neighborhood-truncated\", issue.eventId)\n }\n const currentRelationshipIds = new Set(\n yield* Effect.forEach(\n acceptedEvents.filter((event) => isReleaseContainmentForIssue(event, issue)),\n ({ relationshipId }) =>\n stableUuid(\n cryptoService,\n materializationKey(scope, \"relationship\", relationshipId),\n issue.eventId\n ).pipe(Effect.map(RelationshipId.make))\n )\n )\n const removed = neighborhood.value.relationships.filter(\n (relationship) =>\n relationship.kind === \"contains\" &&\n relationship.sourceNodeKind === \"release\" &&\n relationship.targetNodeId === issueNodeId &&\n relationship.targetNodeKind === \"issue\" &&\n relationship.provenance._tag === \"plugin\" &&\n relationship.provenance.pluginConnectionId === scope.pluginConnectionId &&\n relationship.provenance.sourceEntityId === source.entityId &&\n !currentRelationshipIds.has(relationship.relationshipId)\n )\n if (removed.length === 0) continue\n\n for (const previous of removed) {\n if (previous.lifecycle._tag === \"rejected\" || previous.lifecycle._tag === \"superseded\") continue\n const receipt = yield* writeGraph(persistence, scope.workspaceId, {\n entityProjections: [],\n nodes: [],\n evidenceItems: [],\n evidenceClaims: [],\n relationships: [{\n ...previous,\n revision: LedgerRevision.make(previous.revision + 1),\n supersedesRevision: previous.revision,\n lifecycle: {\n _tag: \"superseded\",\n effectiveAt: issue.observedAt,\n reason: \"No longer present in the latest Jira fixVersion observation.\"\n },\n provenance: {\n _tag: \"plugin\",\n pluginConnectionId: scope.pluginConnectionId,\n sourceEntityId: source.entityId,\n sourceEntityRevision: LedgerRevision.make(source.revision)\n },\n recordedBy: { _tag: \"system\", component: \"normalized-plugin-page-materializer\" },\n recordedAt: scope.committedAt\n }]\n }, issue.eventId)\n relationshipCount += receipt.relationshipCount\n }\n }\n return relationshipCount\n})\n\n/** Host authority supplied separately from provider-controlled normalized data. */\nexport interface NormalizedPluginPageMaterializationScope {\n readonly workspaceId: WorkspaceId\n readonly pluginConnectionId: PluginConnectionId\n readonly providerId: ProviderId\n readonly streamKey: PluginStreamKey\n readonly expectedRevision: number\n readonly committedAt: UtcTimestamp\n readonly successfulHealth: Extract<PluginHealth, { readonly _tag: \"healthy\" | \"degraded\" }>\n readonly expectedAuthority?: PluginSynchronizationAuthority\n}\n\n/** Durable counts from one new page, or zero counts when the exact page is replayed. */\nexport interface NormalizedPluginPageMaterializationReceipt {\n readonly pageCommitted: boolean\n readonly acceptedEventCount: number\n readonly entityProjectionCount: number\n readonly evidenceClaimCount: number\n readonly evidenceItemCount: number\n readonly nodeCount: number\n readonly personCount: number\n readonly relationshipCount: number\n readonly skippedEntityCount: number\n}\n\n/**\n * Commit one decoded page and all accepted canonical projections atomically.\n * The existing plugin checkpoint transaction nests as a savepoint; only its\n * newly accepted event identities cross the materialization seam.\n */\nexport const materializeNormalizedPluginPage = Effect.fn(\n \"NormalizedPluginPageMaterialization.materializePage\"\n)(function*(\n scope: NormalizedPluginPageMaterializationScope,\n page: PluginSyncPageV1\n): Effect.fn.Return<\n NormalizedPluginPageMaterializationReceipt,\n NormalizedPluginPageMaterializationError | PersistenceOperationFailure | PluginConflictFailure,\n Crypto.Crypto | Persistence\n> {\n const cryptoService = yield* Crypto.Crypto\n const persistence = yield* Persistence\n return yield* persistence.transact(Effect.gen(function*() {\n if (scope.expectedAuthority !== undefined) {\n yield* verifyPluginSynchronizationAuthority(persistence, scope.expectedAuthority)\n }\n const committed = yield* persistence.pluginRuntime.commitNormalizedPageReceipt(\n scope.workspaceId,\n scope.pluginConnectionId,\n scope.providerId,\n scope.streamKey,\n scope.expectedRevision,\n page,\n scope.committedAt,\n scope.successfulHealth\n )\n const accepted = new Set(committed.acceptedEventIds)\n const events = page.events.filter(({ eventId }) => accepted.has(eventId))\n let entityProjectionCount = 0\n let evidenceClaimCount = 0\n let evidenceItemCount = 0\n let nodeCount = 0\n let personCount = 0\n let relationshipCount = 0\n let skippedEntityCount = 0\n\n for (const event of events) {\n if (event._tag !== \"UpsertPerson\") continue\n personCount += yield* materializePerson(persistence, cryptoService, scope, event)\n }\n for (const event of events) {\n if (event._tag === \"UpsertEntity\") {\n if (event.entityType === \"release\") {\n nodeCount += (yield* materializeRelease(persistence, cryptoService, scope, event)).nodeCount\n continue\n }\n const receipt = yield* materializeUpsertEntity(persistence, cryptoService, scope, event)\n entityProjectionCount += receipt.entityProjectionCount\n nodeCount += receipt.nodeCount\n skippedEntityCount += receipt.skippedEntityCount\n } else if (event._tag === \"TombstoneEntity\") {\n entityProjectionCount += (yield* materializeTombstoneEntity(persistence, scope, event)).entityProjectionCount\n }\n }\n for (const event of events) {\n if (event._tag !== \"AppendEvidence\") continue\n const receipt = yield* materializeEvidence(persistence, cryptoService, scope, event)\n evidenceItemCount += receipt.evidenceItemCount\n evidenceClaimCount += receipt.evidenceClaimCount\n }\n for (const event of events) {\n if (event._tag !== \"ProposeRelationship\") continue\n const receipt = yield* materializeRelationship(persistence, cryptoService, scope, event)\n nodeCount += receipt.nodeCount\n relationshipCount += receipt.relationshipCount\n }\n relationshipCount += yield* retireMissingJiraReleaseContainments(\n persistence,\n cryptoService,\n scope,\n events\n )\n if (events.length > 0) {\n const inference = yield* materializeRelationshipInference(\n persistence,\n (identity) => stableUuid(cryptoService, identity, \"relationship-inference\"),\n scope\n )\n evidenceClaimCount += inference.evidenceClaimCount\n evidenceItemCount += inference.evidenceItemCount\n nodeCount += inference.nodeCount\n relationshipCount += inference.relationshipCount\n }\n return {\n pageCommitted: committed.pageCommitted,\n acceptedEventCount: events.length,\n entityProjectionCount,\n evidenceClaimCount,\n evidenceItemCount,\n nodeCount,\n personCount,\n relationshipCount,\n skippedEntityCount\n }\n }))\n})\n","import * as Clock from \"effect/Clock\"\nimport * as Context from \"effect/Context\"\nimport * as Crypto from \"effect/Crypto\"\nimport * as DateTime from \"effect/DateTime\"\nimport * as Effect from \"effect/Effect\"\nimport * as Option from \"effect/Option\"\nimport * as Predicate from \"effect/Predicate\"\nimport * as Result from \"effect/Result\"\nimport * as Schema from \"effect/Schema\"\nimport * as Stream from \"effect/Stream\"\n\nimport type { PluginSynchronizationState } from \"../../api/plugins.js\"\nimport { PluginHealth, type PluginHealth as PluginHealthType } from \"../../domain/freshness.js\"\nimport type { PluginConnectionId, WorkspaceId } from \"../../domain/identifiers.js\"\nimport { NegotiatedPluginDescriptorV1 } from \"../../domain/plugins/descriptor.js\"\nimport { PluginCheckpointV1, type PluginSyncPageV1, PluginSyncRequestV1 } from \"../../domain/plugins/events.js\"\nimport type { ProviderId } from \"../../domain/sourceRevision.js\"\nimport type { UtcTimestamp } from \"../../domain/utcTimestamp.js\"\nimport {\n ApplicationInvalidRequest,\n ApplicationResourceNotFound,\n ApplicationServiceUnavailable,\n type PluginAdministrationError\n} from \"../api/ApplicationServices.js\"\nimport type { PersistenceOperationFailure } from \"../persistence/Persistence.js\"\nimport { Persistence } from \"../persistence/Persistence.js\"\nimport type {\n PluginSyncAttemptRecord,\n PluginSyncAttemptState\n} from \"../persistence/repositories/pluginRuntimeModels.js\"\nimport { PluginStreamKey } from \"../persistence/repositories/pluginRuntimeModels.js\"\nimport type { PluginFailure } from \"../plugins/failures.js\"\nimport { pluginFailureClass, PluginMalformedResponseFailure } from \"../plugins/failures.js\"\nimport { firstPartySyncStreamKey, supportsFirstPartySynchronization } from \"../plugins/firstPartySynchronization.js\"\nimport { PluginConnection, type PluginConnectionV1 } from \"../plugins/PluginConnection.js\"\nimport type { PluginConnectionMapV1 } from \"../plugins/PluginConnectionMap.js\"\nimport { DomainEventWakeups } from \"../runtime/DomainEventWakeups.js\"\nimport { materializeNormalizedPluginPage } from \"./normalizedPluginPageMaterialization.js\"\nimport {\n capturePluginSynchronizationAuthority,\n type PluginSynchronizationAuthority,\n verifyPluginSynchronizationAuthority\n} from \"./pluginSynchronizationAuthority.js\"\nimport { appendPortfolioInvalidation } from \"./portfolioInvalidation.js\"\n\nconst MAXIMUM_PAGES_PER_INVOCATION = 100\nconst SYNCHRONIZATION_CLAIM_LIFETIME_MINUTES = 15\nconst SOURCE_UNAVAILABLE_OUTCOME = \"source-unavailable\"\nconst SYNCHRONIZED_OUTCOME = \"synchronized\"\ntype SuccessfulPluginHealth = Extract<PluginHealthType, { readonly _tag: \"healthy\" | \"degraded\" }>\n\nconst successfulHealthAt = (\n health: SuccessfulPluginHealth,\n checkedAt: UtcTimestamp\n): SuccessfulPluginHealth =>\n health._tag === \"healthy\"\n ? { _tag: \"healthy\", checkedAt }\n : {\n ...health,\n checkedAt,\n retryAt: health.retryAt !== null && DateTime.Order(checkedAt, health.retryAt) <= 0\n ? health.retryAt\n : null\n }\n\n/** One provider-neutral manual synchronization driver with a fixed logical stream identity. */\nexport interface ManualPluginSyncDriver {\n readonly providerId: ProviderId\n readonly streamKey: string\n readonly sync: (\n connection: PluginConnectionV1,\n request: typeof PluginSyncRequestV1.Type\n ) => Stream.Stream<PluginSyncPageV1, PluginFailure>\n}\n\n/** Fixed lookup boundary that keeps provider identifiers out of the orchestration state machine. */\nexport interface ManualPluginSyncDriverRegistry {\n readonly get: (providerId: ProviderId) => Option.Option<ManualPluginSyncDriver>\n}\n\n/** Build a deterministic driver registry for production or fixture connections. */\nexport const makeManualPluginSyncDriverRegistry = (\n drivers: ReadonlyArray<ManualPluginSyncDriver>\n): ManualPluginSyncDriverRegistry => {\n const byProvider = new Map<ProviderId, ManualPluginSyncDriver>()\n for (const driver of drivers) byProvider.set(driver.providerId, driver)\n return { get: (providerId) => Option.fromNullishOr(byProvider.get(providerId)) }\n}\n\nconst connectionSync = (\n connection: PluginConnectionV1,\n request: typeof PluginSyncRequestV1.Type\n) => connection.sync(request)\n\n/** Production drivers for first-party connections that currently negotiate synchronization. */\nexport const firstPartyManualPluginSyncDrivers = makeManualPluginSyncDriverRegistry([\n { providerId: \"codecommit\", streamKey: firstPartySyncStreamKey(\"codecommit\"), sync: connectionSync },\n { providerId: \"codepipeline\", streamKey: firstPartySyncStreamKey(\"codepipeline\"), sync: connectionSync },\n { providerId: \"jira\", streamKey: firstPartySyncStreamKey(\"jira\"), sync: connectionSync },\n { providerId: \"clockify\", streamKey: firstPartySyncStreamKey(\"clockify\"), sync: connectionSync },\n { providerId: \"confluence\", streamKey: firstPartySyncStreamKey(\"confluence\"), sync: connectionSync }\n])\n\nconst unavailable = () => new ApplicationServiceUnavailable({ retryAt: null })\n\nconst mapPersistenceRead = (\n failure: PersistenceOperationFailure\n): ApplicationResourceNotFound | ApplicationServiceUnavailable =>\n failure._tag === \"RecordNotFoundError\" ? new ApplicationResourceNotFound() : unavailable()\n\nconst pluginFailureTags = new Set([\n \"PluginAuthenticationFailure\",\n \"PluginAuthorizationFailure\",\n \"PluginRateLimitFailure\",\n \"PluginTimeoutFailure\",\n \"PluginMalformedResponseFailure\",\n \"PluginOutageFailure\",\n \"PluginCancellationFailure\",\n \"PluginConflictFailure\",\n \"PluginUnsupportedCapabilityFailure\",\n \"PluginConfigurationFailure\",\n \"PluginUnknownOutcomeFailure\"\n])\n\nconst isPluginFailure = (failure: unknown): failure is PluginFailure =>\n Predicate.hasProperty(failure, \"_tag\") &&\n typeof failure._tag === \"string\" &&\n pluginFailureTags.has(failure._tag)\n\nconst sourceFailure = (failure: unknown): PluginFailure | null => {\n if (isPluginFailure(failure)) return failure\n if (\n Predicate.hasProperty(failure, \"_tag\") &&\n failure._tag === \"NormalizedPluginPageMaterializationError\"\n ) {\n return new PluginMalformedResponseFailure({\n operation: \"manual-sync\",\n diagnosticCode: \"normalized-plugin-page-rejected\"\n })\n }\n if (\n Predicate.hasProperty(failure, \"_tag\") &&\n failure._tag === \"SourceIdentityMismatchError\" &&\n Predicate.hasProperty(failure, \"recordKind\") &&\n (failure.recordKind === \"plugin-sync-event\" || failure.recordKind === \"plugin-sync-page\")\n ) {\n return new PluginMalformedResponseFailure({\n operation: \"manual-sync\",\n diagnosticCode: \"plugin-sync-source-identity-conflict\"\n })\n }\n return null\n}\n\nconst safeFailureMessage = (failure: PluginFailure): string => {\n switch (failure._tag) {\n case \"PluginAuthenticationFailure\":\n return \"Provider authentication failed.\"\n case \"PluginAuthorizationFailure\":\n return \"Provider permission was denied.\"\n case \"PluginRateLimitFailure\":\n return \"Provider rate limit was reached.\"\n case \"PluginTimeoutFailure\":\n return \"Provider request timed out.\"\n case \"PluginMalformedResponseFailure\":\n return \"Provider returned an invalid response.\"\n case \"PluginOutageFailure\":\n return \"Provider is temporarily unavailable.\"\n case \"PluginCancellationFailure\":\n return \"Provider synchronization was cancelled.\"\n case \"PluginConflictFailure\":\n return \"Provider state changed during synchronization.\"\n case \"PluginUnsupportedCapabilityFailure\":\n return \"Provider synchronization is not supported.\"\n case \"PluginConfigurationFailure\":\n return \"Provider configuration is incomplete.\"\n case \"PluginUnknownOutcomeFailure\":\n return \"Provider synchronization outcome is unknown.\"\n }\n}\n\nconst failureHealth = Effect.fn(\"ManualPluginSynchronization.failureHealth\")(function*(\n failure: PluginFailure,\n checkedAt: UtcTimestamp\n) {\n return yield* Schema.decodeUnknownEffect(Schema.toType(PluginHealth))({\n _tag: \"unavailable\",\n checkedAt,\n failureClass: pluginFailureClass(failure),\n retryAt: failure._tag === \"PluginRateLimitFailure\" ? failure.retryAt : null,\n safeMessage: safeFailureMessage(failure)\n })\n})\n\nconst stateFromAttemptState = (\n pluginConnectionId: PluginConnectionId,\n providerId: ProviderId,\n streamKey: string,\n attemptState: PluginSyncAttemptState\n): PluginSynchronizationState => {\n const lastAttempt: PluginSyncAttemptRecord | undefined = attemptState.latestAttempt ?? undefined\n const lastSuccess: PluginSyncAttemptRecord | undefined = attemptState.latestSynchronized ?? undefined\n return {\n pluginConnectionId,\n providerId,\n streamKey,\n lastAttemptAt: lastAttempt?.startedAt ?? null,\n lastSuccessAt: lastSuccess?.completedAt ?? null,\n result: lastAttempt === undefined\n ? \"never\"\n : lastAttempt.outcome === null\n ? \"running\"\n : lastAttempt.outcome,\n pagesCommitted: lastAttempt?.pagesCommitted ?? 0\n }\n}\n\ninterface BoundManualSync {\n readonly workspaceId: WorkspaceId\n readonly pluginConnectionId: PluginConnectionId\n readonly providerId: ProviderId\n readonly driver: ManualPluginSyncDriver\n readonly streamKey: PluginStreamKey\n}\n\ninterface SynchronizationClaim extends BoundManualSync {\n readonly claimId: string\n}\n\nexport interface ManualPluginSynchronizationService {\n readonly state: (input: {\n readonly workspaceId: WorkspaceId\n readonly pluginConnectionId: PluginConnectionId\n }) => Effect.Effect<PluginSynchronizationState, ApplicationInvalidRequest | PluginAdministrationError>\n readonly synchronize: (input: {\n readonly workspaceId: WorkspaceId\n readonly pluginConnectionId: PluginConnectionId\n }) => Effect.Effect<PluginSynchronizationState, ApplicationInvalidRequest | PluginAdministrationError>\n}\n\n/** Build the bounded synchronization application over a scoped provider runtime map. */\nexport const makeManualPluginSynchronization = Effect.fn(\n \"ManualPluginSynchronization.make\"\n)(function*(\n connections: PluginConnectionMapV1,\n drivers: ManualPluginSyncDriverRegistry = firstPartyManualPluginSyncDrivers\n): Effect.fn.Return<ManualPluginSynchronizationService, never, Crypto.Crypto | DomainEventWakeups | Persistence> {\n const persistence = yield* Persistence\n const wakeups = yield* DomainEventWakeups\n const cryptoService = yield* Crypto.Crypto\n\n const bind = Effect.fn(\"ManualPluginSynchronization.bind\")(function*(input: {\n readonly workspaceId: WorkspaceId\n readonly pluginConnectionId: PluginConnectionId\n }): Effect.fn.Return<BoundManualSync, ApplicationInvalidRequest | PluginAdministrationError> {\n const connection = yield* persistence.pluginConnections.get(\n input.workspaceId,\n input.pluginConnectionId\n ).pipe(Effect.mapError(mapPersistenceRead))\n const driver = drivers.get(connection.providerId)\n if (Option.isNone(driver)) return yield* new ApplicationInvalidRequest()\n const runtime = yield* persistence.pluginRuntime.getRuntime(\n input.workspaceId,\n input.pluginConnectionId\n ).pipe(Effect.mapError(mapPersistenceRead))\n const descriptor = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(NegotiatedPluginDescriptorV1))(\n runtime.descriptorJson\n ).pipe(Effect.mapError(() => new ApplicationInvalidRequest()))\n if (!supportsFirstPartySynchronization(connection.providerId, descriptor)) {\n return yield* new ApplicationInvalidRequest()\n }\n const streamKey = yield* Schema.decodeUnknownEffect(PluginStreamKey)(driver.value.streamKey).pipe(\n Effect.mapError(() => new ApplicationInvalidRequest())\n )\n return { ...input, providerId: connection.providerId, driver: driver.value, streamKey }\n })\n\n const releaseSynchronization = Effect.fn(\n \"ManualPluginSynchronization.releaseSynchronization\"\n )(function*(claim: SynchronizationClaim) {\n yield* persistence.pluginRuntime.releaseSyncClaim(\n claim.workspaceId,\n claim.pluginConnectionId,\n claim.streamKey,\n claim.claimId\n ).pipe(Effect.mapError(() => unavailable()))\n })\n\n const claimSynchronization = Effect.fn(\n \"ManualPluginSynchronization.claimSynchronization\"\n )(function*(bound: BoundManualSync) {\n const claimId = yield* cryptoService.randomUUIDv4.pipe(Effect.mapError(() => unavailable()))\n const claimedAt = DateTime.makeUnsafe(yield* Effect.clockWith((clock) => clock.currentTimeMillis))\n const expiresAt = DateTime.add(claimedAt, { minutes: SYNCHRONIZATION_CLAIM_LIFETIME_MINUTES })\n const claimed = yield* persistence.pluginRuntime.claimSync(\n bound.workspaceId,\n bound.pluginConnectionId,\n bound.providerId,\n bound.streamKey,\n claimId,\n claimedAt,\n expiresAt\n ).pipe(Effect.mapError(() => unavailable()))\n if (!claimed) return yield* unavailable()\n return { ...bound, claimId }\n })\n\n const stateFor = Effect.fn(\"ManualPluginSynchronization.stateFor\")(function*(bound: BoundManualSync) {\n const attemptState = yield* persistence.pluginRuntime.getSyncAttemptState(\n bound.workspaceId,\n bound.pluginConnectionId,\n bound.streamKey\n ).pipe(Effect.mapError(() => unavailable()))\n return stateFromAttemptState(\n bound.pluginConnectionId,\n bound.providerId,\n bound.streamKey,\n attemptState\n )\n })\n\n const readState = Effect.fn(\"ManualPluginSynchronization.state\")(function*(input: {\n readonly workspaceId: WorkspaceId\n readonly pluginConnectionId: PluginConnectionId\n }) {\n const bound = yield* bind(input)\n return yield* stateFor(bound)\n })\n\n const persistHealth = Effect.fn(\"ManualPluginSynchronization.persistHealth\")(function*(\n bound: BoundManualSync,\n authority: PluginSynchronizationAuthority,\n health: PluginHealthType,\n failed: boolean\n ) {\n const persisted = yield* persistence.transact(Effect.gen(function*() {\n yield* verifyPluginSynchronizationAuthority(persistence, authority)\n const runtime = yield* persistence.pluginRuntime.getRuntime(\n bound.workspaceId,\n bound.pluginConnectionId\n )\n yield* persistence.pluginRuntime.recordHealth(\n bound.workspaceId,\n bound.pluginConnectionId,\n runtime.revision,\n health,\n failed ? runtime.consecutiveFailures + 1 : 0\n )\n yield* appendPortfolioInvalidation({\n workspaceId: bound.workspaceId,\n pluginConnectionId: bound.pluginConnectionId,\n releaseId: null,\n occurredAt: health.checkedAt,\n reason: \"plugin-health\"\n }).pipe(\n Effect.provideService(Crypto.Crypto, cryptoService),\n Effect.provideService(Persistence, persistence)\n )\n return true\n })).pipe(\n Effect.catchTag(\"PluginConflictFailure\", () => Effect.succeed(false)),\n Effect.mapError(() => unavailable())\n )\n if (persisted) yield* wakeups.notify(bound.workspaceId)\n return persisted\n })\n\n const initialCheckpoint = Effect.fn(\"ManualPluginSynchronization.initialCheckpoint\")(function*(\n bound: BoundManualSync\n ) {\n const current = yield* Effect.result(\n persistence.pluginRuntime.getStream(bound.workspaceId, bound.pluginConnectionId, bound.streamKey)\n )\n if (Result.isFailure(current)) {\n if (current.failure._tag === \"RecordNotFoundError\") return null\n return yield* Effect.fail(current.failure)\n }\n return current.success.checkpointJson === null\n ? null\n : yield* Schema.decodeUnknownEffect(Schema.fromJsonString(PluginCheckpointV1))(\n current.success.checkpointJson\n )\n })\n\n const run = Effect.fn(\"ManualPluginSynchronization.run\")(function*(\n bound: BoundManualSync,\n authority: PluginSynchronizationAuthority,\n connection: PluginConnectionV1,\n health: SuccessfulPluginHealth\n ) {\n const checkpoint = yield* initialCheckpoint(bound)\n const request = yield* Schema.decodeUnknownEffect(PluginSyncRequestV1)({\n streamKey: bound.streamKey,\n checkpoint\n })\n const initialStream = yield* Effect.result(\n persistence.pluginRuntime.getStream(bound.workspaceId, bound.pluginConnectionId, bound.streamKey)\n )\n const revision = Result.isSuccess(initialStream) ? initialStream.success.revision : 0\n return yield* Stream.runFoldEffect(\n bound.driver.sync(connection, request).pipe(Stream.take(MAXIMUM_PAGES_PER_INVOCATION)),\n () => ({ health, isTerminal: false, pagesSeen: 0, pagesCommitted: 0, revision }),\n (state, page) =>\n Effect.gen(function*() {\n if (state.isTerminal) {\n return yield* new PluginMalformedResponseFailure({\n operation: \"manual-sync\",\n diagnosticCode: \"manual-sync-page-after-terminal\"\n })\n }\n const committedAt = DateTime.makeUnsafe(yield* Clock.currentTimeMillis)\n const successfulHealth = successfulHealthAt(state.health, committedAt)\n const receipt = yield* materializeNormalizedPluginPage({\n workspaceId: bound.workspaceId,\n pluginConnectionId: bound.pluginConnectionId,\n providerId: bound.providerId,\n streamKey: bound.streamKey,\n expectedRevision: state.revision,\n committedAt,\n successfulHealth,\n expectedAuthority: authority\n }, page).pipe(\n Effect.provideService(Crypto.Crypto, cryptoService),\n Effect.provideService(Persistence, persistence)\n )\n const pagesSeen = state.pagesSeen + 1\n return {\n health: successfulHealth,\n isTerminal: !page.hasMore,\n pagesSeen,\n pagesCommitted: state.pagesCommitted + (receipt.pageCommitted ? 1 : 0),\n revision: state.revision + (receipt.pageCommitted ? 1 : 0)\n }\n })\n )\n })\n\n const synchronizeBound = Effect.fn(\"ManualPluginSynchronization.synchronizeBound\")(function*(\n input: {\n readonly workspaceId: WorkspaceId\n readonly pluginConnectionId: PluginConnectionId\n },\n bound: BoundManualSync\n ) {\n const captured = yield* capturePluginSynchronizationAuthority(\n persistence,\n bound.workspaceId,\n bound.pluginConnectionId\n ).pipe(Effect.mapError(mapPersistenceRead))\n const { authority, connection: connectionRecord } = captured\n if (!connectionRecord.isEnabled) return yield* new ApplicationInvalidRequest()\n const startedAt = DateTime.makeUnsafe(yield* Effect.clockWith((clock) => clock.currentTimeMillis))\n const attempt = yield* persistence.pluginRuntime.beginSyncAttempt(\n bound.workspaceId,\n bound.pluginConnectionId,\n bound.providerId,\n bound.streamKey,\n startedAt\n ).pipe(Effect.mapError(() => unavailable()))\n const synchronized = yield* Effect.result(Effect.scoped(\n Effect.flatMap(\n connections.contextEffect({\n workspaceId: bound.workspaceId,\n pluginConnectionId: bound.pluginConnectionId\n }),\n (context) =>\n Effect.gen(function*() {\n const connection = Context.get(context, PluginConnection)\n const health = yield* connection.health\n if (health._tag === \"unavailable\" || health._tag === \"disabled\") return health\n const completed = yield* run(bound, authority, connection, health)\n if (\n !completed.isTerminal &&\n (\n completed.pagesSeen < MAXIMUM_PAGES_PER_INVOCATION ||\n completed.pagesCommitted === 0\n )\n ) {\n return yield* new PluginMalformedResponseFailure({\n operation: \"manual-sync\",\n diagnosticCode: \"manual-sync-terminal-page-missing\"\n })\n }\n return completed.health\n }).pipe(Effect.provide(context))\n )\n ))\n const outcome = yield* Effect.gen(function*() {\n if (Result.isSuccess(synchronized)) {\n const health = synchronized.success\n const sourceUnavailable = health._tag === \"unavailable\" || health._tag === \"disabled\"\n const healthPersisted = yield* persistHealth(bound, authority, health, sourceUnavailable)\n return sourceUnavailable || !healthPersisted ? SOURCE_UNAVAILABLE_OUTCOME : SYNCHRONIZED_OUTCOME\n }\n const failure = sourceFailure(synchronized.failure)\n if (failure === null) return yield* unavailable()\n const failedAt = DateTime.makeUnsafe(yield* Effect.clockWith((clock) => clock.currentTimeMillis))\n const health = yield* failureHealth(failure, failedAt).pipe(Effect.mapError(() => unavailable()))\n yield* persistHealth(bound, authority, health, true)\n return SOURCE_UNAVAILABLE_OUTCOME\n })\n const completedAt = DateTime.makeUnsafe(yield* Effect.clockWith((clock) => clock.currentTimeMillis))\n yield* persistence.pluginRuntime.completeSyncAttempt(\n bound.workspaceId,\n bound.pluginConnectionId,\n bound.streamKey,\n attempt.attemptSequence,\n outcome,\n completedAt\n ).pipe(Effect.mapError(() => unavailable()))\n return yield* readState(input)\n })\n\n const synchronize = Effect.fn(\"ManualPluginSynchronization.synchronize\")(function*(input: {\n readonly workspaceId: WorkspaceId\n readonly pluginConnectionId: PluginConnectionId\n }) {\n const bound = yield* bind(input)\n return yield* Effect.acquireUseRelease(\n claimSynchronization(bound),\n () => synchronizeBound(input, bound),\n releaseSynchronization\n )\n })\n\n return { state: readState, synchronize }\n})\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,IAAM,iBACJ,IAAI,sBAAsB;CACxB,WAAW;CACX,gBAAgB;AAClB,CAAC;AAEH,IAAM,eAAe,OAAO,GAAG,8CAA8C,CAAC,CAAC,WAC7E,aACA,YACA;CACA,MAAM,gBAAgB,OAAO,YAAY,qBAAqB,IAC5D,WAAW,aACX,WAAW,kBACb;CACA,OAAO;EACL,aAAa,WAAW;EACxB,oBAAoB,WAAW;EAC/B,YAAY,WAAW;EACvB,oBAAoB,WAAW;EAC/B,uBAAuB,OAAO,OAAO,aAAa,IAAI,cAAc,MAAM,WAAW;CACvF;AACF,CAAC;;AAGD,IAAa,wCAAwC,OAAO,GAC1D,wCACF,CAAC,CAAC,WACA,aACA,aACA,oBAIA;CACA,OAAO,OAAO,YAAY,SAAS,OAAO,IAAI,aAAY;EACxD,MAAM,aAAa,OAAO,YAAY,kBAAkB,IAAI,aAAa,kBAAkB;EAE3F,OAAO;GAAE;GAAY,WAAA,OADI,aAAa,aAAa,UAAU;EAC9B;CACjC,CAAC,CAAC;AACJ,CAAC;;AAGD,IAAa,uCAAuC,OAAO,GACzD,uCACF,CAAC,CAAC,WACA,aACA,UAC6E;CAC7E,MAAM,aAAa,OAAO,YAAY,kBAAkB,IACtD,SAAS,aACT,SAAS,kBACX,CAAC,CAAC,KACA,OAAO,SAAS,6BAA6B,SAAS,CAAC,CACzD;CACA,MAAM,UAAU,OAAO,aAAa,aAAa,UAAU;CAC3D,IACE,CAAC,WAAW,aACZ,QAAQ,eAAe,SAAS,cAChC,QAAQ,uBAAuB,SAAS,sBACxC,QAAQ,0BAA0B,SAAS,uBAE3C,OAAO,OAAO,SAAS;AAE3B,CAAC;;;AC5BD,IAAM,+BAA+B;AAOrC,IAAM,gBACJ,aACA,cACS;CACT,IAAI,YAAY,WAAW,U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Q,IAAI;GACnD,OAAO;EACT,CAAC;EACD,MAAM,cAAc,SAAS,WAAW,OAAO,OAAO,WAAW,UAAU,MAAM,iBAAiB,CAAC;EACnG,OAAO,YAAY,cAAc,oBAC/B,MAAM,aACN,MAAM,oBACN,MAAM,WACN,QAAQ,iBACR,SACA,WACF,CAAC,CAAC,KAAK,OAAO,eAAe,YAAY,CAAC,CAAC;EAC3C,OAAO,OAAO,UAAU,KAAK;CAC/B,CAAC;CAcD,OAAO;EAAE,OAAO;EAAW,aAZP,OAAO,GAAG,yCAAyC,CAAC,CAAC,WAAU,OAGhF;GACD,MAAM,QAAQ,OAAO,KAAK,KAAK;GAC/B,OAAO,OAAO,OAAO,kBACnB,qBAAqB,KAAK,SACpB,iBAAiB,OAAO,KAAK,GACnC,sBACF;EACF,CAE2B;CAAY;AACzC,CAAC"}
|
package/dist/server/assets/{portfolioInvalidation-Ds9Xm4_P.js → portfolioInvalidation-iTUo5N4r.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { An as ReadinessVerdict, Ar as GovernedActionAuthorizationId, Br as RelationshipRepairProposalId, Cr as EntityId, D as DeliveryEntityStatusGroup, Dr as EvidenceId, E as DeliveryEntityService, En as ReadinessRuleVersion, Er as EvidenceClaimId, F as EvidenceValue, Fr as PersonId, Gr as ShareId, Gt as RoleAssignment, Hr as ReleaseId, Ht as PersonAvatar, Ir as PluginConnectionId, Kr as WorkspaceId, Lr as ProviderAccountId, Lt as Actor, M as EvidenceItem, Mr as GovernedActionTransitionId, Nr as GraphNodeId, O as DeliveryNode, Or as FollowedResourceId, Pr as JobId, R as LedgerRevision, Rr as ReadinessAssessmentId, S as RelationshipRepairReviewDecision, Sr as DomainEventId, T as DeliveryEntityProjection, Tr as EventCursor, Ur as RoleAssignmentId, Ut as PersonSourceIdentity, V as RelationshipEndpointKind, Vr as RelationshipRepairReviewId, Vt as Person, Wr as SessionId, Wt as Role, Yt as EnvironmentReadinessAssessment, _ as RelationshipRepairDisposition, _r as SourceUrl, a as PortfolioInvalidatedPayloadV1, an as ReadinessAssessment, ar as MaximumPluginPayloadBytes, b as RelationshipRepairRationale, br as AgentId, bt as SemanticVersion, cn as ReadinessDerivationVersion, cr as hasMaximumPluginJsonBytes, dr as PluginHealth, g as RelationshipRepairApplication, gr as SourceRevision, hr as Revision$1, ht as PluginCapabilityId, i as PortfolioInvalidatedEventV1, in as ReadinessArtifactRevision, j as EvidenceClaim, jn as ReleaseReadinessAssessment, jr as GovernedActionId, k as DeliveryRelationship, kr as GovernedActionAttemptId, lr as Freshness, mr as ProviderId, mt as NegotiatedPluginDescriptorV1, n as DomainEventMetadataV1, on as ReadinessCandidateDigest, pr as NormalizationSchemaVersion, qt as derivePersonInitials, rt as NormalizedIssueAttributes, s as TimelineActorKind, t as DomainEventCorrelationId, v as RelationshipRepairProposal, vr as VendorImmutableId, vt as PluginDescriptorV1, w as DeliveryEntityKind, wn as ReadinessRuleId, wr as EnvironmentId, x as RelationshipRepairReview, xr as AgentThreadId, xt as Release, y as RelationshipRepairProposalOrigin, yr as UtcTimestamp, zr as RelationshipId } from "./domainEvent-
|
|
2
|
-
import { At as PluginSyncPageV1, B as GovernedActionEnvelopeMaterialV1, F as GovernedActionAttemptDigest, G as GovernedActionIdempotencyKey, I as GovernedActionAttemptV1, L as GovernedActionAuthorizationDigest, M as governedActionAuthorizationMatchesTransition, Mt as ReadPluginEntityRequestV1, N as governedActionAuthorizationMismatches, Nt as ReadPluginEntityResultV1, P as governedActionPermissionGrants, Pt as AuthorizedShareGrant, R as GovernedActionAuthorizationV1, S as GovernedActionTransitionDigest, St as NormalizedPluginEventV1, T as GovernedActionUnknownOutcome, U as GovernedActionEvidenceSet, V as GovernedActionEnvelopeV1, W as GovernedActionEvidenceSetDigest, X as GovernedActionPolicyEvaluationDigest, Y as GovernedActionPolicyDigest, Z as GovernedActionPolicyEvaluationV1, a as ReleaseReadinessCandidateMaterial, at as PluginActionCancellationResultV1, b as GovernedActionTransitionCause, bt as DiffInventoryPageRequestV1, c as normalizeReadinessRuleMaterial, ct as PluginActionPreflightV1, d as PluginDiscoveryV1, dt as PluginActionReconciliationRequestV1, f as GovernedActionLifecycleHeadV1, ft as PluginActionReconciliationResultV1, g as GovernedActionCommandId, gt as ProposePluginActionRequestV1, h as GovernedActionCommandDigest, i as ReadinessRuleMaterial, it as PluginActionCancellationRequestV1, j as governedActionAuthorityMismatches, jt as PluginSyncRequestV1, l as normalizeReleaseReadinessCandidateMaterial, lt as PluginActionProposalV1, m as advanceGovernedActionLifecycle, n as summarizeEnvironmentReadiness, ot as PluginActionDispatchResultV1, p as GovernedActionProviderLineage, pt as PluginProviderOperationId, r as EnvironmentReadinessCandidateMaterial, s as normalizeEnvironmentReadinessCandidateMaterial, st as PluginActionPayloadDigest, tt as AuthorizedPluginActionV1, ut as PluginActionReconciliationKey, vt as DiffContentRangeRequestV1, w as GovernedActionTransitionV1, x as GovernedActionTransitionCommand, xt as DiffInventoryPageV1, y as GovernedActionState, yt as DiffContentRangeV1, z as GovernedActionEnvelopeDigest } from "./readiness-
|
|
1
|
+
import { An as ReadinessVerdict, Ar as GovernedActionAuthorizationId, Br as RelationshipRepairProposalId, Cr as EntityId, D as DeliveryEntityStatusGroup, Dr as EvidenceId, E as DeliveryEntityService, En as ReadinessRuleVersion, Er as EvidenceClaimId, F as EvidenceValue, Fr as PersonId, Gr as ShareId, Gt as RoleAssignment, Hr as ReleaseId, Ht as PersonAvatar, Ir as PluginConnectionId, Kr as WorkspaceId, Lr as ProviderAccountId, Lt as Actor, M as EvidenceItem, Mr as GovernedActionTransitionId, Nr as GraphNodeId, O as DeliveryNode, Or as FollowedResourceId, Pr as JobId, R as LedgerRevision, Rr as ReadinessAssessmentId, S as RelationshipRepairReviewDecision, Sr as DomainEventId, T as DeliveryEntityProjection, Tr as EventCursor, Ur as RoleAssignmentId, Ut as PersonSourceIdentity, V as RelationshipEndpointKind, Vr as RelationshipRepairReviewId, Vt as Person, Wr as SessionId, Wt as Role, Yt as EnvironmentReadinessAssessment, _ as RelationshipRepairDisposition, _r as SourceUrl, a as PortfolioInvalidatedPayloadV1, an as ReadinessAssessment, ar as MaximumPluginPayloadBytes, b as RelationshipRepairRationale, br as AgentId, bt as SemanticVersion, cn as ReadinessDerivationVersion, cr as hasMaximumPluginJsonBytes, dr as PluginHealth, g as RelationshipRepairApplication, gr as SourceRevision, hr as Revision$1, ht as PluginCapabilityId, i as PortfolioInvalidatedEventV1, in as ReadinessArtifactRevision, j as EvidenceClaim, jn as ReleaseReadinessAssessment, jr as GovernedActionId, k as DeliveryRelationship, kr as GovernedActionAttemptId, lr as Freshness, mr as ProviderId, mt as NegotiatedPluginDescriptorV1, n as DomainEventMetadataV1, on as ReadinessCandidateDigest, pr as NormalizationSchemaVersion, qt as derivePersonInitials, rt as NormalizedIssueAttributes, s as TimelineActorKind, t as DomainEventCorrelationId, v as RelationshipRepairProposal, vr as VendorImmutableId, vt as PluginDescriptorV1, w as DeliveryEntityKind, wn as ReadinessRuleId, wr as EnvironmentId, x as RelationshipRepairReview, xr as AgentThreadId, xt as Release, y as RelationshipRepairProposalOrigin, yr as UtcTimestamp, zr as RelationshipId } from "./domainEvent-CZLKMqgn.js";
|
|
2
|
+
import { At as PluginSyncPageV1, B as GovernedActionEnvelopeMaterialV1, F as GovernedActionAttemptDigest, G as GovernedActionIdempotencyKey, I as GovernedActionAttemptV1, L as GovernedActionAuthorizationDigest, M as governedActionAuthorizationMatchesTransition, Mt as ReadPluginEntityRequestV1, N as governedActionAuthorizationMismatches, Nt as ReadPluginEntityResultV1, P as governedActionPermissionGrants, Pt as AuthorizedShareGrant, R as GovernedActionAuthorizationV1, S as GovernedActionTransitionDigest, St as NormalizedPluginEventV1, T as GovernedActionUnknownOutcome, U as GovernedActionEvidenceSet, V as GovernedActionEnvelopeV1, W as GovernedActionEvidenceSetDigest, X as GovernedActionPolicyEvaluationDigest, Y as GovernedActionPolicyDigest, Z as GovernedActionPolicyEvaluationV1, a as ReleaseReadinessCandidateMaterial, at as PluginActionCancellationResultV1, b as GovernedActionTransitionCause, bt as DiffInventoryPageRequestV1, c as normalizeReadinessRuleMaterial, ct as PluginActionPreflightV1, d as PluginDiscoveryV1, dt as PluginActionReconciliationRequestV1, f as GovernedActionLifecycleHeadV1, ft as PluginActionReconciliationResultV1, g as GovernedActionCommandId, gt as ProposePluginActionRequestV1, h as GovernedActionCommandDigest, i as ReadinessRuleMaterial, it as PluginActionCancellationRequestV1, j as governedActionAuthorityMismatches, jt as PluginSyncRequestV1, l as normalizeReleaseReadinessCandidateMaterial, lt as PluginActionProposalV1, m as advanceGovernedActionLifecycle, n as summarizeEnvironmentReadiness, ot as PluginActionDispatchResultV1, p as GovernedActionProviderLineage, pt as PluginProviderOperationId, r as EnvironmentReadinessCandidateMaterial, s as normalizeEnvironmentReadinessCandidateMaterial, st as PluginActionPayloadDigest, tt as AuthorizedPluginActionV1, ut as PluginActionReconciliationKey, vt as DiffContentRangeRequestV1, w as GovernedActionTransitionV1, x as GovernedActionTransitionCommand, xt as DiffInventoryPageV1, y as GovernedActionState, yt as DiffContentRangeV1, z as GovernedActionEnvelopeDigest } from "./readiness-CZBkcjLP.js";
|
|
3
3
|
import { AgentContextFingerprint, AgentProviderError, AgentProviderId, AgentRuntimeEvent, AgentSessionRef } from "@knpkv/ai-runtime";
|
|
4
4
|
import * as Schema$1 from "effect/Schema";
|
|
5
5
|
import { Cause, Context, Crypto, Effect, FileSystem, Layer, Option, Path, Predicate, Result, Schema, Semaphore, Stream } from "effect";
|
|
@@ -5053,6 +5053,25 @@ var makeDeliveryGraphReader = Effect$1.gen(function* () {
|
|
|
5053
5053
|
const statusText = sql`CASE ${entityType}
|
|
5054
5054
|
WHEN 'issue' THEN ${rawStatusText}
|
|
5055
5055
|
ELSE replace(${rawStatusText}, '-', ' ')
|
|
5056
|
+
END`;
|
|
5057
|
+
const pullRequestReviewText = sql`replace(lower(COALESCE(
|
|
5058
|
+
json_extract(projection.extension_json, '$.reviewState'),
|
|
5059
|
+
''
|
|
5060
|
+
)), '-', ' ')`;
|
|
5061
|
+
const pullRequestLifecycleText = sql`lower(COALESCE(
|
|
5062
|
+
json_extract(projection.extension_json, '$.lifecycle'),
|
|
5063
|
+
''
|
|
5064
|
+
))`;
|
|
5065
|
+
const pullRequestSearchStatusText = sql`trim(
|
|
5066
|
+
CASE ${pullRequestReviewText}
|
|
5067
|
+
WHEN 'not requested' THEN 'review not requested'
|
|
5068
|
+
WHEN 'requested' THEN 'review requested'
|
|
5069
|
+
ELSE ${pullRequestReviewText}
|
|
5070
|
+
END || ' ' || ${pullRequestLifecycleText}
|
|
5071
|
+
)`;
|
|
5072
|
+
const searchStatusText = sql`CASE ${entityType}
|
|
5073
|
+
WHEN 'pull-request' THEN ${pullRequestSearchStatusText}
|
|
5074
|
+
ELSE ${statusText}
|
|
5056
5075
|
END`;
|
|
5057
5076
|
const statusGroup = sql`CASE ${entityType}
|
|
5058
5077
|
WHEN 'issue' THEN CASE
|
|
@@ -5061,8 +5080,9 @@ var makeDeliveryGraphReader = Effect$1.gen(function* () {
|
|
|
5061
5080
|
ELSE 'active'
|
|
5062
5081
|
END
|
|
5063
5082
|
WHEN 'pull-request' THEN CASE
|
|
5064
|
-
WHEN ${
|
|
5065
|
-
WHEN ${
|
|
5083
|
+
WHEN ${pullRequestReviewText} = 'changes requested' THEN 'failed'
|
|
5084
|
+
WHEN ${pullRequestReviewText} IN ('approved', 'merged') THEN 'done'
|
|
5085
|
+
WHEN ${pullRequestLifecycleText} IN ('closed', 'merged') THEN 'done'
|
|
5066
5086
|
ELSE 'active'
|
|
5067
5087
|
END
|
|
5068
5088
|
WHEN 'page' THEN CASE
|
|
@@ -5097,7 +5117,7 @@ var makeDeliveryGraphReader = Effect$1.gen(function* () {
|
|
|
5097
5117
|
AND newer.projection_revision > projection.projection_revision
|
|
5098
5118
|
)`;
|
|
5099
5119
|
const matchesFilters = sql`(${query.query} IS NULL OR instr(
|
|
5100
|
-
lower(projection.display_key || ' ' || projection.title || ' ' || ${
|
|
5120
|
+
lower(projection.display_key || ' ' || projection.title || ' ' || ${searchStatusText}),
|
|
5101
5121
|
lower(${query.query})
|
|
5102
5122
|
) > 0)
|
|
5103
5123
|
AND (${query.service} IS NULL OR ${service} = ${query.service})
|
|
@@ -15460,4 +15480,4 @@ var appendPortfolioInvalidation = Effect$1.fn("PortfolioInvalidation.append")(fu
|
|
|
15460
15480
|
//#endregion
|
|
15461
15481
|
export { PluginOutageFailure as $, SecretReferenceScopeConflictError as $n, BlobUnexpectedEofError as $t, PluginAdministration as A, BlobClassification as An, AgentAttemptSequence as At, ReadinessDigestError as B, PersistenceConfig as Bn, AppendAgentEventInput as Bt, ApplicationRateLimited as C, ReleaseSnapshotRecord as Cn, makeDeliveryGraphDecoders as Ct, DeliveryGraphInspection as D, WorkspaceName as Dn, decodeRows$1 as Dt, AuthorizedShares as E, VendorResourceId as En, ProjectionRow as Et, TimelineExportAudits as F, validateExistingControlCenterDatabase as Fn, AgentJobState as Ft, hasPluginCapability as G, PersistenceConfigError as Gn, MAXIMUM_AGENT_JOB_PROMPT_LENGTH as Gt, digestReadinessRule as H, ContentMetadataMismatchError as Hn, ClaimedAgentJob as Ht, TimelineReads as I, CURRENT_SCHEMA_VERSION as In, AgentLeaseOwner as It, PluginAuthorizationFailure as J, QuarantineWriteError as Jn, BlobIntegrityError as Jt, negotiatePluginDescriptorV1 as K, PersistenceOperationError as Kn, MAXIMUM_AGENT_THREAD_EVENT_PAGE_SIZE as Kt, Persistence as L, validateCurrentSchema as Ln, AgentLeaseToken as Lt, RelationshipRepairProposals as M, readChanges as Mn, AgentEventCursor as Mt, ReleaseAgentJobs as N, Database as Nn, AgentJobInputError as Nt, LiveEvents as O, WorkspaceRecord as On, DeliveryGraphWriteBatch as Ot, ReleaseAgentTurns as P, databaseLayer as Pn, AgentJobPrompt as Pt, PluginMalformedResponseFailure as Q, RevisionConflictError as Qn, BlobTooLargeError as Qt, persistenceLayer as R, BlobRoot as Rn, AgentThreadEvent as Rt, ApplicationInvalidRequest as S, RecordRevision as Sn, GovernedActionCommitInput as St, ApplicationServiceUnavailable as T, VendorAccountId as Tn, EvidenceRow as Tt, digestReleaseReadinessCandidate as U, DatabaseInitializationError as Un, EnqueueAgentJobInput as Ut, digestEnvironmentReadinessCandidate as V, decodePersistenceConfig as Vn, ClaimAgentJobInput as Vt, HOST_PLUGIN_CAPABILITY_VERSIONS as W, PersistedRecordError as Wn, MAXIMUM_AGENT_ATTEMPT_OUTPUT_BYTES as Wt, PluginConfigurationFailure as X, RecordNotFoundError as Xn, BlobStoreInputError as Xt, PluginCancellationFailure as Y, RecordAlreadyExistsError as Yn, BlobNotFoundError as Yt, PluginConflictFailure as Z, ReproducibleContentUnavailableError as Zn, BlobStoreIoError as Zt, retryPluginStream as _, ProviderFamilyMatchesProvider as _n, digestGovernedActionPolicyEvaluation as _t, JiraReadPluginConfiguration as a, ContentBlobMetadata as an, BackupSqlError as ar, PluginPageId as at, pluginCapabilityCodecsV1 as b, QuarantineRecordKind as bn, encodeGovernedActionUnknownOutcome as bt, makeJiraReadPluginRuntimeFromProvider as c, EntityRecord as cn, BlobDigest as cr, StoredPluginConfiguration as ct, definePluginV1 as d, PersonRecord as dn, makeGovernedActionTransaction as dt, blobPath as en, SourceIdentityMismatchError as er, PluginRateLimitFailure as et, PLUGIN_OPERATION_MAX_ATTEMPTS as f, PluginConnectionDisplayName as fn, GovernedActionDigestError as ft, retryPluginOperation as g, ProviderFamily as gn, digestGovernedActionPolicyDefinition as gt, isPluginFailureRetryable as h, ProviderAccountRecord as hn, digestGovernedActionEvidenceSet as ht, supportsFirstPartySynchronization as i, ContentBlobDigest as in, BackupManifestError as ir, pluginFailureClass as it, PortfolioSnapshots as j, mapPersistenceOperation as jn, AgentContextSnapshotRecord as jt, MediaReads as k, providerFamilyForProvider as kn, AgentJobRepository as kt, buildPluginDefinitionLayer as l, FollowedResourceDisplayName as ln, StoredPluginConfigurationKey as lt, PLUGIN_RETRY_MAX_DELAY_MILLIS as m, ProviderAccountDisplayName as mn, digestCanonicalGovernedActionJson as mt, DomainEventWakeups as n, makePersistedRowQuarantine as nn, BackupIntegrityError as nr, PluginUnknownOutcomeFailure as nt, jiraReadPluginDescriptor as o, ContentBlobStorageClass as on, BackupStorageError as or, PluginRecordKey as ot, PLUGIN_RETRY_BASE_DELAY_MILLIS as p, PluginConnectionRecord as pn, canonicalizeGovernedActionJson as pt, PluginAuthenticationFailure as q, PluginConnectionLimitError as qn, BlobContainmentError as qt, firstPartySyncStreamKey as r, QuarantineRepository as rn, BackupLimitError as rr, PluginUnsupportedCapabilityFailure as rt, makeJiraReadPluginRuntime as s, EntityKind as sn, SchemaWriteBarrierError as sr, PluginStreamKey as st, appendPortfolioInvalidation as t, SecretRef as tn, BackupInputError as tr, PluginTimeoutFailure as tt, buildPluginDefinitionLayerFromNegotiatedDescriptor as u, FollowedResourceRecord as un, makeGovernedActionTransactionWrite as ut, PluginConnection as v, QuarantineDiagnosticSummary as vn, digestGovernedActionTransitionCommand as vt, ApplicationResourceNotFound as w, RoleAssignmentRecord as wn, ClaimRow as wt, ApplicationConflict as x, QuarantinedRecordMetadata as xn, verifyGovernedActionEnvelope as xt, AuthorizedPluginExecutor as y, QuarantineReasonCode as yn, encodeGovernedActionDispatchOutcome as yt, persistenceLayerFromDatabase as z, LocalDatabaseUrl as zn, AgentThreadEventPageSize as zt };
|
|
15462
15482
|
|
|
15463
|
-
//# sourceMappingURL=portfolioInvalidation-
|
|
15483
|
+
//# sourceMappingURL=portfolioInvalidation-iTUo5N4r.js.map
|