@wildo-ai/platform-config-lib 1.1.15 → 1.1.17

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.
Files changed (43) hide show
  1. package/dist/esm/index.d.ts +1 -0
  2. package/dist/esm/index.d.ts.map +1 -1
  3. package/dist/esm/index.js +1 -0
  4. package/dist/esm/index.js.map +1 -1
  5. package/dist/esm/lockfile/materialize-infra-section.js +1 -1
  6. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  7. package/dist/esm/project-config/provider-companion-discovery.d.ts +45 -0
  8. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  9. package/dist/esm/project-config/provider-companion-discovery.js +77 -6
  10. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  11. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  12. package/dist/esm/project-config/provider-runtime-artifacts.js +25 -1
  13. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  14. package/dist/esm/project-config/shared/backing-service-servability.js +1 -1
  15. package/dist/esm/project-config/shared/backing-service-servability.js.map +1 -1
  16. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +5 -5
  17. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  18. package/dist/esm/project-config/shared/backing-services.schemas.js +13 -12
  19. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  20. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +7 -6
  21. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  22. package/dist/esm/project-config/shared/infra-providers.schemas.js +5 -4
  23. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  24. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +3 -1
  25. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
  26. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +3 -1
  27. package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
  28. package/dist/esm/project-config/shared/object-storage-seaweedfs.d.ts +131 -0
  29. package/dist/esm/project-config/shared/object-storage-seaweedfs.d.ts.map +1 -0
  30. package/dist/esm/project-config/shared/object-storage-seaweedfs.js +219 -0
  31. package/dist/esm/project-config/shared/object-storage-seaweedfs.js.map +1 -0
  32. package/dist/esm/project-config/shared/platform-storage.schemas.js +4 -4
  33. package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -1
  34. package/dist/esm/registry/module-artifact.schemas.d.ts +1 -0
  35. package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -1
  36. package/dist/esm/registry/module-artifact.schemas.js +7 -0
  37. package/dist/esm/registry/module-artifact.schemas.js.map +1 -1
  38. package/dist/esm/registry/module-manifest.schemas.d.ts +4 -3
  39. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  40. package/dist/esm/registry/module-manifest.schemas.js +4 -3
  41. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  42. package/dist/tsconfig.build.tsbuildinfo +1 -1
  43. package/package.json +7 -7
@@ -42,6 +42,7 @@ export * from './bootstrap/runtime-platform-access';
42
42
  export * from './project-config/minion-local-provider-registration';
43
43
  export * from './project-config/shared/minion-resource-access.validation';
44
44
  export * from './project-config/shared/object-storage-session-policy';
45
+ export * from './project-config/shared/object-storage-seaweedfs';
45
46
  export * from './lockfile/wildo-saas-lock.shared.schemas';
46
47
  export * from './lockfile/lockfile-io';
47
48
  export * from './lockfile/file-lock-hold';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4CAA4C,CAAC;AAE3D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CA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DAAqD,CAAC;AACpE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,uDAAuD,CAAC;AACtE,cAAc,kDAAkD,CAAC;AACjE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yCAAyC,CAAC;AACxD,cAAc,YAAY,CAAC;AAC3B,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC"}
package/dist/esm/index.js CHANGED
@@ -42,6 +42,7 @@ export * from './bootstrap/runtime-platform-access.js';
42
42
  export * from './project-config/minion-local-provider-registration.js';
43
43
  export * from './project-config/shared/minion-resource-access.validation.js';
44
44
  export * from './project-config/shared/object-storage-session-policy.js';
45
+ export * from './project-config/shared/object-storage-seaweedfs.js';
45
46
  export * from './lockfile/wildo-saas-lock.shared.schemas.js';
46
47
  export * from './lockfile/lockfile-io.js';
47
48
  export * from './lockfile/file-lock-hold.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4CAA4C,CAAC;AAE3D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kDAAkD,CAAC;AACjE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,6DAA6D,CAAC;AAC5E,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,yDAAyD,CAAC;AACxE,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,6DAA6D,CAAC;AAC5E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qDAAqD,CAAC;AACpE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,uDAAuD,CAAC;AACtE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yCAAyC,CAAC;AACxD,cAAc,YAAY,CAAC;AAC3B,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC","sourcesContent":["export * from './project-config';\nexport * from './workspace-scope';\nexport * from './credentials/credential-generator.service';\n\nexport * from './schemas/platform-application-config.schemas';\nexport * from './schemas/platform-application-secrets.schemas';\nexport * from './schemas/platform-config.schemas';\nexport * from './schemas/framework-info.schemas';\nexport * from './schemas/framework-secrets.schemas';\nexport * from './release/framework-release.constants';\nexport * from './bootstrap/bootstrap.schemas';\nexport * from './bootstrap/bootstrap.contracts';\nexport * from './bootstrap/application-scheduled-jobs.contracts';\nexport * from './bootstrap/bootstrap-planner';\nexport * from './bootstrap/application-backend-env.contracts';\nexport * from './bootstrap/wildo-owner-organization.contracts';\nexport * from './bootstrap/application-creation-verification-env.contracts';\nexport * from './bootstrap/platform-runtime-env.contracts';\nexport * from './bootstrap/runtime-secret-env.contracts';\nexport * from './bootstrap/runtime-topology.contracts';\nexport * from './bootstrap/runtime-principal.contracts';\nexport * from './bootstrap/postgresql-owed-grants.contracts';\nexport * from './bootstrap/minion-database-queue-confinement.contracts';\nexport * from './bootstrap/runtime-response-integrity';\nexport * from './key-management/es256-jws';\nexport * from './key-management/data-key.contracts';\nexport * from './key-management/key-provider.spi';\nexport * from './key-management/application-signing-key-rotation.contracts';\nexport * from './key-management/application-legacy-envelope-key.contracts';\nexport * from './key-management/keyring-rotation.contracts';\nexport * from './key-management/keyring-status.contracts';\nexport * from './key-management/signature-request.contracts';\nexport * from './key-management/approval-seal.contracts';\nexport * from './key-management/approval-seal-verifier';\nexport * from './key-management/approval-seal-manifested-copy';\nexport * from './key-management/signing-log-export.contracts';\nexport * from './key-management/vault-custody.contracts';\nexport * from './bootstrap/runtime-backing-service-access';\nexport * from './bootstrap/platform-store-preconnect';\nexport * from './bootstrap/runtime-network-topology';\nexport * from './bootstrap/runtime-network-policy';\nexport * from './bootstrap/runtime-platform-access';\nexport * from './project-config/minion-local-provider-registration';\nexport * from './project-config/shared/minion-resource-access.validation';\nexport * from './project-config/shared/object-storage-session-policy';\nexport * from './lockfile/wildo-saas-lock.shared.schemas';\nexport * from './lockfile/lockfile-io';\nexport * from './lockfile/file-lock-hold';\nexport * from './lockfile/build-parallelism';\nexport * from './lockfile/materialize-infra-section';\nexport * from './lockfile/canonical-json';\nexport * from './canonical-json/rfc8785-canonical-json';\nexport * from './registry';\nexport * from './pnpm-settings/application-pnpm-settings';\nexport * from './blueprint/blueprint.schemas';\nexport * from './blueprint/anchored-region';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4CAA4C,CAAC;AAE3D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,kDAAkD,CAAC;AACjE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,6DAA6D,CAAC;AAC5E,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,yDAAyD,CAAC;AACxE,cAAc,wCAAwC,CAAC;AACvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,6DAA6D,CAAC;AAC5E,cAAc,4DAA4D,CAAC;AAC3E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qDAAqD,CAAC;AACpE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,uDAAuD,CAAC;AACtE,cAAc,kDAAkD,CAAC;AACjE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yCAAyC,CAAC;AACxD,cAAc,YAAY,CAAC;AAC3B,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC","sourcesContent":["export * from './project-config';\nexport * from './workspace-scope';\nexport * from './credentials/credential-generator.service';\n\nexport * from './schemas/platform-application-config.schemas';\nexport * from './schemas/platform-application-secrets.schemas';\nexport * from './schemas/platform-config.schemas';\nexport * from './schemas/framework-info.schemas';\nexport * from './schemas/framework-secrets.schemas';\nexport * from './release/framework-release.constants';\nexport * from './bootstrap/bootstrap.schemas';\nexport * from './bootstrap/bootstrap.contracts';\nexport * from './bootstrap/application-scheduled-jobs.contracts';\nexport * from './bootstrap/bootstrap-planner';\nexport * from './bootstrap/application-backend-env.contracts';\nexport * from './bootstrap/wildo-owner-organization.contracts';\nexport * from './bootstrap/application-creation-verification-env.contracts';\nexport * from './bootstrap/platform-runtime-env.contracts';\nexport * from './bootstrap/runtime-secret-env.contracts';\nexport * from './bootstrap/runtime-topology.contracts';\nexport * from './bootstrap/runtime-principal.contracts';\nexport * from './bootstrap/postgresql-owed-grants.contracts';\nexport * from './bootstrap/minion-database-queue-confinement.contracts';\nexport * from './bootstrap/runtime-response-integrity';\nexport * from './key-management/es256-jws';\nexport * from './key-management/data-key.contracts';\nexport * from './key-management/key-provider.spi';\nexport * from './key-management/application-signing-key-rotation.contracts';\nexport * from './key-management/application-legacy-envelope-key.contracts';\nexport * from './key-management/keyring-rotation.contracts';\nexport * from './key-management/keyring-status.contracts';\nexport * from './key-management/signature-request.contracts';\nexport * from './key-management/approval-seal.contracts';\nexport * from './key-management/approval-seal-verifier';\nexport * from './key-management/approval-seal-manifested-copy';\nexport * from './key-management/signing-log-export.contracts';\nexport * from './key-management/vault-custody.contracts';\nexport * from './bootstrap/runtime-backing-service-access';\nexport * from './bootstrap/platform-store-preconnect';\nexport * from './bootstrap/runtime-network-topology';\nexport * from './bootstrap/runtime-network-policy';\nexport * from './bootstrap/runtime-platform-access';\nexport * from './project-config/minion-local-provider-registration';\nexport * from './project-config/shared/minion-resource-access.validation';\nexport * from './project-config/shared/object-storage-session-policy';\nexport * from './project-config/shared/object-storage-seaweedfs';\nexport * from './lockfile/wildo-saas-lock.shared.schemas';\nexport * from './lockfile/lockfile-io';\nexport * from './lockfile/file-lock-hold';\nexport * from './lockfile/build-parallelism';\nexport * from './lockfile/materialize-infra-section';\nexport * from './lockfile/canonical-json';\nexport * from './canonical-json/rfc8785-canonical-json';\nexport * from './registry';\nexport * from './pnpm-settings/application-pnpm-settings';\nexport * from './blueprint/blueprint.schemas';\nexport * from './blueprint/anchored-region';\n"]}
@@ -78,7 +78,7 @@ function projectBackingServicesToCapabilities(backingServices, materializedAt, e
78
78
  if (!entry)
79
79
  continue;
80
80
  const capability = BackingServiceKindToInfraCapability[kind];
81
- // Some kinds carry an additional `provider` brand (e.g. S3 = minio | aws);
81
+ // Some kinds carry an additional `provider` brand (e.g. S3 = seaweedfs | aws);
82
82
  // others don't. The cast lifts to a permissive shape since
83
83
  // `BackingServiceEnvConfig` is a discriminated union and the brand only
84
84
  // exists on some variants.
@@ -1 +1 @@
1
- {"version":3,"file":"materialize-infra-section.js","sourceRoot":"","sources":["../../../src/lockfile/materialize-infra-section.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EACL,kBAAkB,EAClB,mCAAmC,EACnC,oBAAoB,GAGrB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,s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,CAAC;AACtB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,0BAA0B,CAAC,KAA8B;IAChE,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAS,uBAAuB,CAC9B,QAAuB,EACvB,IAAwB,EACxB,KAA8B,EAC9B,eAAuB,EACvB,OAAe,EACf,SAAsE;IAEtE,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,eAAe,GAAiC;QACpD,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,SAAS,EAAE,uDAAuD;QAC3E,iBAAiB,EAAE,IAAI;QACvB,MAAM,EAAE,KAAK;KACd,CAAC;IACF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAClD,OAAO,kBAAkB,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * `materializeInfraSection` — pure function that projects authored\n * `wildo.infra.<envName>.config.ts` files into the\n * `sections.infra` slice of `wildo-saas.lock.json`.\n *\n * Lives in `platform-config-lib` (no runtime, no DI, no I/O — pure\n * projection). The CLI-side caller is responsible for loading the\n * authored configs from disk via\n * `loadInfraEnvConfig` (this package; the CLI's `loadAuthoredInfraEnvConfig` delegates to it) and passing\n * the parsed `backingServices` slice plus the env name.\n *\n * **Module-planned digests (2026-05-10)**: when the caller supplies an optional\n * `moduleMap` of `InfraProvider → InfraProviderModule`, the digest\n * is computed from `module.plan(planningContext)` instead of from\n * the authored entry. This captures **provider-version drift**\n * (e.g., a module change to plumbing port, secret env vars,\n * per-app blob paths) on top of authored-config drift. When the\n * map is omitted, the digest is computed from the authored entry.\n * When the map IS supplied but doesn't contain a module for the\n * resolved `InfraProvider`, the materializer falls back to the\n * authored-entry digest for that capability. After #1693 that can only\n * happen for a provider the catalogue declares servable WITHOUT a module\n * (`OPERATOR_CREDENTIALED_INFRA_PROVIDERS`, empty since #1696 gave\n * `IMMUDB_SELF` its module): every other module-less provider is refused\n * before any digest is computed.\n *\n * **#1693 (2026-09-26)**: the materializer REFUSES any declaration the\n * platform cannot serve — one that resolves to no `InfraProvider`, or to\n * one outside the `servableProviders` set the caller must supply. It used\n * to skip the first silently and hash the second, so the lockfile either\n * omitted a declared kind or recorded a selection nothing executes. Both\n * of its callers (`wildo config sync`, `wildo lock check`) reach the one\n * check here, so the two projections cannot disagree about what is\n * refused. See `backing-service-servability.ts`.\n *\n * **Nested-reorder fix (2026-05-07)**: digest computation uses\n * `stableSha256Digest` (recursive sorted-keys serialization via\n * `canonical-json.ts`) so nested-object property reorders don't\n * spuriously trigger drift.\n */\n\nimport {\n BackingServiceKind,\n BackingServiceKindToInfraCapability,\n resolveInfraProvider,\n type BackingServiceEnvConfig,\n type BackingServicesEnvConfig,\n} from '../project-config/shared/backing-services.schemas';\nimport { assertBackingServiceDeclarationsServable } from '../project-config/shared/backing-service-servability';\nimport type {\n InfraProvider,\n InfraProviderModule,\n InfraProviderPlanningContext,\n} from '../project-config/shared/infra-providers.schemas';\nimport type {\n SaasLockfileInfraEnvironment,\n SaasLockfileInfraSection,\n} from './wildo-saas-lock.shared.schemas';\nimport { stableSha256Digest } from './canonical-json';\n\n/**\n * Per-env input for the materializer. The caller has already loaded\n * the authored `wildo.infra.<envName>.config.ts` and parsed it via\n * `defineInfraEnvConfig`; we only consume the `backingServices`\n * slice (the only authored surface that maps to `InfraCapability`\n * selections).\n */\nexport interface InfraEnvSelectionInput {\n envName: string;\n backingServices: BackingServicesEnvConfig | undefined;\n}\n\nexport interface MaterializeInfraSectionOptions {\n envs: ReadonlyArray<InfraEnvSelectionInput>;\n /**\n * ISO-8601 instant of THIS materialization, used as the selection time\n * for NEWLY-selected or CHANGED capabilities (see `previousSection` for\n * the sticky-reuse rule). Caller controls it so multi-env writes share\n * one deterministic timestamp (matches the pattern from\n * `materializeSaasProviderRuntimeArtifacts`). It is not written anywhere\n * else: the lockfile envelope carries no timestamp (#1765).\n */\n materializedAt: string;\n /**\n * Optional `InfraProvider → InfraProviderModule` lookup. When\n * present, each capability's `planContributionDigest` is computed\n * from `module.plan(planningContext)` (richer — captures\n * provider-version drift) instead of from the authored entry\n * (the default when the map is omitted).\n *\n * The CLI-side caller in `provider-runtime-sync.service.ts`\n * builds this from `@wildo-ai/platform-infra-providers`'s\n * `buildInfraProviderModuleMap()`. Apps-manager-side callers\n * (none today) would do the same.\n *\n * **Module-less providers**: a resolved provider with no entry here\n * falls back to the authored-entry digest. Only a provider in\n * `servableProviders` can reach that point, so the fallback covers\n * exactly the catalogue's explicit module-less exemptions.\n */\n moduleMap?: ReadonlyMap<InfraProvider, InfraProviderModule>;\n /**\n * The providers the platform can actually SERVE — from\n * `collectServableInfraProviders()` in `@wildo-ai/platform-infra-providers`.\n * REQUIRED, not optional: a caller that could omit it would be a\n * projection that skips the refusal, and the whole point is that\n * `wildo config sync` and `wildo lock check` refuse the same\n * declarations (#1693).\n */\n servableProviders: ReadonlySet<InfraProvider>;\n /**\n * The previous lockfile's `sections.infra` (when present). Threaded\n * so `providerSelectedAt` is STICKY: a capability whose resolved\n * `provider` is unchanged retains its prior `providerSelectedAt`\n * instead of being re-stamped with `materializedAt`. Only a newly-\n * selected capability or a provider CHANGE stamps a fresh\n * `materializedAt`.\n *\n * **Why this exists**: `materializedAt` is a fresh clock reading on\n * every run of `wildo config sync` and `wildo lock check`. Deriving\n * `providerSelectedAt` directly from it made the field drift on every\n * run, so the committed lockfile changed with no selection changing and\n * `wildo lock check` reported phantom infra drift. (It was originally\n * the lockfile envelope's own `generatedAt`, re-stamped by every write;\n * that field is gone, the stickiness is still what keeps a re-run from\n * changing the file.)\n * Both callers — the `wildo config sync` writer and the\n * `wildo lock check` drift-checker — MUST pass the same previous\n * section so their projections agree.\n */\n previousSection?: SaasLockfileInfraSection;\n}\n\n/**\n * Project authored infra envs into the lockfile `sections.infra`\n * shape. Returns `undefined` when there are no envs to record (so\n * the lockfile writer can skip emitting the section entirely\n * instead of writing an empty `{ environments: {} }`).\n */\nexport function materializeInfraSection(\n options: MaterializeInfraSectionOptions,\n): SaasLockfileInfraSection | undefined {\n if (options.envs.length === 0) return undefined;\n\n // Refuse every unservable declaration, across every environment, before projecting any of them.\n assertBackingServiceDeclarationsServable({ envs: options.envs, servableProviders: options.servableProviders });\n\n const environments: SaasLockfileInfraSection['environments'] = {};\n let recordedAny = false;\n\n for (const env of options.envs) {\n const capabilities = projectBackingServicesToCapabilities(\n env.backingServices,\n options.materializedAt,\n env.envName,\n options.moduleMap,\n options.previousSection?.environments[env.envName],\n );\n if (Object.keys(capabilities).length === 0) continue;\n environments[env.envName] = { capabilities };\n recordedAny = true;\n }\n\n return recordedAny ? { environments } : undefined;\n}\n\nfunction projectBackingServicesToCapabilities(\n backingServices: BackingServicesEnvConfig | undefined,\n materializedAt: string,\n envName: string,\n moduleMap: ReadonlyMap<InfraProvider, InfraProviderModule> | undefined,\n previousEnv: SaasLockfileInfraEnvironment | undefined,\n): SaasLockfileInfraEnvironment['capabilities'] {\n const capabilities: SaasLockfileInfraEnvironment['capabilities'] = {};\n if (!backingServices) return capabilities;\n\n // Iterate via `Object.values(BackingServiceKind)` (Slice 4.A.2 / M7)\n // — avoids an unsafe `kindKey as BackingServiceKind` cast on\n // `Object.entries`'s string keys. `BackingServicesEnvConfigSchema`\n // is `.strict()` so unknown keys can't reach this code path; this\n // tightening just removes the dead defensive guard that came with\n // the cast.\n for (const kind of Object.values(BackingServiceKind)) {\n const entry = backingServices[kind];\n if (!entry) continue;\n const capability = BackingServiceKindToInfraCapability[kind];\n\n // Some kinds carry an additional `provider` brand (e.g. S3 = minio | aws);\n // others don't. The cast lifts to a permissive shape since\n // `BackingServiceEnvConfig` is a discriminated union and the brand only\n // exists on some variants.\n const providerBrand = (entry as BackingServiceEnvConfig & { provider?: string }).provider;\n const provider = resolveInfraProvider(kind, entry.source, providerBrand);\n if (!provider) {\n // Unreachable: `assertBackingServiceDeclarationsServable` has already refused every declaration\n // that resolves to no provider. Kept as a throw rather than a `continue`, because a silent skip\n // here is precisely the defect that assertion closed (#1693).\n throw new Error(`backingServices.${kind} in environment '${envName}' resolved to no provider after the servability check.`);\n }\n\n // Slice 2.5c-1: prefer module.plan() digest when the catalog\n // exposes a module for this provider. Falls back to the\n // authored-entry digest only for a servable provider the catalogue\n // serves without a module (the operator-credentialed exemptions).\n const planContributionDigest =\n computeModulePlanDigest(provider, kind, entry, materializedAt, envName, moduleMap)\n ?? computeAuthoredEntryDigest(entry);\n\n // `providerSelectedAt` is STICKY — only a provider's first\n // selection (or re-selection after a change) is a meaningful moment.\n // Reuse the prior timestamp when the resolved provider is unchanged\n // so a later run's clock never perturbs it (the root cause of\n // phantom `wildo lock check` infra drift). A newly-added capability\n // or a provider change stamps the fresh `materializedAt`.\n const previousEntry = previousEnv?.capabilities[capability];\n const providerSelectedAt =\n previousEntry && previousEntry.provider === provider\n ? previousEntry.providerSelectedAt\n : materializedAt;\n\n capabilities[capability] = {\n provider,\n providerSelectedAt,\n planContributionDigest,\n };\n }\n return capabilities;\n}\n\n/**\n * Stable digest of an authored `BackingServiceEnvConfig` entry.\n * Uses `stableJsonStringify` (recursive sorted-keys serialization)\n * via `stableSha256Digest` so the digest is insensitive to property-\n * order shuffles at ANY nesting level — not just top-level. This\n * matters for entries with nested objects like\n * `MongoBackingService.options: {retryWrites, w, authSource}` where\n * editor saves frequently reorder the nested keys.\n *\n * Slice 4.A.1 / H2 fix: previously this used `JSON.stringify(entry,\n * Object.keys(entry).sort())` which only sorted top-level keys.\n */\nfunction computeAuthoredEntryDigest(entry: BackingServiceEnvConfig): string {\n return stableSha256Digest(entry);\n}\n\n/**\n * Slice 2.5c-1: compute the digest by invoking the module's\n * `plan()` and hashing its contribution. Returns `undefined` when\n * the module map is missing OR doesn't cover the provider — caller\n * falls back to `computeAuthoredEntryDigest`.\n *\n * **Why include the authored entry IN the planning context**: the\n * module may use authored fields (e.g., a future opt-in flag in\n * `RabbitBackingService`) to vary its contribution. Threading the\n * entry through `config` keeps the digest sensitive to authored\n * drift even when the digest source is `module.plan()`.\n *\n * **Why ignore `materializedAt` in the digest**: the timestamp feeds the\n * `providerSelectedAt` field, NOT part of plan-contribution\n * identity. Using it would make every `wildo lock` run produce a\n * different digest — defeats drift detection. We don't pass it to\n * `module.plan()`; we pass it through the surrounding shape only.\n */\nfunction computeModulePlanDigest(\n provider: InfraProvider,\n kind: BackingServiceKind,\n entry: BackingServiceEnvConfig,\n _materializedAt: string,\n envName: string,\n moduleMap: ReadonlyMap<InfraProvider, InfraProviderModule> | undefined,\n): string | undefined {\n if (!moduleMap) return undefined;\n const module = moduleMap.get(provider);\n if (!module) return undefined;\n const planningContext: InfraProviderPlanningContext = {\n environment: envName,\n runtime: 'unknown', // Caller doesn't expose runtime per env at this layer.\n backingServiceKey: kind,\n config: entry,\n };\n const contribution = module.plan(planningContext);\n return stableSha256Digest(contribution);\n}\n"]}
1
+ {"version":3,"file":"materialize-infra-section.js","sourceRoot":"","sources":["../../../src/lockfile/materialize-infra-section.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EACL,kBAAkB,EAClB,mCAAmC,EACnC,oBAAoB,GAGrB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,sDAAsD,CAAC;AAUhH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AA2EtD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAuC;IAEvC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAEhD,gGAAgG;IAChG,wCAAwC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI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AAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,eAAe,GAAiC;QACpD,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,SAAS,EAAE,uDAAuD;QAC3E,iBAAiB,EAAE,IAAI;QACvB,MAAM,EAAE,KAAK;KACd,CAAC;IACF,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAClD,OAAO,kBAAkB,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * `materializeInfraSection` — pure function that projects authored\n * `wildo.infra.<envName>.config.ts` files into the\n * `sections.infra` slice of `wildo-saas.lock.json`.\n *\n * Lives in `platform-config-lib` (no runtime, no DI, no I/O — pure\n * projection). The CLI-side caller is responsible for loading the\n * authored configs from disk via\n * `loadInfraEnvConfig` (this package; the CLI's `loadAuthoredInfraEnvConfig` delegates to it) and passing\n * the parsed `backingServices` slice plus the env name.\n *\n * **Module-planned digests (2026-05-10)**: when the caller supplies an optional\n * `moduleMap` of `InfraProvider → InfraProviderModule`, the digest\n * is computed from `module.plan(planningContext)` instead of from\n * the authored entry. This captures **provider-version drift**\n * (e.g., a module change to plumbing port, secret env vars,\n * per-app blob paths) on top of authored-config drift. When the\n * map is omitted, the digest is computed from the authored entry.\n * When the map IS supplied but doesn't contain a module for the\n * resolved `InfraProvider`, the materializer falls back to the\n * authored-entry digest for that capability. After #1693 that can only\n * happen for a provider the catalogue declares servable WITHOUT a module\n * (`OPERATOR_CREDENTIALED_INFRA_PROVIDERS`, empty since #1696 gave\n * `IMMUDB_SELF` its module): every other module-less provider is refused\n * before any digest is computed.\n *\n * **#1693 (2026-09-26)**: the materializer REFUSES any declaration the\n * platform cannot serve — one that resolves to no `InfraProvider`, or to\n * one outside the `servableProviders` set the caller must supply. It used\n * to skip the first silently and hash the second, so the lockfile either\n * omitted a declared kind or recorded a selection nothing executes. Both\n * of its callers (`wildo config sync`, `wildo lock check`) reach the one\n * check here, so the two projections cannot disagree about what is\n * refused. See `backing-service-servability.ts`.\n *\n * **Nested-reorder fix (2026-05-07)**: digest computation uses\n * `stableSha256Digest` (recursive sorted-keys serialization via\n * `canonical-json.ts`) so nested-object property reorders don't\n * spuriously trigger drift.\n */\n\nimport {\n BackingServiceKind,\n BackingServiceKindToInfraCapability,\n resolveInfraProvider,\n type BackingServiceEnvConfig,\n type BackingServicesEnvConfig,\n} from '../project-config/shared/backing-services.schemas';\nimport { assertBackingServiceDeclarationsServable } from '../project-config/shared/backing-service-servability';\nimport type {\n InfraProvider,\n InfraProviderModule,\n InfraProviderPlanningContext,\n} from '../project-config/shared/infra-providers.schemas';\nimport type {\n SaasLockfileInfraEnvironment,\n SaasLockfileInfraSection,\n} from './wildo-saas-lock.shared.schemas';\nimport { stableSha256Digest } from './canonical-json';\n\n/**\n * Per-env input for the materializer. The caller has already loaded\n * the authored `wildo.infra.<envName>.config.ts` and parsed it via\n * `defineInfraEnvConfig`; we only consume the `backingServices`\n * slice (the only authored surface that maps to `InfraCapability`\n * selections).\n */\nexport interface InfraEnvSelectionInput {\n envName: string;\n backingServices: BackingServicesEnvConfig | undefined;\n}\n\nexport interface MaterializeInfraSectionOptions {\n envs: ReadonlyArray<InfraEnvSelectionInput>;\n /**\n * ISO-8601 instant of THIS materialization, used as the selection time\n * for NEWLY-selected or CHANGED capabilities (see `previousSection` for\n * the sticky-reuse rule). Caller controls it so multi-env writes share\n * one deterministic timestamp (matches the pattern from\n * `materializeSaasProviderRuntimeArtifacts`). It is not written anywhere\n * else: the lockfile envelope carries no timestamp (#1765).\n */\n materializedAt: string;\n /**\n * Optional `InfraProvider → InfraProviderModule` lookup. When\n * present, each capability's `planContributionDigest` is computed\n * from `module.plan(planningContext)` (richer — captures\n * provider-version drift) instead of from the authored entry\n * (the default when the map is omitted).\n *\n * The CLI-side caller in `provider-runtime-sync.service.ts`\n * builds this from `@wildo-ai/platform-infra-providers`'s\n * `buildInfraProviderModuleMap()`. Apps-manager-side callers\n * (none today) would do the same.\n *\n * **Module-less providers**: a resolved provider with no entry here\n * falls back to the authored-entry digest. Only a provider in\n * `servableProviders` can reach that point, so the fallback covers\n * exactly the catalogue's explicit module-less exemptions.\n */\n moduleMap?: ReadonlyMap<InfraProvider, InfraProviderModule>;\n /**\n * The providers the platform can actually SERVE — from\n * `collectServableInfraProviders()` in `@wildo-ai/platform-infra-providers`.\n * REQUIRED, not optional: a caller that could omit it would be a\n * projection that skips the refusal, and the whole point is that\n * `wildo config sync` and `wildo lock check` refuse the same\n * declarations (#1693).\n */\n servableProviders: ReadonlySet<InfraProvider>;\n /**\n * The previous lockfile's `sections.infra` (when present). Threaded\n * so `providerSelectedAt` is STICKY: a capability whose resolved\n * `provider` is unchanged retains its prior `providerSelectedAt`\n * instead of being re-stamped with `materializedAt`. Only a newly-\n * selected capability or a provider CHANGE stamps a fresh\n * `materializedAt`.\n *\n * **Why this exists**: `materializedAt` is a fresh clock reading on\n * every run of `wildo config sync` and `wildo lock check`. Deriving\n * `providerSelectedAt` directly from it made the field drift on every\n * run, so the committed lockfile changed with no selection changing and\n * `wildo lock check` reported phantom infra drift. (It was originally\n * the lockfile envelope's own `generatedAt`, re-stamped by every write;\n * that field is gone, the stickiness is still what keeps a re-run from\n * changing the file.)\n * Both callers — the `wildo config sync` writer and the\n * `wildo lock check` drift-checker — MUST pass the same previous\n * section so their projections agree.\n */\n previousSection?: SaasLockfileInfraSection;\n}\n\n/**\n * Project authored infra envs into the lockfile `sections.infra`\n * shape. Returns `undefined` when there are no envs to record (so\n * the lockfile writer can skip emitting the section entirely\n * instead of writing an empty `{ environments: {} }`).\n */\nexport function materializeInfraSection(\n options: MaterializeInfraSectionOptions,\n): SaasLockfileInfraSection | undefined {\n if (options.envs.length === 0) return undefined;\n\n // Refuse every unservable declaration, across every environment, before projecting any of them.\n assertBackingServiceDeclarationsServable({ envs: options.envs, servableProviders: options.servableProviders });\n\n const environments: SaasLockfileInfraSection['environments'] = {};\n let recordedAny = false;\n\n for (const env of options.envs) {\n const capabilities = projectBackingServicesToCapabilities(\n env.backingServices,\n options.materializedAt,\n env.envName,\n options.moduleMap,\n options.previousSection?.environments[env.envName],\n );\n if (Object.keys(capabilities).length === 0) continue;\n environments[env.envName] = { capabilities };\n recordedAny = true;\n }\n\n return recordedAny ? { environments } : undefined;\n}\n\nfunction projectBackingServicesToCapabilities(\n backingServices: BackingServicesEnvConfig | undefined,\n materializedAt: string,\n envName: string,\n moduleMap: ReadonlyMap<InfraProvider, InfraProviderModule> | undefined,\n previousEnv: SaasLockfileInfraEnvironment | undefined,\n): SaasLockfileInfraEnvironment['capabilities'] {\n const capabilities: SaasLockfileInfraEnvironment['capabilities'] = {};\n if (!backingServices) return capabilities;\n\n // Iterate via `Object.values(BackingServiceKind)` (Slice 4.A.2 / M7)\n // — avoids an unsafe `kindKey as BackingServiceKind` cast on\n // `Object.entries`'s string keys. `BackingServicesEnvConfigSchema`\n // is `.strict()` so unknown keys can't reach this code path; this\n // tightening just removes the dead defensive guard that came with\n // the cast.\n for (const kind of Object.values(BackingServiceKind)) {\n const entry = backingServices[kind];\n if (!entry) continue;\n const capability = BackingServiceKindToInfraCapability[kind];\n\n // Some kinds carry an additional `provider` brand (e.g. S3 = seaweedfs | aws);\n // others don't. The cast lifts to a permissive shape since\n // `BackingServiceEnvConfig` is a discriminated union and the brand only\n // exists on some variants.\n const providerBrand = (entry as BackingServiceEnvConfig & { provider?: string }).provider;\n const provider = resolveInfraProvider(kind, entry.source, providerBrand);\n if (!provider) {\n // Unreachable: `assertBackingServiceDeclarationsServable` has already refused every declaration\n // that resolves to no provider. Kept as a throw rather than a `continue`, because a silent skip\n // here is precisely the defect that assertion closed (#1693).\n throw new Error(`backingServices.${kind} in environment '${envName}' resolved to no provider after the servability check.`);\n }\n\n // Slice 2.5c-1: prefer module.plan() digest when the catalog\n // exposes a module for this provider. Falls back to the\n // authored-entry digest only for a servable provider the catalogue\n // serves without a module (the operator-credentialed exemptions).\n const planContributionDigest =\n computeModulePlanDigest(provider, kind, entry, materializedAt, envName, moduleMap)\n ?? computeAuthoredEntryDigest(entry);\n\n // `providerSelectedAt` is STICKY — only a provider's first\n // selection (or re-selection after a change) is a meaningful moment.\n // Reuse the prior timestamp when the resolved provider is unchanged\n // so a later run's clock never perturbs it (the root cause of\n // phantom `wildo lock check` infra drift). A newly-added capability\n // or a provider change stamps the fresh `materializedAt`.\n const previousEntry = previousEnv?.capabilities[capability];\n const providerSelectedAt =\n previousEntry && previousEntry.provider === provider\n ? previousEntry.providerSelectedAt\n : materializedAt;\n\n capabilities[capability] = {\n provider,\n providerSelectedAt,\n planContributionDigest,\n };\n }\n return capabilities;\n}\n\n/**\n * Stable digest of an authored `BackingServiceEnvConfig` entry.\n * Uses `stableJsonStringify` (recursive sorted-keys serialization)\n * via `stableSha256Digest` so the digest is insensitive to property-\n * order shuffles at ANY nesting level — not just top-level. This\n * matters for entries with nested objects like\n * `MongoBackingService.options: {retryWrites, w, authSource}` where\n * editor saves frequently reorder the nested keys.\n *\n * Slice 4.A.1 / H2 fix: previously this used `JSON.stringify(entry,\n * Object.keys(entry).sort())` which only sorted top-level keys.\n */\nfunction computeAuthoredEntryDigest(entry: BackingServiceEnvConfig): string {\n return stableSha256Digest(entry);\n}\n\n/**\n * Slice 2.5c-1: compute the digest by invoking the module's\n * `plan()` and hashing its contribution. Returns `undefined` when\n * the module map is missing OR doesn't cover the provider — caller\n * falls back to `computeAuthoredEntryDigest`.\n *\n * **Why include the authored entry IN the planning context**: the\n * module may use authored fields (e.g., a future opt-in flag in\n * `RabbitBackingService`) to vary its contribution. Threading the\n * entry through `config` keeps the digest sensitive to authored\n * drift even when the digest source is `module.plan()`.\n *\n * **Why ignore `materializedAt` in the digest**: the timestamp feeds the\n * `providerSelectedAt` field, NOT part of plan-contribution\n * identity. Using it would make every `wildo lock` run produce a\n * different digest — defeats drift detection. We don't pass it to\n * `module.plan()`; we pass it through the surrounding shape only.\n */\nfunction computeModulePlanDigest(\n provider: InfraProvider,\n kind: BackingServiceKind,\n entry: BackingServiceEnvConfig,\n _materializedAt: string,\n envName: string,\n moduleMap: ReadonlyMap<InfraProvider, InfraProviderModule> | undefined,\n): string | undefined {\n if (!moduleMap) return undefined;\n const module = moduleMap.get(provider);\n if (!module) return undefined;\n const planningContext: InfraProviderPlanningContext = {\n environment: envName,\n runtime: 'unknown', // Caller doesn't expose runtime per env at this layer.\n backingServiceKey: kind,\n config: entry,\n };\n const contribution = module.plan(planningContext);\n return stableSha256Digest(contribution);\n}\n"]}
@@ -145,8 +145,28 @@ export interface UnreadableProviderCompanionOwner {
145
145
  readonly packageRoot: string;
146
146
  readonly reason: string;
147
147
  }
148
+ /**
149
+ * A contribution discovery dropped because the provider PACKAGE that owns its module contributes the same ref through
150
+ * the same import path (#4019): a re-statement of one module, never a second claim. See
151
+ * {@link collapseRedeclaredProviderContributions}.
152
+ */
153
+ export interface RedeclaredProviderContribution {
154
+ readonly ref: string;
155
+ readonly runtimeImportPath: string;
156
+ /** The owner whose re-declaration was dropped: a runtime owner's own barrel, or another package. */
157
+ readonly redeclaredBy: ProviderContributionOwner;
158
+ /** The package whose own `./companion` describes the module, and whose contribution stands. */
159
+ readonly ownedBy: ProviderContributionOwner;
160
+ }
148
161
  export interface DiscoverSaasProviderCompanionContributionsResult {
162
+ /** One contribution per module: a re-declaration of a package's own module is dropped ({@link redeclaredContributions}). */
149
163
  contributions: DiscoveredProviderCompanionContribution[];
164
+ /**
165
+ * The re-declarations dropped from {@link contributions} (#4019). EMPTY is the normal state. Reported, never refused:
166
+ * the package and the re-declaration name the same module, so nothing is ambiguous, and `wildo config sync` prints
167
+ * each as an advisory so the redundant declaration can be removed.
168
+ */
169
+ redeclaredContributions: RedeclaredProviderContribution[];
150
170
  /**
151
171
  * Owners whose companion door exists and threw. EMPTY is the normal state.
152
172
  *
@@ -228,6 +248,31 @@ export declare function discoverSaasProviderCompanionContributions(input: {
228
248
  saasRoot: string;
229
249
  saasConfig: Pick<WildoSaasConfig, 'services' | 'libraries' | 'minions' | 'providers' | 'workers'> & Partial<Pick<WildoSaasConfig, 'systemsOfRecord'>>;
230
250
  }): Promise<DiscoverSaasProviderCompanionContributionsResult>;
251
+ /**
252
+ * Which source wins when one provider ref is contributed more than once (#4019): the rule, in one place, for every reader
253
+ * of discovery (config sync, the artifact builder, the frontend source writer, lock check, secrets, readiness).
254
+ *
255
+ * - **The same import path**: one module, described twice. The PROVIDER PACKAGE whose name the path starts with owns the
256
+ * module, and its own `./companion` (derived from the module, its targets filtered by the application's scopes) is the
257
+ * description that stands; any other owner's contribution of that ref through that path is a re-statement, dropped and
258
+ * reported. Measured on reference run 44052185141: an installed PostHog module's browser facet contributed `posthog`
259
+ * for the application frontend, the frontend's own `provider-contributions.ts` re-projected the same facet module, and
260
+ * every env-file sync refused "provider "posthog" is contributed more than once for the same runtime", 66 times.
261
+ * - **Different import paths**: two modules claiming one ref. Nothing here decides between them; validation refuses it
262
+ * by name (`describeProviderRefClaimedByMoreThanOneImportPath`, #2014), which is the answer for an engine provider and
263
+ * an installed module sharing a ref as well.
264
+ * - **The same path, and no walked package owns it**: left as found, so the bootstrap's refusal names both owners.
265
+ *
266
+ * A re-declaration carries nothing the owning package's lacks that a host could use: the package's description is the
267
+ * one derived from the module, and a target only the re-declaration names is a runtime no scope reaches through the
268
+ * package, which the application's own scope decides.
269
+ */
270
+ export declare function collapseRedeclaredProviderContributions(contributions: readonly DiscoveredProviderCompanionContribution[]): {
271
+ contributions: DiscoveredProviderCompanionContribution[];
272
+ redeclared: RedeclaredProviderContribution[];
273
+ };
274
+ /** The advisory `wildo config sync` prints for one dropped re-declaration (#4019). */
275
+ export declare function describeRedeclaredProviderContribution(entry: RedeclaredProviderContribution): string;
231
276
  /**
232
277
  * The facet module a package root declares — `<name>/systems-of-record` — or `undefined`. Read from the
233
278
  * MANIFEST, never by loading: a build-time consumer has no business evaluating a vendor facet to learn that
@@ -1 +1 @@
1
- {"version":3,"file":"provider-companion-discovery.d.ts","sourceRoot":"","sources":["../../../src/project-config/provider-companion-discovery.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAGS,MAAM,uBAAuB,CAAC;AAGvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;;;;;;;GAQG;AACH,oBAAY,6BAA6B;IACvC,sGAAsG;IACtG,OAAO,YAAY;IACnB,mDAAmD;IACnD,OAAO,YAAY;IACnB,kDAAkD;IAClD,MAAM,WAAW;IACjB,uDAAuD;IACvD,MAAM,WAAW;IACjB;;;;OAIG;IACH,gBAAgB,oBAAoB;CACrC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,iCAAiC,wBAAwB,CAAC;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iCAAiC,0CAA0C,CAAC;AAEzF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mCAAmC,gCAAgC,CAAC;AAEjF;;;;;GAKG;AACH,oBAAY,4BAA4B;IACtC,uGAAuG;IACvG,QAAQ,aAAa;IACrB,+GAA+G;IAC/G,gBAAgB,qBAAqB;IACrC,uGAAuG;IACvG,aAAa,kBAAkB;IAC/B,kFAAkF;IAClF,UAAU,eAAe;IACzB,gHAAgH;IAChH,mBAAmB,wBAAwB;IAC3C;;;;OAIG;IACH,cAAc,mBAAmB;IACjC,8GAA8G;IAC9G,aAAa,kBAAkB;CAChC;AAED,yDAAyD;AACzD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,4BAA4B,CAAC;IAC9C,wEAAwE;IACxE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,kFAAkF;IAClF,QAAQ,CAAC,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E,CAoF7C;AAiJD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,uCAAuC,GAAG;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,CAOlJ;AA6YD,kHAAkH;AAClH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAW1E;AAsGD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iDAAiD,CAC/D,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,SAAS,uCAAuC,EAAE,GAChE,MAAM,GAAG,SAAS,CAgBpB"}
1
+ {"version":3,"file":"provider-companion-discovery.d.ts","sourceRoot":"","sources":["../../../src/project-config/provider-companion-discovery.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAGS,MAAM,uBAAuB,CAAC;AAGvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;;;;;;;GAQG;AACH,oBAAY,6BAA6B;IACvC,sGAAsG;IACtG,OAAO,YAAY;IACnB,mDAAmD;IACnD,OAAO,YAAY;IACnB,kDAAkD;IAClD,MAAM,WAAW;IACjB,uDAAuD;IACvD,MAAM,WAAW;IACjB;;;;OAIG;IACH,gBAAgB,oBAAoB;CACrC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,iCAAiC,wBAAwB,CAAC;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iCAAiC,0CAA0C,CAAC;AAEzF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mCAAmC,gCAAgC,CAAC;AAEjF;;;;;GAKG;AACH,oBAAY,4BAA4B;IACtC,uGAAuG;IACvG,QAAQ,aAAa;IACrB,+GAA+G;IAC/G,gBAAgB,qBAAqB;IACrC,uGAAuG;IACvG,aA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,GAAG,SAAS,CAW1E;AAsGD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iDAAiD,CAC/D,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,SAAS,uCAAuC,EAAE,GAChE,MAAM,GAAG,SAAS,CAgBpB"}
@@ -218,13 +218,16 @@ export async function discoverSaasProviderCompanionContributions(input) {
218
218
  if (!loaded.exports) {
219
219
  continue;
220
220
  }
221
- const parsedContributions = ProviderCompanionContributionSchema.array().parse(loaded.exports.providerContributions ?? []);
222
- if (isPackage && (parsedContributions.length > 0 || (loaded.exports.providerAugmentations ?? []).length > 0)) {
221
+ // Parsed one by one, so a refusal names the provider and the package that ships it (#4076): an array parse reported
222
+ // `[1, "complianceProfile", "processingRegions"]`, an index nobody could map back to a provider.
223
+ const parsedContributions = parseEachNamed(ProviderCompanionContributionSchema, loaded.exports.providerContributions, 'providerContributions', 'provider contribution', target);
224
+ const parsedAugmentations = parseEachNamed(ProviderAugmentationContributionSchema, loaded.exports.providerAugmentations, 'providerAugmentations', 'provider augmentation', target);
225
+ if (isPackage && (parsedContributions.length > 0 || parsedAugmentations.length > 0)) {
223
226
  packageFindings.set(target.key, { shipsSomething: true });
224
227
  }
225
228
  const owner = { kind: target.kind, key: target.key, packageRoot: target.packageRoot };
226
229
  const ownerVersion = readPackageVersion(target.packageRoot);
227
- augmentations.push(...ProviderAugmentationContributionSchema.array().parse(loaded.exports.providerAugmentations ?? [])
230
+ augmentations.push(...parsedAugmentations
228
231
  .map((augmentation) => ({
229
232
  ...augmentation,
230
233
  owner,
@@ -246,14 +249,60 @@ export async function discoverSaasProviderCompanionContributions(input) {
246
249
  },
247
250
  })));
248
251
  }
252
+ const collapsed = collapseRedeclaredProviderContributions(contributions);
249
253
  return {
250
- contributions,
254
+ contributions: collapsed.contributions,
255
+ redeclaredContributions: collapsed.redeclared,
251
256
  unreadableOwners,
252
257
  augmentations,
253
258
  systemOfRecordFacetModules: [...systemOfRecordFacetModules].sort(),
254
259
  listedProviderPackages: listedPackageNames.map((packageName) => describeListedProviderPackage(packageName, packageTargets, packageFindings)),
255
260
  };
256
261
  }
262
+ /**
263
+ * Which source wins when one provider ref is contributed more than once (#4019): the rule, in one place, for every reader
264
+ * of discovery (config sync, the artifact builder, the frontend source writer, lock check, secrets, readiness).
265
+ *
266
+ * - **The same import path**: one module, described twice. The PROVIDER PACKAGE whose name the path starts with owns the
267
+ * module, and its own `./companion` (derived from the module, its targets filtered by the application's scopes) is the
268
+ * description that stands; any other owner's contribution of that ref through that path is a re-statement, dropped and
269
+ * reported. Measured on reference run 44052185141: an installed PostHog module's browser facet contributed `posthog`
270
+ * for the application frontend, the frontend's own `provider-contributions.ts` re-projected the same facet module, and
271
+ * every env-file sync refused "provider "posthog" is contributed more than once for the same runtime", 66 times.
272
+ * - **Different import paths**: two modules claiming one ref. Nothing here decides between them; validation refuses it
273
+ * by name (`describeProviderRefClaimedByMoreThanOneImportPath`, #2014), which is the answer for an engine provider and
274
+ * an installed module sharing a ref as well.
275
+ * - **The same path, and no walked package owns it**: left as found, so the bootstrap's refusal names both owners.
276
+ *
277
+ * A re-declaration carries nothing the owning package's lacks that a host could use: the package's description is the
278
+ * one derived from the module, and a target only the re-declaration names is a runtime no scope reaches through the
279
+ * package, which the application's own scope decides.
280
+ */
281
+ export function collapseRedeclaredProviderContributions(contributions) {
282
+ const ownedByPackage = (contribution) => contribution.owner.kind === ProviderContributionOwnerKind.PROVIDER_PACKAGE && contribution.owner.key === extractPackageName(contribution.runtimeImportPath);
283
+ const owners = new Map();
284
+ for (const contribution of contributions) {
285
+ if (ownedByPackage(contribution))
286
+ owners.set(`${contribution.ref}\u0000${contribution.runtimeImportPath}`, contribution);
287
+ }
288
+ const kept = [];
289
+ const redeclared = [];
290
+ for (const contribution of contributions) {
291
+ const owner = owners.get(`${contribution.ref}\u0000${contribution.runtimeImportPath}`);
292
+ if (owner === undefined || owner === contribution) {
293
+ kept.push(contribution);
294
+ continue;
295
+ }
296
+ redeclared.push({ ref: contribution.ref, runtimeImportPath: contribution.runtimeImportPath, redeclaredBy: contribution.owner, ownedBy: owner.owner });
297
+ }
298
+ return { contributions: kept, redeclared };
299
+ }
300
+ /** The advisory `wildo config sync` prints for one dropped re-declaration (#4019). */
301
+ export function describeRedeclaredProviderContribution(entry) {
302
+ return `Provider "${entry.ref}" is contributed by ${entry.redeclaredBy.kind} "${entry.redeclaredBy.key}" through "${entry.runtimeImportPath}", `
303
+ + `which is the module of ${entry.ownedBy.kind} "${entry.ownedBy.key}" and which that package already contributes; the package's own `
304
+ + 'contribution is used. Remove the re-declaration: an installed module contributes itself, and the application binds it in its scope.';
305
+ }
257
306
  /** What discovery found for one listed package (#1676) — see {@link ProviderPackageListingStatus}. */
258
307
  function describeListedProviderPackage(packageName, packageTargets, packageFindings) {
259
308
  if (packageTargets.ownPackageNames.has(packageName))
@@ -386,7 +435,7 @@ export async function resolveProviderComplianceProfiles(input) {
386
435
  * discovery and the real validation they exist to check.
387
436
  */
388
437
  export async function resolveValidatedSaasProviderContributions(input) {
389
- const { contributions, unreadableOwners, augmentations, systemOfRecordFacetModules, listedProviderPackages } = await discoverSaasProviderCompanionContributions(input);
438
+ const { contributions, redeclaredContributions, unreadableOwners, augmentations, systemOfRecordFacetModules, listedProviderPackages } = await discoverSaasProviderCompanionContributions(input);
390
439
  validateDiscoveredSaasProviderContributions({
391
440
  saasConfig: input.saasConfig,
392
441
  discoveredContributions: contributions,
@@ -403,7 +452,10 @@ export async function resolveValidatedSaasProviderContributions(input) {
403
452
  .filter((listed) => listed.status === ProviderPackageListingStatus.ADMITTED)
404
453
  .map(({ packageName, packageVersion }) => ({ packageName, ...(packageVersion === undefined ? {} : { packageVersion }) }))
405
454
  .sort((left, right) => left.packageName.localeCompare(right.packageName)),
406
- advisories: validateProviderSharedConnections({ saasConfig: input.saasConfig, discoveredContributions: contributions }).advisories,
455
+ advisories: [
456
+ ...redeclaredContributions.map(describeRedeclaredProviderContribution),
457
+ ...validateProviderSharedConnections({ saasConfig: input.saasConfig, discoveredContributions: contributions }).advisories,
458
+ ],
407
459
  };
408
460
  }
409
461
  /**
@@ -1267,4 +1319,23 @@ function extractPackageName(importPath) {
1267
1319
  function hasAnyProviders(providers) {
1268
1320
  return Boolean(providers && Object.keys(providers).length > 0);
1269
1321
  }
1322
+ /**
1323
+ * Each entry of an exported list, parsed on its own so a refusal names the entry (its `ref`, else its position, counted
1324
+ * from 1) and the package that ships it (#4076). A value that is not a list is refused by name too, rather than failing as
1325
+ * `….map is not a function`. Absent is an empty list.
1326
+ */
1327
+ function parseEachNamed(schema, exported, exportName, entryLabel, target) {
1328
+ if (exported === undefined)
1329
+ return [];
1330
+ if (!Array.isArray(exported))
1331
+ throw new Error(`${target.ownerLabel} (${target.packageRoot}) exports ${exportName} as ${exported === null ? 'null' : typeof exported}, not a list.`);
1332
+ return exported.map((entry, index) => {
1333
+ const parsed = schema.safeParse(entry);
1334
+ if (parsed.success)
1335
+ return parsed.data;
1336
+ const ref = typeof entry?.ref === 'string' ? `"${entry.ref}"` : `at position ${index + 1}`;
1337
+ const issues = parsed.error.issues.map((issue) => `${issue.path.join('.') || '(root)'}: ${issue.message}`).join('; ');
1338
+ throw new Error(`The ${entryLabel} ${ref} from ${target.ownerLabel} (${target.packageRoot}) is invalid: ${issues}`);
1339
+ });
1340
+ }
1270
1341
  //# sourceMappingURL=provider-companion-discovery.js.map