@wildo-ai/platform-config-lib 1.1.14 → 1.1.16

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 (39) hide show
  1. package/dist/esm/bootstrap/application-scheduled-jobs.contracts.d.ts +187 -0
  2. package/dist/esm/bootstrap/application-scheduled-jobs.contracts.d.ts.map +1 -0
  3. package/dist/esm/bootstrap/application-scheduled-jobs.contracts.js +250 -0
  4. package/dist/esm/bootstrap/application-scheduled-jobs.contracts.js.map +1 -0
  5. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +12 -0
  6. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  7. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +12 -0
  8. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  9. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts +23 -2
  10. package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -1
  11. package/dist/esm/bootstrap/runtime-backing-service-access.js +23 -4
  12. package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -1
  13. package/dist/esm/index.d.ts +1 -0
  14. package/dist/esm/index.d.ts.map +1 -1
  15. package/dist/esm/index.js +1 -0
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  18. package/dist/esm/project-config/define-infra-env-config.js +12 -1
  19. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  20. package/dist/esm/project-config/hosted-infra-env-config.js +8 -1
  21. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -1
  22. package/dist/esm/project-config/provider-companion-discovery.d.ts +45 -0
  23. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  24. package/dist/esm/project-config/provider-companion-discovery.js +53 -3
  25. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  26. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +13 -0
  27. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  28. package/dist/esm/project-config/provider-runtime-artifacts.js +43 -1
  29. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  30. package/dist/esm/project-config/shared/csp-defaults.d.ts +7 -3
  31. package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -1
  32. package/dist/esm/project-config/shared/csp-defaults.js +10 -4
  33. package/dist/esm/project-config/shared/csp-defaults.js.map +1 -1
  34. package/dist/esm/project-config/shared/environment.schemas.d.ts +18 -4
  35. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  36. package/dist/esm/project-config/shared/environment.schemas.js +26 -4
  37. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  38. package/dist/tsconfig.build.tsbuildinfo +1 -1
  39. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"define-infra-env-config.js","sourceRoot":"","sources":["../../../src/project-config/define-infra-env-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC9H,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,2CAA2C,EAAE,MAAM,oDAAoD,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAC7H,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mCAAmC,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,sCAAsC,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACL,4BAA4B,GAC7B,MAA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C,CAAC,kBAAkB,CAAC;IAC5E,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,iBAAiB,IAAI,IAAI,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAgC;IACnE;;;;;OAKG;IACH,IAAK,MAA2C,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;QAClF,MAAM,IAAI,KAAK,CACb,iHAAiH;cAC/G,gHAAgH;cAChH,mEAAmE,CACtE,CAAC;IACJ,CAAC;IACD,OAAO,yBAAyB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAsC;IAC/E,OAAO,+BAA+B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import { EnvironmentAgentContentGuardrailsSchema, InboundEmailConfigSchema, RuntimeEnvironment } from '@wildo-ai/saas-models';\nimport { z } from 'zod';\nimport { WildoAuthConfigSchema } from './shared/auth.schemas';\nimport { ApplicationCreationVerificationConfigSchema } from './shared/application-creation-verification.schemas';\nimport { BackingServiceKind, BackingServiceSource, BackingServicesEnvConfigSchema } from './shared/backing-services.schemas';\nimport { WildoCdnConfigSchema } from './shared/cdn.schemas';\nimport { WildoSystemsOfRecordEnvConfigSchema } from './shared/systems-of-record-env.schemas';\nimport { WildoPlatformStorageConfigSchema } from './shared/platform-storage.schemas';\nimport { WildoPlatformKeyManagementConfigSchema } from './shared/platform-key-management.schemas';\nimport { EnvCspOverrideSchema } from './shared/csp.schemas';\nimport {\n InfraServiceAddressingSchema,\n} from './shared/infra-service.schemas';\nimport {\n DatabaseEngine,\n resolveApplicationDatabaseEngine,\n WildoDeploymentConfigSchema,\n WildoDeploymentRuntime,\n WildoEnvironment,\n WildoEnvironmentIdSchema,\n WildoKubernetesConfigSchema,\n WildoLocationType,\n WildoLocalDataStorage,\n resolveDefaultLocalDataStorage,\n DEFAULT_ENVIRONMENT_SERVICE_PROFILE,\n EnvironmentServiceProfile,\n EnvironmentServiceProfileOptionalService,\n describeServiceOmittedByEnvironmentServiceProfile,\n environmentServiceProfileOmits,\n environmentServiceProfileRunsOneDatabaseFamily,\n WildoLoggingConfigSchema,\n WildoObservabilityConfigSchema,\n WildoDocumentationSiteConfigSchema,\n WildoEnvironmentProviderConfigurationsSchema,\n WildoProviderSelectionOverridesSchema,\n WildoRemoteProviderSchema,\n WildoImageTagStrategy,\n isLocalEnvironmentId,\n} from './shared/environment.schemas';\n\nconst InfraEnvKubernetesSchema = WildoKubernetesConfigSchema.strict();\n\n/**\n * A POSIX (`/…`), drive-letter (`C:\\…`, `C:/…`) or UNC (`\\\\host\\…`) absolute path.\n *\n * A pattern rather than `node:path`'s `isAbsolute` so the verdict does not depend on the platform the\n * descriptor happens to be evaluated on: a Windows path committed by one developer must read as absolute\n * on another's macOS machine too, or a machine-local host path could slip into a committed descriptor.\n */\nconst ABSOLUTE_PATH_PATTERN = /^(?:\\/|[A-Za-z]:[\\\\/]|\\\\\\\\)/;\n\n/**\n * DNS subdomain chain regex: one or more lowercase RFC 1123 labels\n * joined by dots. Empty string is allowed separately via the union\n * below — it means \"this service lives at the apex of `publicDomain`\".\n *\n * Examples accepted: `'app'`, `'docs'`, `'dev'`, `'www2'`, `'admin.ops'`.\n * Examples rejected: `'App'` (uppercase), `'-app'` / `'app-'`\n * (dash at boundary), `'app..docs'` / `'.app'` / `'app.'` (malformed\n * dots), `'a/b'` (non-DNS character).\n */\nconst SERVICE_HOST_LABEL = /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/;\n\n/**\n * Per-service public hostname mapping, authored per-environment.\n *\n * - **Keys** are service keys from `wildo.saas.config.ts`\n * (`config.services.<key>`). The mapping is NOT validated against\n * the SaaS config at the Zod level (the two configs live in\n * separate files and are parsed independently). Cross-file\n * validation against the SaaS-config service registry is the\n * responsibility of consumers that wire the two parsed configs\n * together (URL composers, ingress manifest generators) — each\n * consumer enforces it at the seam where both configs are in\n * scope. This schema cannot enforce it standalone.\n * - **Values** are the subdomain chain prefixed to `publicDomain`, OR\n * the empty string for apex. Composed as\n * `https://${value ? `${value}.` : ''}${publicDomain}`.\n *\n * The mapping is intentionally per-environment (living inside\n * `wildo.infra.<env>.config.ts`) because local / staging / production\n * routinely have different topologies — e.g., local collapses\n * everything to `localhost`, staging mounts everything under\n * `*.staging.example.com`, production uses bespoke subdomains like\n * `app.example.com` + `dev.example.com` for docs. Binding the\n * hostname to a frontend kind or to the service key would force a\n * single topology on every environment; the per-env map keeps those\n * decisions explicit and author-driven.\n *\n * The URL composer that builds cross-frontend handoff URLs consumes\n * this mapping.\n */\nconst ServiceHostValueSchema = z.string()\n .refine(\n (value) => value === '' || SERVICE_HOST_LABEL.test(value),\n 'serviceHosts value must be a lowercase DNS subdomain chain (e.g. \"app\", \"docs\", \"dev.admin\") or \"\" (empty string, meaning apex).',\n );\n\nconst ServiceHostsMapSchema = z.record(z.string().min(1), ServiceHostValueSchema);\n/**\n * Per-environment email values, laid over `email` in the backend configuration (`saas-config.backend.ts`) for THIS\n * environment only.\n *\n * `inbound.sharedDomain` is the shared receiving domain: every organization is reachable at `{slug}@{sharedDomain}`,\n * and the domain's MX points at the receiving provider. It is a property of a DEPLOYMENT, not of the application: a\n * local stack receives through a developer's own provider account (Resend assigns each account an `<id>.resend.app`\n * domain), staging and production through their own domains, and one constant in the backend configuration made every\n * environment claim the same domain — or, kept generic, made local receiving impossible to exercise. Validated by the\n * same schema the backend configuration uses (`InboundEmailConfigSchema.shape.sharedDomain`), so the two cannot\n * disagree about what a domain is.\n *\n * Projected to `WILDO_INBOUND_EMAIL_SHARED_DOMAIN` by `env-vars-builder`; the backend's inbound services read it\n * through `resolveInboundEmailConfig`, where it wins over the authored value. Absent, the authored value applies.\n */\nexport const WildoInfraEmailConfigSchema = z.strictObject({\n inbound: z.strictObject({\n sharedDomain: InboundEmailConfigSchema.shape.sharedDomain,\n }).optional(),\n});\n\nexport type WildoInfraEmailConfig = z.output<typeof WildoInfraEmailConfigSchema>;\n\n/**\n * Where THIS local environment's ownership-DNS stand-in answers (#2519): the development/test double that answers a\n * domain-ownership challenge for a name nobody can publish — a corporate domain such as `wonder-group.test`, whose\n * \"IT department\" on a developer machine is a test double (`client-org-mock`) rather than a DNS zone.\n *\n * A domain-ownership proof is what PUBLIC DNS says, everywhere else. So this is LOCAL-ONLY — refused by this schema in\n * any other environment — and the backend honours it only where its declared runtime environment is development or\n * test, and REFUSES TO START with it set anywhere else (`assertOwnershipDnsStandInAdmitted` in the backend). The\n * stand-in answers `GET {baseUrl}/__wildo/dns/txt?name=<name>` with `{ \"records\": [\"…\"] }`.\n *\n * Projected to `WILDO_OWNERSHIP_DNS_STAND_IN_URL` (`PlatformOwnershipDnsEnvKey`) by `env-vars-builder`, for the\n * application backend that serves the domain-ownership doors. Absent, every ownership challenge asks public DNS.\n */\nexport const WildoOwnershipDnsStandInConfigSchema = z.strictObject({\n // http(s) only: a bare `z.url()` admits `localhost:18319` as a URL whose SCHEME is `localhost:`, which the backend\n // would then fail to fetch at the first verification instead of here.\n baseUrl: z.url({ protocol: /^https?$/ }).describe(\"The stand-in's base URL, e.g. `http://localhost:18319`. Its DNS path is appended to it.\"),\n});\n\nexport type WildoOwnershipDnsStandInConfig = z.output<typeof WildoOwnershipDnsStandInConfigSchema>;\n\n/**\n * The shape of a STANDALONE environment descriptor — one that owns its infrastructure.\n *\n * Kept as a plain object rather than inlined into `z.object(...)` because the HOSTED descriptor\n * ({@link WildoHostedInfraEnvConfigSchema}) is built from a subset of these same members. Zod 4 refuses\n * `.pick()` on an object that carries refinements, so sharing the members is the only way the two\n * descriptors can agree on what an application-owned field IS without restating it.\n */\nconst WILDO_INFRA_ENV_CONFIG_SHAPE = {\n /*\n * No `version` key, deliberately (#3496): the descriptor's compatibility is fixed by the `@wildo-ai/*` release the\n * application installs, exactly as for `wildo.saas.config.ts`. The strict object refuses one if it is authored.\n */\n environment: WildoEnvironmentIdSchema,\n locationType: z.enum(WildoLocationType).optional(),\n runtimeEnvironment: z.enum(RuntimeEnvironment).optional(),\n runtime: z.enum(WildoDeploymentRuntime),\n /**\n * Where the self-hosted backing services of a DOCKER_COMPOSE environment keep their data —\n * a Docker named volume, or a bind mount onto `<saas-root>/.wildo-saas/local_data/<service>/`.\n *\n * Omit it and the environment takes {@link resolveDefaultLocalDataStorage}: a named volume\n * locally (the host-filesystem crossing costs ~4 CPU cores on macOS and Windows, and a named\n * volume costs a Linux developer nothing), a host path remotely (the operator chooses the disk\n * the database lands on). Author it to say otherwise — a remote deployment happy with Docker's\n * own storage, or a local developer who wants to read the files directly.\n *\n * Ignored by KUBERNETES environments, which take their storage from PVs rather than from here.\n */\n localDataStorage: z.enum(WildoLocalDataStorage).optional(),\n /**\n * Which optional backing services this environment runs — its footprint (#2303). Omit it and the\n * environment runs `FULL`, every service its declarations ask for.\n *\n * `SMALL` runs no ClamAV, no immudb and no mongot. A small internal tool usually needs none of them, and\n * they are the heaviest containers in the stack. Each capability that depends on one is REFUSED at the\n * application's boot when the application declares it, with a message naming this profile and the remedy:\n * a `z_file({ scanPolicy: 'required' })` field (antivirus), an enabled `COMPLIANCE_AUDIT_TRAIL` with no\n * external audit store (immudb), a `.ragSource()` field on a MongoDB-persisted resource (mongot; on\n * PostgreSQL pgvector serves vector search inside the database, so it stays available).\n *\n * Moving between profiles migrates no data: a service the profile adds starts empty (an audit store with\n * no history, a search index that mongot builds from the collections), and one it removes leaves its\n * data where it was.\n *\n * Docker Compose environments only for now: a KUBERNETES environment declaring a non-`FULL` profile is\n * refused, because its manifests would ignore it.\n */\n serviceProfile: z.enum(EnvironmentServiceProfile).optional(),\n /**\n * The store the PLATFORM's own data lives in (apps-manager + module-registry:\n * users, organizations, applications, sessions, API keys).\n *\n * **This is a DECLARED property of the environment, and that is the whole point.** It used to\n * exist only as an answer to an interactive prompt, persisted to the machine-local\n * `environments.json` — so it could not be committed, reviewed, or reproduced on a second\n * machine, and a value inferred from which backing services happened to be declared filled the\n * gap. Authoring it here makes it travel with the repository like every other environment\n * property.\n *\n * OPTIONAL. When omitted, the engine is INFERRED from the declared backing services\n * (`inferDatabaseChoiceFromInfraConfig`), which is what every pre-existing environment relies\n * on — so omitting this field preserves today's behaviour exactly. When authored, it is the\n * AUTHORITY and the inference is not consulted.\n *\n * Authoring it is REQUIRED to express a PostgreSQL platform that ALSO runs a mongod, because the\n * inference resolves `postgresql && mongodb` to MongoDB — so that dual-store combination is\n * unreachable by inference, by construction. Since 2026-08-28 a PostgreSQL platform no longer has\n * to declare `backingServices.mongodb` at all (see the refinement below), so the single-store case\n * is now expressible too.\n *\n * @example A PostgreSQL platform, no mongod.\n * ```ts\n * database: { engine: DatabaseEngine.POSTGRESQL, source: BackingServiceSource.SELF },\n * backingServices: { postgresql: { source: BackingServiceSource.SELF } },\n * ```\n *\n * @example A DUAL-STORE platform — PostgreSQL for itself, a mongod beside it for the Mongo-backed\n * applications it hosts. This is the shape that needs `database` authored.\n * ```ts\n * database: { engine: DatabaseEngine.POSTGRESQL, source: BackingServiceSource.SELF },\n * backingServices: {\n * mongodb: { source: BackingServiceSource.SELF },\n * postgresql: { source: BackingServiceSource.SELF },\n * },\n * ```\n *\n * NOTE this is the PLATFORM's engine. An APPLICATION's own store is chosen separately by that\n * application's `DATABASE_DEFAULT_ADAPTER`; declaring `backingServices.postgresql` alone gives an\n * application a PostgreSQL substrate without moving the platform.\n */\n database: z\n .strictObject({\n engine: z.enum(DatabaseEngine),\n source: z.enum(BackingServiceSource),\n /**\n * Managed-brand identifier when `source === MANAGED` — `'atlas'` for Mongo; one of\n * `'aws-rds' | 'gcp-cloud-sql' | 'azure-database' | 'supabase' | 'neon' | 'render'` for\n * Postgres. Mirrors `PlatformEnvConfigJson['database'].provider` exactly; this field is\n * deliberately the same vocabulary rather than a parallel one.\n */\n provider: z.string().min(1).optional(),\n })\n .optional(),\n /** @wildo_source:part:start platform.config.application-database facet:layer:platform facet:family:bootstrap facet:audience:app-developer */\n /**\n * Which declared backing store the APPLICATION's own resources persist to.\n *\n * ## Why this is a SEPARATE field from `database`\n *\n * `database` above is the PLATFORM's engine — where apps-manager's own tables live. This one is the\n * application's, and the two move independently: a PostgreSQL platform can host a MongoDB\n * application and vice versa. Collapsing them would make one decision imply the other, which is\n * exactly the conflation the emitter's own contract warns against.\n *\n * ## Why it carries only `engine`\n *\n * The SUBSTRATE is already declared: `backingServices.postgresql` says where the database is and\n * who provisions it, and `env-vars-builder` already emits `POSTGRESQL_HOST/PORT/DATABASE` to the\n * application backend whenever the environment self-hosts one. What was missing is the SELECTION,\n * and only the selection belongs here.\n *\n * ## Why an authored field rather than an env variable\n *\n * The emitter states the rule this field exists to satisfy: *\"which store an application persists to\n * is a deployment decision that must be legible in one place, not an emergent property of which\n * variables happen to be set\"*. Before this, the only way to select PostgreSQL for an application\n * was to hand-edit `backend-api/.env` — machine-local, ungitted, and not reproducible on another\n * developer's machine. That is the same defect the platform `database` field above was added to\n * remove, and the reason both live in the authored, committed config.\n *\n * Absent means POSTGRESQL (`DEFAULT_APPLICATION_DATABASE_ENGINE`, decided 2026-09-24, #1571), and\n * every reader resolves it through `resolveApplicationDatabaseEngine` rather than re-deriving it —\n * two readers answering silence differently is what stranded an application on 2026-09-15. So an\n * environment that authors nothing here must still declare `backingServices.postgresql`; the\n * refinement below refuses it otherwise.\n *\n * @example An application on PostgreSQL, on a platform that is also on PostgreSQL.\n * ```ts\n * database: { engine: DatabaseEngine.POSTGRESQL, source: BackingServiceSource.SELF },\n * applicationDatabase: { engine: DatabaseEngine.POSTGRESQL },\n * backingServices: {\n * postgresql: { source: BackingServiceSource.SELF, database: 'my-app-db' },\n * },\n * ```\n */\n applicationDatabase: z\n .strictObject({\n engine: z.enum(DatabaseEngine),\n })\n .optional(),\n /**\n * ## Choosing PostgreSQL creates a standing obligation — MIGRATIONS\n *\n * This is the part that is easy to miss, and it is not a detail of deployment: on MongoDB a\n * collection exists the moment something writes to it, so a new resource needs nothing. On\n * PostgreSQL a resource's TABLE is built by a MIGRATION, and nothing creates it implicitly. So on\n * this engine, adding or reshaping a resource owes an artifact:\n *\n * - `wildo db diff` — what separates the model from the accepted plan;\n * - `wildo db generate --name <label>` — writes `backend-api/migrations/<timestamp>_<name>/`\n * AND advances `backend-api/migrations/schema-plan.lock.json`, in one step. Commit them\n * TOGETHER; either one alone is the two-artifact drift the design exists to prevent;\n * - `wildo db migrate` — applies pending migrations by hand. Usually unnecessary: the application\n * backend applies them at BOOT, and `wildo local dev` reconciles drift before the app starts.\n *\n * Skip it and nothing warns until the backend refuses to start with\n * `postgresql_table_schema_mismatch` — an accurate message that names neither the migration nor\n * the command. See the `application-database-migrations` skill.\n */\n /** @wildo_source:part:end platform.config.application-database */\n /**\n * Public domain that browsers and external clients use to reach this\n * deployment. Ingress / reverse proxy / DNS terminate here; every\n * service-level subdomain is mounted under it via {@link serviceHosts}\n * (`https://<serviceHost>.<publicDomain>`, e.g. `app.example.com`; a\n * `serviceHosts` value of `''` mounts the service at the apex). Greenfield,\n * single-app, mono-env — there is NO `<service>-<appSlug>-<env>` fan-out.\n *\n * Applies to BOTH `WildoDeploymentRuntime.KUBERNETES` and\n * `WildoDeploymentRuntime.DOCKER_COMPOSE`. For compose envs without a\n * reverse proxy, author `'localhost'` explicitly. For K8s local,\n * author `'local.wildo.ai'` (or your `*.local` apex). For remote,\n * author your apex (e.g. `'wonder-todos.com'`).\n *\n * NOT to be confused with the K8s-internal service-mesh hostname\n * (`<service>.<namespace>.svc.cluster.local`), which stays implicit\n * and is derived from `kubernetes.namespace` at composition time.\n *\n * REQUIRED — there is no read-time fallback. The default that\n * `wildo init` writes into the generated config file lives in\n * `PUBLIC_DOMAIN_DEFAULTS` (`infrastructure-defaults.schemas.ts`),\n * but the schema enforces explicit authoring so a hand-edited\n * config that drops the field fails Zod parse with a clear error\n * instead of silently falling back.\n */\n publicDomain: z.string().min(1),\n /**\n * Per-service public hostname authoring for this environment.\n *\n * The app developer maps each publicly-exposed service (by its\n * `services.<key>` in `wildo.saas.config.ts`) to the subdomain\n * chain under `publicDomain` where it is reachable in this\n * environment. An empty string value mounts the service at the\n * apex of `publicDomain`.\n *\n * An UNMAPPED service falls back to its own key, lowercased, as its\n * subdomain (`buildServicePublicHost`) — a defined path, not an error;\n * nothing is derived from `frontendType`. Author an entry whenever the\n * key is not the host you want, or is not a valid DNS label. Two\n * services resolving to one host are refused when a REMOTE\n * environment's ingress routes are built (`buildK8sApplicationIngressRoutes`);\n * a local environment builds none and a CDN-served frontend is excluded\n * from them, so neither is checked. (Corrected\n * 2026-09-13: this comment said there was NO derivation from the key,\n * which the resolver has not matched.) An app-dev who wants the\n * docs service to live at `dev.example.com` (rather than the more\n * conventional `docs.example.com`) writes\n * `serviceHosts: { docs: 'dev' }` here; an app-dev who splits\n * marketing across `example.com` and `landing.example.com` can\n * author `serviceHosts: { www: '', landing: 'landing' }` without\n * the framework second-guessing the intent.\n *\n * Field is `.optional()` because many projects (local dev,\n * Docker Compose collapsed to `localhost`, single-frontend SaaS\n * apps) do not need per-service hostname authoring. Downstream\n * consumers (URL composers, ingress manifest generators) MUST\n * handle both \"no mapping authored\" and \"service key not\n * mapped\" as defined fallback paths — never as silent errors.\n */\n serviceHosts: ServiceHostsMapSchema.optional(),\n kubernetes: InfraEnvKubernetesSchema.optional(),\n remoteProvider: WildoRemoteProviderSchema.strict().optional(),\n deployment: WildoDeploymentConfigSchema.optional(),\n backingServices: BackingServicesEnvConfigSchema,\n /**\n * Per-environment logging posture. `level` is projected to `LOG_LEVEL`\n * by `env-vars-builder` for every long-running platform/application\n * process (`LoggerService.loadConfiguration` reads it at boot);\n * `formattedConsoleErrors` is projected to `LOG_FORMATTED_CONSOLE_ERRORS`\n * and overrides the auto-detected pino-pretty / JSON branch for\n * environments that want explicit control. Persisted into\n * `PlatformEnvConfigJson.logging` and hydrated back by\n * `hydrateEnvironmentFromConfig` so the runtime contract survives a\n * `wildo config sync` cycle.\n */\n logging: WildoLoggingConfigSchema.optional(),\n /**\n * Per-environment OTLP telemetry posture (Slice 2 Phase 5). `enabled` is projected to\n * `OTEL_ENABLED` and drives the `--import @wildo-ai/saas-backend-lib/otel-preload` wiring;\n * `endpoint` is projected to `OTEL_EXPORTER_OTLP_ENDPOINT`. The provider auth header\n * (`OTEL_EXPORTER_OTLP_HEADERS`) is derived from the selected `OBSERVABILITY_TELEMETRY`\n * provider's secret by `env-vars-builder`, not authored here. Persisted into\n * `PlatformEnvConfigJson.observability` and hydrated by `hydrateEnvironmentFromConfig`.\n */\n observability: WildoObservabilityConfigSchema.optional(),\n /**\n * Per-environment external-provider SELECTION override. Overrides the\n * app-wide `providers.scopes.backend.selection[capability]` primary/whenUnavailable\n * from `wildo.saas.config.ts` for THIS environment only — e.g. author\n * `providerSelection: { EMAIL_TRANSACTIONAL: { primary: 'email-preview' } }`\n * in `wildo.infra.local.config.ts` so local uses the non-sending\n * `email-preview` provider while remote envs keep the SaaS-config default\n * (`resend`). Projected to `WILDO_PROVIDER_SELECTION_OVERRIDES` by\n * `env-vars-builder` and applied by `ExternalProvidersRegistryBackendService`.\n * See {@link WildoProviderSelectionOverridesSchema}.\n */\n providerSelection: WildoProviderSelectionOverridesSchema.optional(),\n /**\n * Per-environment provider configuration values — an OAuth client ID, a frontend SDK DSN or site key — laid over\n * `wildo.saas.config.ts > providerConfigurations` key by key for THIS environment. Author here every value a vendor\n * issued against one deployment; keep application policy (an agent execution profile) in the SaaS config.\n * Never a secret: those stay in `secrets.json → providerEnv`. See\n * {@link WildoEnvironmentProviderConfigurationsSchema}.\n */\n providerConfigurations: WildoEnvironmentProviderConfigurationsSchema.optional(),\n /**\n * Per-environment email values — today the shared RECEIVING domain, `email.inbound.sharedDomain`, which differs\n * per deployment. See {@link WildoInfraEmailConfigSchema}.\n */\n email: WildoInfraEmailConfigSchema.optional(),\n /**\n * What THIS environment does with the agents' classifier-backed content guardrails (`contentGuardrails.promptInjection`,\n * `.outputModeration`) where no `AI_CONTENT_SAFETY` classifier offers them. Absent means REFUSE: such an agent refuses\n * every turn. `{ withoutClassifier: RUN_UNGUARDED, reason }` runs it unscreened and unmoderated, named at startup and, outside a\n * local environment, listed by `wildo context launch-blockers`. Projected to `WILDO_AGENT_CONTENT_GUARDRAILS` by\n * `env-vars-builder`. See {@link EnvironmentAgentContentGuardrailsSchema}.\n */\n agentContentGuardrails: EnvironmentAgentContentGuardrailsSchema.optional(),\n /**\n * LOCAL-ONLY: the double that answers domain-ownership challenges for names nobody can publish (#2519). See\n * {@link WildoOwnershipDnsStandInConfigSchema}.\n */\n ownershipDnsStandIn: WildoOwnershipDnsStandInConfigSchema.optional(),\n /**\n * Per-environment origins the documentation site is BUILT against.\n *\n * A docs bundle is static, so the origins are compiled in: a bundle built with the\n * wrong ones points every reader at the wrong host rather than failing. Authoring them\n * per environment is what lets `wildo config sync` carry them, instead of an operator\n * remembering three env vars on a build command.\n *\n * Passed as `WILDO_DOCS_API_BASE_URL` / `WILDO_DOCS_APP_URL` /\n * `WILDO_DOCS_FRONTEND_SERVICE_NAME` to the documentation image's build and to the CI workflow, read from the\n * loaded descriptor; no runtime environment carries them (#2310).\n * See {@link WildoDocumentationSiteConfigSchema}.\n */\n documentationSite: WildoDocumentationSiteConfigSchema.optional(),\n /**\n * Local-only operator configuration for application-creation verification.\n * The authored value is snapshotted into generated `config.json` and then\n * projected into the app-root `.env`; `.env` is never the authoring source.\n */\n applicationCreationVerification: ApplicationCreationVerificationConfigSchema.optional(),\n serviceAuth: WildoAuthConfigSchema.strict().optional(),\n /**\n * Per-environment Content-Security-Policy overrides, keyed by SaaS-config\n * service key (parallel to the `serviceHosts` keying convention).\n *\n * # Consumer wiring\n *\n * The generic resolver in `platform-config-lib` accepts this layer,\n * and `wildo dev sync-csp` is the first build-time consumer that\n * threads `parsed.csp[serviceKey]` into generated frontend CSP\n * artifacts and nginx marker rewrites. `defineInfraEnvConfig` still\n * emits a one-line stderr warning for authored service keys that are\n * not explicitly declared as consumed by the current loader; known\n * CSP-capable frontend keys are suppressed by the CLI while it loads\n * the shared infra config.\n *\n * Cross-validation against SaaS-config service keys is not enforceable\n * inside this schema alone because the infra config file is parsed\n * independently. Consumers that load both files together must validate\n * their own seam; `wildo dev sync-csp` rejects unknown `csp.<key>`\n * entries before emitting generated artifacts.\n *\n * # Where this fits in the layered CSP cake\n *\n * 1. Platform default (per-`AppFrontendType` baseline) — `csp-defaults.ts`.\n * 2. App-static (per-frontend `csp?` block) — authored on each\n * service-definition (today: `wildo.tech-doc.config.ts.csp?`).\n * 3. **THIS FIELD** — env-specific overrides authored under\n * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. The\n * `resolveCspPolicy({ envOverride, environmentId })` resolver\n * in `platform-config-lib/src/project-config/shared/csp-emit.ts`\n * accepts this shape, the schema's `superRefine` enforces the\n * LOCAL-only `viteDevLoosening` rule, and `wildo dev sync-csp`\n * reads `parsed.csp[serviceKey]` when generating service-local\n * artifacts.\n *\n * # Why per-env overrides exist\n *\n * - Sentry / DataDog ingest origins differ per deployment (staging\n * vs production violation collectors).\n * - Vite dev mode needs `'unsafe-inline'` + `'unsafe-eval'` in\n * `script-src` (HMR client bootstrap injects an inline `<script>`,\n * module/sourcemap transforms run through `eval()`). The\n * framework auto-applies this for `local` + `SAAS_APP` via the\n * resolver's auto-default; the `viteDevLoosening` field exists\n * only for explicit opt-out (debugging real CSP issues) or for\n * non-canonical envs that also run Vite dev.\n * - Per-env `reportOnly` ramping: ship `reportOnly: true` in\n * staging while the violation collector ramps up, flip to\n * enforcing in prod once the directive overrides settle.\n *\n * # Always additive (resolver contract)\n *\n * Env-layer entries can only LOOSEN policy (`extraDirectives` is\n * APPEND-only over the app-static layer; `reportOnly` / `reportUri`\n * scalars override the app-static value when present;\n * `viteDevLoosening: true` appends `'unsafe-inline'` and\n * `'unsafe-eval'` to `script-src`). There is no `'replace-baseline'`\n * equivalent at this layer — env config exists to LOOSEN per-\n * deployment, not to replace an app's chosen posture. If an env\n * genuinely needs a different posture, the right answer is to fix\n * the app-static layer.\n *\n * # `.optional()` rationale\n *\n * Most environments (local dev, single-frontend SaaS apps that\n * accept the baseline policy verbatim) do not author per-service\n * CSP overrides. Downstream consumers MUST handle both \"no overrides\n * authored\" and \"service key not mapped\" as defined no-op fallbacks\n * — never as silent errors.\n *\n * `EnvCspOverrideSchema` is itself `z.strictObject` (csp.schemas.ts),\n * so unknown keys inside an authored override are rejected at the\n * inner-record level — no need to re-apply `.strict()` at the\n * `z.record` value position.\n */\n csp: z\n .record(z.string().min(1), EnvCspOverrideSchema)\n .optional(),\n /**\n * Per-service OPT-IN to CDN serving, keyed by SaaS-config service key\n * (same keyspace as `serviceHosts` / `csp`). Authoring an `enabled` entry\n * makes the deploy render skip the service's nginx Deployment/Service AND\n * its ingress / compose route — its public host is served off-cluster by a\n * CDN fronting an object-storage bucket, while `runtime.endPoints.publicUrl`\n * stays `<serviceHost>.<publicDomain>` (coherence preserved). See\n * {@link WildoCdnConfigSchema}. `wildo frontend publish` uploads the built\n * `dist/` + re-homes CSP to the edge for these services.\n *\n * `.optional()` — most apps serve every frontend from an nginx pod (no CDN);\n * consumers MUST treat \"no cdn authored\" and \"service key not mapped\" as the\n * defined no-op (nginx-served) fallback. `WildoCdnConfigSchema` is itself\n * `z.strictObject`, so unknown keys inside an authored entry are rejected at\n * the inner level — no `.strict()` needed at the `z.record` value position.\n */\n cdn: z\n .record(z.string().min(1), WildoCdnConfigSchema)\n .optional(),\n /**\n * WHERE each declared system of record lives in THIS environment, keyed by the instance name the\n * saas config declares (#1055). See {@link WildoSystemsOfRecordEnvConfigSchema}: either an address,\n * or `{ enabled: false }` for an environment that has no access to the instance at all.\n *\n * `.optional()` — an application that reads nothing out of another system authors none. An instance\n * the saas config DOES declare and this block omits is refused at `wildo config sync` and at boot,\n * because silence is not a declaration of absence; `{ enabled: false }` is.\n */\n systemsOfRecord: WildoSystemsOfRecordEnvConfigSchema.optional(),\n /**\n * The PLATFORM tier's own object-storage bucket, REMOTE environments only (#1112). See\n * {@link WildoPlatformStorageConfigSchema}: not this application's bucket (that is `backingServices.s3.bucket`),\n * and refused in a local environment, whose platform bucket is a constant shared by every application.\n */\n platformStorage: WildoPlatformStorageConfigSchema.optional(),\n /**\n * Where the PLATFORM keeps the keys it holds for applications (#2933): a self-hosted OpenBao the CLI renders, or the\n * operator's own Vault. See {@link WildoPlatformKeyManagementConfigSchema}. Absent, apps-manager seals every key\n * under its own key-encryption root and serves no Vault provider.\n */\n platformKeyManagement: WildoPlatformKeyManagementConfigSchema.optional(),\n devCompanion: InfraServiceAddressingSchema.optional(),\n /**\n * Present only on an environment RESOLVED from a hosted descriptor: this application runs on the\n * infrastructure of another application, whose root and descriptor are named here as absolute paths.\n *\n * Never authored in this form. An application declares its host with a RELATIVE\n * `infrastructureHost.applicationRoot` in a hosted descriptor (`defineHostedInfraEnvConfig`, {@link WildoHostedInfraEnvConfigSchema}),\n * and `loadInfraEnvConfig` produces this value while merging the host's platform-level fields in. The\n * absolute-path requirement is what keeps the two apart: a committed descriptor cannot carry a\n * machine-local path, so it cannot pass itself off as already resolved.\n *\n * Every consumer that would otherwise act on SHARED infrastructure — render the platform compose file,\n * converge containers, start or initialize the platform, write platform-service env files, bootstrap a\n * cluster — reads this field and leaves that action to the host.\n */\n infrastructureHost: z.strictObject({\n applicationRoot: z.string().regex(ABSOLUTE_PATH_PATTERN, 'infrastructureHost.applicationRoot must be absolute once resolved.'),\n infraConfigPath: z.string().regex(ABSOLUTE_PATH_PATTERN, 'infrastructureHost.infraConfigPath must be absolute once resolved.'),\n }).optional(),\n};\n\n/**\n * #2303 — the database families an environment that OWNS its platform runs, each with the declarations that bring it\n * in, derived from what the descriptor declares rather than asked: the platform's engine (authored, or inferred from\n * the declared stores), the application's (`resolveApplicationDatabaseEngine`, absent means PostgreSQL), and every\n * declared database store.\n *\n * The inferred platform engine needs no copy of the CLI's inference (`inferDatabaseChoiceFromInfraConfig`): it always\n * names a DECLARED store when one is declared, so it can add no family the declared stores do not already add. Only\n * when NO store is declared does it bring one in on its own, MongoDB, as an implicit self-hosted mongod.\n */\nfunction databaseFamiliesRunByEnvironment(config: {\n readonly database?: { readonly engine: DatabaseEngine };\n readonly applicationDatabase?: { readonly engine: DatabaseEngine };\n readonly backingServices: Partial<Record<BackingServiceKind, unknown>>;\n}): Map<DatabaseEngine, string[]> {\n const families = new Map<DatabaseEngine, string[]>();\n const add = (engine: DatabaseEngine, why: string): void => {\n families.set(engine, [...(families.get(engine) ?? []), why]);\n };\n const declaredStores: ReadonlyArray<readonly [BackingServiceKind, DatabaseEngine]> = [\n [BackingServiceKind.MONGODB, DatabaseEngine.MONGODB],\n [BackingServiceKind.POSTGRESQL, DatabaseEngine.POSTGRESQL],\n ];\n let anyStoreDeclared = false;\n for (const [kind, engine] of declaredStores) {\n if (config.backingServices[kind] !== undefined) {\n anyStoreDeclared = true;\n add(engine, `backingServices.${kind}`);\n }\n }\n if (config.database) add(config.database.engine, 'database.engine');\n else if (!anyStoreDeclared) add(DatabaseEngine.MONGODB, 'the platform store inferred when no database store is declared');\n add(\n resolveApplicationDatabaseEngine(config.applicationDatabase),\n config.applicationDatabase ? 'applicationDatabase.engine' : 'the application\\'s default engine (applicationDatabase absent)',\n );\n return families;\n}\n\nconst WildoInfraEnvConfigInputSchema = z.object(WILDO_INFRA_ENV_CONFIG_SHAPE).strict().superRefine((config, ctx) => {\n const resolvedEnvironment = config.environment;\n\n const resolvedLocationType = config.locationType\n ?? (isLocalEnvironmentId(resolvedEnvironment) ? WildoLocationType.LOCAL : WildoLocationType.REMOTE);\n\n if (isLocalEnvironmentId(resolvedEnvironment) && resolvedLocationType === WildoLocationType.REMOTE) {\n ctx.addIssue({\n code: 'custom',\n path: ['locationType'],\n message: `\"${resolvedEnvironment}\" environment cannot use remote locationType`,\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && resolvedLocationType === WildoLocationType.LOCAL) {\n ctx.addIssue({\n code: 'custom',\n path: ['locationType'],\n message: 'Only the \"local\" environment id can use local locationType',\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && !config.runtimeEnvironment) {\n ctx.addIssue({\n code: 'custom',\n path: ['runtimeEnvironment'],\n message: 'runtimeEnvironment is required for remote environments',\n });\n }\n\n /**\n * A declared PostgreSQL platform must declare the stores it actually needs — checked HERE, at\n * author time, rather than only at env generation.\n *\n * `env-vars-builder` already throws on both of these, but it throws during\n * `wildo config sync`, i.e. after the operator has committed the config and moved on. The same\n * refusal at parse time names the problem while the file is still open. The runtime throws\n * REMAIN as the backstop — they also guard generated/non-authored paths this schema never sees\n * (see `.claude/rules/invariant-call-site-enumeration.md`: an invariant enforced at one of its\n * sites is enforced at none of the others).\n */\n /*\n * Scoped to an environment that OWNS its platform. A hosted environment's `database` is the host's,\n * validated when the host's own descriptor was parsed; its `backingServices` are only the stores the\n * hosted application itself uses, so a Mongo-backed application on a PostgreSQL platform would be\n * refused here for a store it never asked for.\n */\n if (config.database?.engine === DatabaseEngine.POSTGRESQL && config.infrastructureHost === undefined) {\n if (!config.backingServices[BackingServiceKind.POSTGRESQL]) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['backingServices', BackingServiceKind.POSTGRESQL],\n message:\n 'database.engine is POSTGRESQL but no `backingServices.postgresql` is declared: the platform '\n + 'would be pointed at a PostgreSQL that nothing provisions. Declare it, or drop `database` '\n + 'to let the engine be inferred.',\n });\n }\n\n /**\n * RETIRED 2026-08-28. A PostgreSQL-engined platform no longer requires a mongod.\n *\n * This used to refuse a PostgreSQL platform that did not also declare\n * `backingServices.mongodb: { source: SELF }`, on two stated grounds — and BOTH had since been\n * met, which is exactly why it needed retiring rather than keeping:\n *\n * 1. \"six resources declare `persistenceAdapter: MONGODB`\" — retired 2026-08-22 (item C).\n * `bootstrap-plane-persistence-adapter.test.ts` now asserts the INVERSE, that none of the\n * six declares an adapter, so re-pinning any one of them fails that suite.\n * 2. \"`crontabs-batches-manager` … with zero PostgreSQL awareness\" — ported (item D). On a\n * PostgreSQL platform it takes `connectWithUrl(postgresUrl)` and never opens a Mongo\n * connection at all.\n *\n * The guard's own instruction was \"retire this together with those pins and the crontabs port —\n * NOT before\". Both landed; nobody came back. What kept a mongod alive after that was a THIRD\n * reason neither the guard nor its message ever named: apps-manager's env schema declared\n * `MONGO_CONNECT_URL` and `BASE_MONGO_SERVER_URL` as unconditionally REQUIRED, and its INIT\n * threw without them. That is the shape worth remembering — a transitional guard whose recorded\n * checklist is fully ticked while the real blocker sits somewhere it does not mention. Those\n * env keys are now engine-conditional, so nothing forces a mongod any more.\n *\n * A mongod remains perfectly legal to declare, and is still REQUIRED in practice for a platform\n * that hosts Mongo-backed applications — but that is an operator's judgment about the\n * applications they run, exactly as the `applicationDatabase` rule below already argues, and not\n * something this schema can decide for them.\n */\n }\n\n /**\n * An application cannot persist to a store the environment does not declare — including the store\n * it selects by SILENCE, which is PostgreSQL. Resolved rather than compared to the authored value,\n * so an environment that declares nothing and provisions no PostgreSQL is refused at authoring time\n * instead of registering an application with no store.\n *\n * Deliberately NOT symmetric with the platform rule above: that one also requires MongoDB to stay\n * declared, because the platform's own BOOTSTRAP plane is Mongo-wired. An application has no such\n * plane — once its resources are on PostgreSQL, nothing of the application's needs a mongod — so\n * requiring one here would forbid the very end-state this field exists to reach.\n */\n if (resolveApplicationDatabaseEngine(config.applicationDatabase) === DatabaseEngine.POSTGRESQL\n && config.backingServices[BackingServiceKind.POSTGRESQL] === undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['backingServices', BackingServiceKind.POSTGRESQL],\n message:\n 'The application persists to PostgreSQL (declared, or selected because `applicationDatabase` is '\n + 'absent) but no `backingServices.postgresql` is declared: it would be pointed at a PostgreSQL that '\n + 'nothing provisions. Declare it, or author `applicationDatabase: { engine: DatabaseEngine.MONGODB }`.',\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && config.applicationCreationVerification !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['applicationCreationVerification'],\n message: 'applicationCreationVerification is local-only and must be authored in wildo.infra.local.config.ts.',\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && config.ownershipDnsStandIn !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['ownershipDnsStandIn'],\n message: 'ownershipDnsStandIn is local-only and must be authored in wildo.infra.local.config.ts: in every other environment a '\n + 'domain-ownership proof is what public DNS says, and a backend outside development and test refuses to start with it set.',\n });\n }\n\n if (\n !isLocalEnvironmentId(resolvedEnvironment)\n && resolvedLocationType === WildoLocationType.REMOTE\n && config.runtime === WildoDeploymentRuntime.KUBERNETES\n ) {\n if (!config.remoteProvider) {\n ctx.addIssue({\n code: 'custom',\n path: ['remoteProvider'],\n message: 'remoteProvider is required for remote Kubernetes environments',\n });\n }\n if (!config.kubernetes) {\n ctx.addIssue({\n code: 'custom',\n path: ['kubernetes'],\n message: 'kubernetes is required for remote Kubernetes environments',\n });\n }\n }\n\n // CSP env-layer dev-only escape hatch — `viteDevLoosening: true`\n // injects BOTH `'unsafe-inline'` and `'unsafe-eval'` into `script-src`\n // (Vite's HMR client bootstrap is an inline `<script>` and its module\n // / sourcemap transforms run through `eval()`). The auto-default\n // already handles the canonical case (`local` + `SAAS_APP` →\n // auto-true). Explicit `viteDevLoosening: true` is REJECTED outside\n // the LOCAL environment because shipping `'unsafe-inline'` +\n // `'unsafe-eval'` to staging / production would punch a hole through\n // the entire CSP posture (every XSS payload becomes scriptable via\n // `eval()`-style sinks the baseline specifically denies, and inline\n // `<script>` injection escapes nonce-/hash-based mitigation). Failing\n // fast at parse time prevents an authored `csp.app.viteDevLoosening:\n // true` entry from silently shipping to production via a copy-paste\n // from the local config.\n if (config.csp && !isLocalEnvironmentId(resolvedEnvironment)) {\n for (const [serviceKey, override] of Object.entries(config.csp)) {\n if (override?.viteDevLoosening === true) {\n ctx.addIssue({\n code: 'custom',\n path: ['csp', serviceKey, 'viteDevLoosening'],\n message:\n `csp.${serviceKey}.viteDevLoosening cannot be true in environment \"${resolvedEnvironment}\" — `\n + `the dev-only escape hatch is restricted to \"${WildoEnvironment.LOCAL}\". `\n + `Author this flag ONLY in wildo.infra.local.config.ts; remote envs MUST reject `\n + `'unsafe-inline'/'unsafe-eval' so XSS payloads can't reach eval-style sinks or `\n + `inline-script injection. Production Vite builds emit <script type=\"module\"> with `\n + `no inline scripts and no eval(), so production envs never NEED this flag.`,\n });\n }\n }\n }\n\n // CDN serving is a REMOTE-only concern: it replaces a frontend's nginx pod\n // (Deployment + Service + ingress route), which exists ONLY in a remote\n // k8s/compose deploy. Local dev runs native frontend dev servers — there is\n // no nginx pod to skip and nowhere to publish to. Reject an authored `cdn`\n // block outside a remote env at parse time so a config copy-pasted from a\n // remote env can't silently make `wildo frontend publish --env local`\n // attempt an S3 upload (and so the semantic stays enforced, not implicit).\n // The platform's own bucket is authored only for a REMOTE environment (#1112). A local platform is shared by\n // every application beside it, and each has its own infra file, so letting one author it would make the\n // platform's bucket whichever application synced last — the defect this field exists to remove.\n if (config.platformStorage && resolvedLocationType !== WildoLocationType.REMOTE) {\n ctx.addIssue({\n code: 'custom',\n path: ['platformStorage'],\n message:\n 'platformStorage is only valid in a REMOTE environment — a local platform is shared by every '\n + 'application beside it and uses the fixed platform bucket. Author it only in wildo.infra.remote.config.ts.',\n });\n }\n\n /*\n * #2303 — a service profile and a declaration that contradict it. `backingServices.clamav` / `.immudb`\n * with `source: SELF` asks the environment to RUN a service the profile says it does not run; neither\n * can win silently, so the descriptor is refused here, while it is open. The compose generator refuses\n * the same pair again (an invariant enforced at one site is enforced at none of the others).\n */\n if (config.serviceProfile !== undefined) {\n // #2303 — both lanes render a profile now (the Kubernetes manifests since the second slice), so a KUBERNETES\n // environment may declare one; its refusal was the stand-in for a lane that ignored the declaration.\n const databaseFamilies = databaseFamiliesRunByEnvironment(config);\n if (environmentServiceProfileRunsOneDatabaseFamily(config.serviceProfile) && config.infrastructureHost === undefined && databaseFamilies.size > 1) {\n ctx.addIssue({\n code: 'custom',\n path: ['serviceProfile'],\n message:\n `serviceProfile '${config.serviceProfile}' runs ONE database family, and this environment runs `\n + `${[...databaseFamilies.entries()].map(([engine, why]) => `${engine} (${why.join(', ')})`).join(' and ')}. `\n + 'Put the platform and the application on the same engine (`database.engine` and `applicationDatabase.engine`) '\n + `and declare only that store in \\`backingServices\\`, or set serviceProfile to '${EnvironmentServiceProfile.FULL}'.`,\n });\n }\n for (const [kind, service] of [\n [BackingServiceKind.CLAMAV, EnvironmentServiceProfileOptionalService.ANTIVIRUS_SCANNER],\n [BackingServiceKind.IMMUDB, EnvironmentServiceProfileOptionalService.IMMUTABLE_AUDIT_STORE],\n ] as const) {\n if (\n config.backingServices[kind]?.source === BackingServiceSource.SELF\n && environmentServiceProfileOmits(config.serviceProfile, service)\n ) {\n ctx.addIssue({\n code: 'custom',\n path: ['backingServices', kind],\n message:\n `${describeServiceOmittedByEnvironmentServiceProfile(config.serviceProfile, service)} `\n + `\\`backingServices.${kind}: { source: SELF }\\` asks it to run one. Remove the declaration, or set `\n + `serviceProfile to '${EnvironmentServiceProfile.FULL}'.`,\n });\n }\n }\n }\n\n if (config.cdn && resolvedLocationType !== WildoLocationType.REMOTE) {\n for (const serviceKey of Object.keys(config.cdn)) {\n ctx.addIssue({\n code: 'custom',\n path: ['cdn', serviceKey],\n message:\n `cdn.${serviceKey} is only valid in a REMOTE environment — CDN serving replaces the `\n + `frontend's nginx pod, which local dev does not have. Author cdn blocks only in `\n + `wildo.infra.remote.config.ts (staging / production).`,\n });\n }\n }\n});\n\nexport const WildoInfraEnvConfigSchema = WildoInfraEnvConfigInputSchema.transform((config) => {\n const environment = config.environment;\n const locationType = config.locationType\n ?? (isLocalEnvironmentId(environment) ? WildoLocationType.LOCAL : WildoLocationType.REMOTE);\n\n return {\n environment,\n locationType,\n runtimeEnvironment: config.runtimeEnvironment,\n runtime: config.runtime,\n /**\n * Resolved here rather than left `undefined` for a downstream consumer to default, so every\n * reader sees one answer. The derivation is total over `WildoLocationType`.\n */\n localDataStorage: config.localDataStorage ?? resolveDefaultLocalDataStorage(locationType),\n /** Resolved here, like `localDataStorage`, so every reader sees the settled answer (#2303). */\n serviceProfile: config.serviceProfile ?? DEFAULT_ENVIRONMENT_SERVICE_PROFILE,\n /**\n * Projected EXPLICITLY, like every field here — this list IS the contract, and a field omitted\n * from it is silently dropped no matter what the input schema accepted. `undefined` when the\n * environment does not author one, which is the signal downstream consumers use to fall back to\n * `inferDatabaseChoiceFromInfraConfig`.\n */\n database: config.database,\n applicationDatabase: config.applicationDatabase,\n publicDomain: config.publicDomain,\n serviceHosts: config.serviceHosts,\n kubernetes: config.kubernetes,\n remoteProvider: config.remoteProvider,\n deployment: config.deployment,\n backingServices: config.backingServices,\n logging: config.logging,\n observability: config.observability,\n providerSelection: config.providerSelection,\n providerConfigurations: config.providerConfigurations,\n email: config.email,\n agentContentGuardrails: config.agentContentGuardrails,\n ownershipDnsStandIn: config.ownershipDnsStandIn,\n applicationCreationVerification: config.applicationCreationVerification,\n serviceAuth: config.serviceAuth,\n csp: config.csp,\n cdn: config.cdn,\n systemsOfRecord: config.systemsOfRecord,\n platformStorage: config.platformStorage,\n platformKeyManagement: config.platformKeyManagement,\n documentationSite: config.documentationSite,\n devCompanion: config.devCompanion,\n infrastructureHost: config.infrastructureHost,\n };\n});\n\nexport type WildoInfraEnvConfig = z.output<typeof WildoInfraEnvConfigSchema>;\nexport type WildoInfraEnvConfigInput = z.input<typeof WildoInfraEnvConfigSchema>;\n\n// =============================================================================\n// Hosted environment descriptors — an application running on another application's infrastructure\n// =============================================================================\n\n/**\n * Who decides one member of an environment descriptor when the application is HOSTED.\n *\n * Several applications share one platform per environment: one application OWNS the infrastructure\n * (the platform services and every backing service), and the others reference it through\n * `infrastructureHost`. Each member of the descriptor belongs to exactly one side, and this vocabulary is\n * how that is stated — per member, in {@link INFRA_ENV_FIELD_OWNERSHIP}, so a member added tomorrow cannot\n * compile until somebody decides whose it is.\n */\nexport enum InfraEnvFieldOwner {\n /**\n * The hosted application authors it, and it may differ from the host's: its public domain, its CSP,\n * its provider choices, its companion port. Taken verbatim from the hosted descriptor.\n */\n APPLICATION = 'application',\n /**\n * The host decides it, and a hosted descriptor may not author it: the runtime, the platform database,\n * the cluster, the remote provider, the platform bucket. Authoring one in a hosted descriptor is\n * refused — two applications on one platform cannot disagree about what that platform is.\n */\n HOST = 'host',\n /**\n * Split inside the member. Backing services: the host owns each SERVER (`source`, `host`, `port`,\n * `provider`, `endpoint`), the application owns its NAME on that server (database, vhost, bucket).\n * Kubernetes: the host owns the namespace and ingress class, the application its replica counts.\n * Deployment: the host owns the runtime, the application its branch and image tagging.\n */\n PARTITIONED = 'partitioned',\n /**\n * Produced by resolution and never authored in its resolved form (`infrastructureHost`).\n */\n RESOLUTION = 'resolution',\n}\n\n/**\n * Whose decision each member of a standalone descriptor is, when the application is hosted.\n *\n * Total over {@link WILDO_INFRA_ENV_CONFIG_SHAPE} by type, which is the point: `providerConfigurations`\n * landed on the shape while this feature was being written, and a hosted descriptor built from a\n * hand-kept list would have dropped it silently. `hosted-infra-env-config.test.ts` pins that the hosted\n * schema accepts exactly the APPLICATION and PARTITIONED members.\n */\nexport const INFRA_ENV_FIELD_OWNERSHIP: Readonly<Record<keyof typeof WILDO_INFRA_ENV_CONFIG_SHAPE, InfraEnvFieldOwner>> = {\n environment: InfraEnvFieldOwner.APPLICATION,\n locationType: InfraEnvFieldOwner.HOST,\n runtimeEnvironment: InfraEnvFieldOwner.HOST,\n runtime: InfraEnvFieldOwner.HOST,\n /*\n * HOST. It says how the SHARED backing services store their data, and there is one set of those\n * containers per platform — a hosted application cannot have mongod keep its data in a volume\n * while the host keeps it on a bind mount, because it is the same mongod. Same family as\n * `runtime` and `database`: a property of the substrate, not of anyone running on it. The host\n * also writes the compose file this member shapes, so a hosted descriptor authoring it would be\n * describing a file it does not own.\n */\n localDataStorage: InfraEnvFieldOwner.HOST,\n /*\n * HOST, for the same reason as `localDataStorage`: it decides which containers the SHARED platform runs.\n * A hosted application cannot ask for an immudb its host does not run, and the profile reaches it from\n * the host so its boot refuses a capability the shared platform does not back (#2303).\n */\n serviceProfile: InfraEnvFieldOwner.HOST,\n database: InfraEnvFieldOwner.HOST,\n applicationDatabase: InfraEnvFieldOwner.APPLICATION,\n publicDomain: InfraEnvFieldOwner.APPLICATION,\n serviceHosts: InfraEnvFieldOwner.APPLICATION,\n kubernetes: InfraEnvFieldOwner.PARTITIONED,\n remoteProvider: InfraEnvFieldOwner.HOST,\n deployment: InfraEnvFieldOwner.PARTITIONED,\n backingServices: InfraEnvFieldOwner.PARTITIONED,\n logging: InfraEnvFieldOwner.APPLICATION,\n /*\n * APPLICATION, deliberately: `enabled` and `llmObservability` are per-application postures. The OTLP\n * `endpoint` usually names the shared collector, and nothing stops an application pointing its own\n * telemetry elsewhere — that is a destination choice, not a divergence in what the platform runs.\n */\n observability: InfraEnvFieldOwner.APPLICATION,\n providerSelection: InfraEnvFieldOwner.APPLICATION,\n providerConfigurations: InfraEnvFieldOwner.APPLICATION,\n /*\n * APPLICATION. The receiving domain is THIS application's address space in this environment: two applications on one\n * platform receive on different domains, and a hosted application inheriting its host's would route its mail into\n * another tenant's organizations.\n */\n email: InfraEnvFieldOwner.APPLICATION,\n /*\n * APPLICATION. Whether THIS application's agents run unguarded where no classifier offers a guardrail is a decision about its\n * own agents; an application hosted on another's platform does not inherit its host's.\n */\n agentContentGuardrails: InfraEnvFieldOwner.APPLICATION,\n /*\n * APPLICATION. The stand-in answers for the domains THIS application's tenants prove they own on a developer machine —\n * the double standing in for their corporate IT. A hosted application inheriting its host's would verify its tenants'\n * domains against another application's test double.\n */\n ownershipDnsStandIn: InfraEnvFieldOwner.APPLICATION,\n /*\n * APPLICATION. `systemsOfRecord` says where the instances THIS application declares in its saas config live in\n * this environment — an external system it reads from (an ERP), never part of the shared substrate its host\n * runs. Two applications on one platform read from different systems, or from none: handing a hosted\n * application its host's ERP address and credential would be a cross-tenant read nobody asked for, and\n * `{ enabled: false }` is exactly how an environment says it has no access.\n */\n systemsOfRecord: InfraEnvFieldOwner.APPLICATION,\n documentationSite: InfraEnvFieldOwner.APPLICATION,\n applicationCreationVerification: InfraEnvFieldOwner.APPLICATION,\n serviceAuth: InfraEnvFieldOwner.APPLICATION,\n csp: InfraEnvFieldOwner.APPLICATION,\n cdn: InfraEnvFieldOwner.APPLICATION,\n platformStorage: InfraEnvFieldOwner.HOST,\n /*\n * HOST. One apps-manager holds one Vault for every application on the platform, and the host writes the compose file\n * and manifests that run it; a hosted application authoring it would be describing a custodian it does not run.\n */\n platformKeyManagement: InfraEnvFieldOwner.HOST,\n devCompanion: InfraEnvFieldOwner.APPLICATION,\n infrastructureHost: InfraEnvFieldOwner.RESOLUTION,\n};\n\n/**\n * Which field of a backing-service entry names the APPLICATION'S OWN slice of a shared server.\n *\n * `mustDifferFromHost` is true where the framework's fallback for an unnamed slice is a SHARED constant —\n * `'wildo_app'` for a Mongo or PostgreSQL database, the default vhost `/`, the fixed platform bucket. On\n * those servers two applications that name the same slice are one application's data, silently, so a\n * hosted application must name its own and it must not be the host's. Redis is exempt: every application\n * already shares index 0, isolated by its own ACL principal and key prefix. Immudb's `database` has no\n * consumer today, so it is stripped from the host's entry and not authored by the hosted one.\n */\nexport const BACKING_SERVICE_APPLICATION_NAME_FIELDS = {\n [BackingServiceKind.MONGODB]: { field: 'database', mustDifferFromHost: true },\n [BackingServiceKind.REDIS]: { field: 'database', mustDifferFromHost: false },\n [BackingServiceKind.RABBITMQ]: { field: 'vhost', mustDifferFromHost: true },\n [BackingServiceKind.S3]: { field: 'bucket', mustDifferFromHost: true },\n [BackingServiceKind.POSTGRESQL]: { field: 'database', mustDifferFromHost: true },\n [BackingServiceKind.CLAMAV]: null,\n [BackingServiceKind.IMMUDB]: { field: 'database', mustDifferFromHost: false },\n} as const satisfies Record<BackingServiceKind, { field: string; mustDifferFromHost: boolean } | null>;\n\n/**\n * Error-map for a strict object whose unknown keys are almost always host-owned members an author\n * carried over from a standalone descriptor. Zod's own \"Unrecognized key\" names the key but not the\n * reason, and the reason is the whole lesson.\n */\nfunction refuseHostOwnedKeys(scope: string): { error: (issue: { code?: string; keys?: readonly string[] }) => string | undefined } {\n return {\n error: (issue) => {\n if (issue.code !== 'unrecognized_keys' || !issue.keys?.length) return undefined;\n const keys = issue.keys.map((key) => `\\`${key}\\``).join(', ');\n return `${scope}: ${keys} cannot be authored by a hosted application. Its infrastructure host decides `\n + 'the platform (runtime, database, cluster, remote provider, platform storage) and every backing-service '\n + 'server; a hosted application authors only its own names on those servers (database, vhost, bucket).';\n },\n };\n}\n\nconst HOSTED_BACKING_SERVICES_SHAPE = {\n [BackingServiceKind.MONGODB]: z.strictObject({ database: z.string().min(1) }, refuseHostOwnedKeys('backingServices.mongodb')).optional(),\n [BackingServiceKind.REDIS]: z.strictObject({ database: z.number().int().min(0).max(15).optional() }, refuseHostOwnedKeys('backingServices.redis')).optional(),\n [BackingServiceKind.RABBITMQ]: z.strictObject({ vhost: z.string().min(1) }, refuseHostOwnedKeys('backingServices.rabbitmq')).optional(),\n [BackingServiceKind.S3]: z.strictObject({ bucket: z.string().min(1) }, refuseHostOwnedKeys('backingServices.s3')).optional(),\n [BackingServiceKind.POSTGRESQL]: z.strictObject({ database: z.string().min(1) }, refuseHostOwnedKeys('backingServices.postgresql')).optional(),\n [BackingServiceKind.CLAMAV]: z.strictObject({}, refuseHostOwnedKeys('backingServices.clamav')).optional(),\n [BackingServiceKind.IMMUDB]: z.strictObject({}, refuseHostOwnedKeys('backingServices.immudb')).optional(),\n} satisfies Record<BackingServiceKind, z.ZodOptional<z.ZodType>>;\n\n/**\n * The backing services a HOSTED application uses — each one a store its host must declare.\n *\n * Listing a kind is how the application states it NEEDS that store; the entry carries only the\n * application's own name on the host's server. Every name field is REQUIRED where\n * {@link BACKING_SERVICE_APPLICATION_NAME_FIELDS} says the unnamed fallback is shared.\n */\nexport const HostedBackingServicesEnvConfigSchema = z.strictObject(HOSTED_BACKING_SERVICES_SHAPE, refuseHostOwnedKeys('backingServices'));\nexport type HostedBackingServicesEnvConfig = z.output<typeof HostedBackingServicesEnvConfigSchema>;\n\n/** @wildo_source:part:start platform.config.infrastructure-host facet:layer:platform facet:family:bootstrap facet:audience:app-developer */\n/**\n * An environment descriptor for an application that runs on ANOTHER application's infrastructure.\n *\n * One application per environment owns the infrastructure — its platform services (apps-manager,\n * module-registry, crontabs) and every backing service. Other applications declare that owner as their\n * `infrastructureHost` and author only what is theirs: domain, CSP, provider choices, companion address,\n * and their own database/vhost/bucket names on the host's servers. Everything else comes from the host's\n * descriptor for the SAME environment when the descriptor is loaded, so the two cannot diverge — not in\n * which stores exist, not in how they are reached, not between Docker Compose and Kubernetes.\n *\n * The link is per environment: author it in `wildo.infra.local.config.ts` to share a local platform while\n * `staging` stays standalone, or in both.\n *\n * Refusals, all at load time, all naming both descriptors:\n * - the host root holds no `wildo.saas.config.ts` — a hosted application needs its host's SOURCE checked\n * out at that path;\n * - the host has no descriptor for this environment, or is itself hosted;\n * - a store this application lists is not declared by the host;\n * - a database, vhost or bucket name equals the host's.\n *\n * @example Wonder CRM on Wonder Todos' local platform.\n * ```ts\n * export default defineHostedInfraEnvConfig({\n * environment: WildoEnvironment.LOCAL,\n * infrastructureHost: { applicationRoot: '../wonder-todos' },\n * publicDomain: 'localhost',\n * applicationDatabase: { engine: DatabaseEngine.POSTGRESQL },\n * backingServices: {\n * postgresql: { database: 'wonder-crm-db' },\n * redis: { database: 0 },\n * rabbitmq: { vhost: 'wonder-crm' },\n * s3: { bucket: 'wonder-crm-local' },\n * },\n * devCompanion: { host: 'localhost', port: 4351 },\n * });\n * ```\n */\nexport const WildoHostedInfraEnvConfigSchema = z.strictObject({\n infrastructureHost: z.strictObject({\n /**\n * The host application's root — the directory holding its `wildo.saas.config.ts` — RELATIVE to this\n * application's root. Relative because the descriptor is committed: an absolute path is one machine's\n * checkout layout, and would break on every other.\n */\n applicationRoot: z.string().min(1).refine(\n (value) => !ABSOLUTE_PATH_PATTERN.test(value),\n 'infrastructureHost.applicationRoot must be relative to this application root (e.g. \"../wonder-todos\"): the descriptor is committed, and an absolute path only exists on one machine.',\n ),\n }, refuseHostOwnedKeys('infrastructureHost')),\n environment: WILDO_INFRA_ENV_CONFIG_SHAPE.environment,\n applicationDatabase: WILDO_INFRA_ENV_CONFIG_SHAPE.applicationDatabase,\n publicDomain: WILDO_INFRA_ENV_CONFIG_SHAPE.publicDomain,\n serviceHosts: WILDO_INFRA_ENV_CONFIG_SHAPE.serviceHosts,\n kubernetes: z.strictObject({\n services: WildoKubernetesConfigSchema.shape.services,\n }, refuseHostOwnedKeys('kubernetes')).optional(),\n deployment: z.strictObject({\n branch: z.string().min(1),\n imageTagStrategy: z.enum(WildoImageTagStrategy).optional(),\n // No `registry`: images live at the host's `remoteProvider.registryEndpoint`, which its manifests pull from (#1165).\n }, refuseHostOwnedKeys('deployment')).optional(),\n backingServices: HostedBackingServicesEnvConfigSchema.optional(),\n logging: WILDO_INFRA_ENV_CONFIG_SHAPE.logging,\n observability: WILDO_INFRA_ENV_CONFIG_SHAPE.observability,\n providerSelection: WILDO_INFRA_ENV_CONFIG_SHAPE.providerSelection,\n providerConfigurations: WILDO_INFRA_ENV_CONFIG_SHAPE.providerConfigurations,\n email: WILDO_INFRA_ENV_CONFIG_SHAPE.email,\n agentContentGuardrails: WILDO_INFRA_ENV_CONFIG_SHAPE.agentContentGuardrails,\n ownershipDnsStandIn: WILDO_INFRA_ENV_CONFIG_SHAPE.ownershipDnsStandIn,\n systemsOfRecord: WILDO_INFRA_ENV_CONFIG_SHAPE.systemsOfRecord,\n documentationSite: WILDO_INFRA_ENV_CONFIG_SHAPE.documentationSite,\n applicationCreationVerification: WILDO_INFRA_ENV_CONFIG_SHAPE.applicationCreationVerification,\n serviceAuth: WILDO_INFRA_ENV_CONFIG_SHAPE.serviceAuth,\n csp: WILDO_INFRA_ENV_CONFIG_SHAPE.csp,\n cdn: WILDO_INFRA_ENV_CONFIG_SHAPE.cdn,\n devCompanion: WILDO_INFRA_ENV_CONFIG_SHAPE.devCompanion,\n}, refuseHostOwnedKeys('a hosted environment descriptor'));\n/** @wildo_source:part:end platform.config.infrastructure-host */\n\nexport type WildoHostedInfraEnvConfig = z.output<typeof WildoHostedInfraEnvConfigSchema>;\nexport type WildoHostedInfraEnvConfigInput = z.input<typeof WildoHostedInfraEnvConfigSchema>;\n\n/**\n * What an authored `wildo.infra.<env>.config.ts` evaluates to: a standalone descriptor, or a hosted one\n * that is NOT usable until `loadInfraEnvConfig` resolves it against its host.\n */\nexport type WildoAuthoredInfraEnvConfig = WildoInfraEnvConfig | WildoHostedInfraEnvConfig;\n\n/**\n * Whether an evaluated descriptor is a hosted one still awaiting resolution.\n *\n * Keyed on the AUTHORED key, exactly as {@link defineInfraEnvConfig} dispatches: an `infrastructureHost`\n * in its authored form, which names a relative root and no `infraConfigPath`. A RESOLVED hosted\n * environment carries `infraConfigPath` and is a {@link WildoInfraEnvConfig} — consumers ask\n * `config.infrastructureHost !== undefined` for that.\n *\n * An earlier revision keyed on the absence of `runtime`, reasoning that every standalone descriptor\n * requires it. That holds for a descriptor built through `defineInfraEnvConfig` and not for a plain\n * `export default {…}` object, which the loader also evaluates: a partial standalone descriptor with no\n * `runtime` was read as hosted and crashed on its missing host. Discriminate on what the author wrote,\n * never on what a schema happens to require.\n */\nexport function isHostedInfraEnvConfig(config: WildoAuthoredInfraEnvConfig): config is WildoHostedInfraEnvConfig {\n const host = (config as { infrastructureHost?: object }).infrastructureHost;\n return host !== undefined && host !== null && !('infraConfigPath' in host);\n}\n\n/**\n * Define an app-owned environment descriptor under `infrastructure/<env>`.\n *\n * This is the canonical authored env contract for the flattened targeted-app\n * layout.\n */\nexport function defineInfraEnvConfig(config: WildoInfraEnvConfigInput): WildoInfraEnvConfig {\n /*\n * An `infrastructureHost` is never authored here: a hosted environment is a different descriptor with its\n * own entry point, and its resolved form (absolute paths) is produced only by `loadInfraEnvConfig`.\n * Refused by name before the schema runs, because the schema's own complaint (\"must be absolute once\n * resolved\") would send the author in the wrong direction.\n */\n if ((config as { infrastructureHost?: unknown }).infrastructureHost !== undefined) {\n throw new Error(\n 'defineInfraEnvConfig describes an environment that OWNS its infrastructure, so it takes no infrastructureHost. '\n + 'An application running on another application\\'s infrastructure is declared with defineHostedInfraEnvConfig({ '\n + 'infrastructureHost: { applicationRoot: \\'../<host-app>\\' }, … }).',\n );\n }\n return WildoInfraEnvConfigSchema.parse(config);\n}\n\n/**\n * Define an environment descriptor for an application that runs on ANOTHER application's infrastructure.\n * See {@link WildoHostedInfraEnvConfigSchema} for what it may author and what comes from the host.\n *\n * A separate entry point rather than a variant of {@link defineInfraEnvConfig}, deliberately. \"This\n * environment owns its platform\" and \"this environment runs on someone else's\" are different decisions\n * with different fields, and one function accepting both made a type error in either shape report as \"No\n * overload matches this call\" at the call instead of at the offending property — worse feedback for every\n * author of every descriptor, standalone ones included.\n *\n * The result is NOT an environment yet: `loadInfraEnvConfig` resolves it against the host.\n */\nexport function defineHostedInfraEnvConfig(config: WildoHostedInfraEnvConfigInput): WildoHostedInfraEnvConfig {\n return WildoHostedInfraEnvConfigSchema.parse(config);\n}\n\n"]}
1
+ {"version":3,"file":"define-infra-env-config.js","sourceRoot":"","sources":["../../../src/project-config/define-infra-env-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC9H,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,2CAA2C,EAAE,MAAM,oDAAoD,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAC7H,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mCAAmC,E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AM,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import { EnvironmentAgentContentGuardrailsSchema, InboundEmailConfigSchema, RuntimeEnvironment } from '@wildo-ai/saas-models';\nimport { z } from 'zod';\nimport { WildoAuthConfigSchema } from './shared/auth.schemas';\nimport { ApplicationCreationVerificationConfigSchema } from './shared/application-creation-verification.schemas';\nimport { BackingServiceKind, BackingServiceSource, BackingServicesEnvConfigSchema } from './shared/backing-services.schemas';\nimport { WildoCdnConfigSchema } from './shared/cdn.schemas';\nimport { WildoSystemsOfRecordEnvConfigSchema } from './shared/systems-of-record-env.schemas';\nimport { WildoPlatformStorageConfigSchema } from './shared/platform-storage.schemas';\nimport { WildoPlatformKeyManagementConfigSchema } from './shared/platform-key-management.schemas';\nimport { EnvCspOverrideSchema } from './shared/csp.schemas';\nimport {\n InfraServiceAddressingSchema,\n} from './shared/infra-service.schemas';\nimport {\n DatabaseEngine,\n resolveApplicationDatabaseEngine,\n WildoDeploymentConfigSchema,\n WildoDeploymentRuntime,\n WildoEnvironment,\n WildoEnvironmentIdSchema,\n WildoKubernetesConfigSchema,\n WildoLocationType,\n WildoLocalDataStorage,\n resolveDefaultLocalDataStorage,\n DEFAULT_ENVIRONMENT_SERVICE_PROFILE,\n EnvironmentServiceProfile,\n EnvironmentServiceProfileOptionalService,\n describeServiceOmittedByEnvironmentServiceProfile,\n environmentServiceProfileOmits,\n environmentServiceProfileRunsMessageBroker,\n environmentServiceProfileRunsOneDatabaseFamily,\n WildoLoggingConfigSchema,\n WildoObservabilityConfigSchema,\n WildoDocumentationSiteConfigSchema,\n WildoEnvironmentProviderConfigurationsSchema,\n WildoProviderSelectionOverridesSchema,\n WildoRemoteProviderSchema,\n WildoImageTagStrategy,\n isLocalEnvironmentId,\n} from './shared/environment.schemas';\n\nconst InfraEnvKubernetesSchema = WildoKubernetesConfigSchema.strict();\n\n/**\n * A POSIX (`/…`), drive-letter (`C:\\…`, `C:/…`) or UNC (`\\\\host\\…`) absolute path.\n *\n * A pattern rather than `node:path`'s `isAbsolute` so the verdict does not depend on the platform the\n * descriptor happens to be evaluated on: a Windows path committed by one developer must read as absolute\n * on another's macOS machine too, or a machine-local host path could slip into a committed descriptor.\n */\nconst ABSOLUTE_PATH_PATTERN = /^(?:\\/|[A-Za-z]:[\\\\/]|\\\\\\\\)/;\n\n/**\n * DNS subdomain chain regex: one or more lowercase RFC 1123 labels\n * joined by dots. Empty string is allowed separately via the union\n * below — it means \"this service lives at the apex of `publicDomain`\".\n *\n * Examples accepted: `'app'`, `'docs'`, `'dev'`, `'www2'`, `'admin.ops'`.\n * Examples rejected: `'App'` (uppercase), `'-app'` / `'app-'`\n * (dash at boundary), `'app..docs'` / `'.app'` / `'app.'` (malformed\n * dots), `'a/b'` (non-DNS character).\n */\nconst SERVICE_HOST_LABEL = /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/;\n\n/**\n * Per-service public hostname mapping, authored per-environment.\n *\n * - **Keys** are service keys from `wildo.saas.config.ts`\n * (`config.services.<key>`). The mapping is NOT validated against\n * the SaaS config at the Zod level (the two configs live in\n * separate files and are parsed independently). Cross-file\n * validation against the SaaS-config service registry is the\n * responsibility of consumers that wire the two parsed configs\n * together (URL composers, ingress manifest generators) — each\n * consumer enforces it at the seam where both configs are in\n * scope. This schema cannot enforce it standalone.\n * - **Values** are the subdomain chain prefixed to `publicDomain`, OR\n * the empty string for apex. Composed as\n * `https://${value ? `${value}.` : ''}${publicDomain}`.\n *\n * The mapping is intentionally per-environment (living inside\n * `wildo.infra.<env>.config.ts`) because local / staging / production\n * routinely have different topologies — e.g., local collapses\n * everything to `localhost`, staging mounts everything under\n * `*.staging.example.com`, production uses bespoke subdomains like\n * `app.example.com` + `dev.example.com` for docs. Binding the\n * hostname to a frontend kind or to the service key would force a\n * single topology on every environment; the per-env map keeps those\n * decisions explicit and author-driven.\n *\n * The URL composer that builds cross-frontend handoff URLs consumes\n * this mapping.\n */\nconst ServiceHostValueSchema = z.string()\n .refine(\n (value) => value === '' || SERVICE_HOST_LABEL.test(value),\n 'serviceHosts value must be a lowercase DNS subdomain chain (e.g. \"app\", \"docs\", \"dev.admin\") or \"\" (empty string, meaning apex).',\n );\n\nconst ServiceHostsMapSchema = z.record(z.string().min(1), ServiceHostValueSchema);\n/**\n * Per-environment email values, laid over `email` in the backend configuration (`saas-config.backend.ts`) for THIS\n * environment only.\n *\n * `inbound.sharedDomain` is the shared receiving domain: every organization is reachable at `{slug}@{sharedDomain}`,\n * and the domain's MX points at the receiving provider. It is a property of a DEPLOYMENT, not of the application: a\n * local stack receives through a developer's own provider account (Resend assigns each account an `<id>.resend.app`\n * domain), staging and production through their own domains, and one constant in the backend configuration made every\n * environment claim the same domain — or, kept generic, made local receiving impossible to exercise. Validated by the\n * same schema the backend configuration uses (`InboundEmailConfigSchema.shape.sharedDomain`), so the two cannot\n * disagree about what a domain is.\n *\n * Projected to `WILDO_INBOUND_EMAIL_SHARED_DOMAIN` by `env-vars-builder`; the backend's inbound services read it\n * through `resolveInboundEmailConfig`, where it wins over the authored value. Absent, the authored value applies.\n */\nexport const WildoInfraEmailConfigSchema = z.strictObject({\n inbound: z.strictObject({\n sharedDomain: InboundEmailConfigSchema.shape.sharedDomain,\n }).optional(),\n});\n\nexport type WildoInfraEmailConfig = z.output<typeof WildoInfraEmailConfigSchema>;\n\n/**\n * Where THIS local environment's ownership-DNS stand-in answers (#2519): the development/test double that answers a\n * domain-ownership challenge for a name nobody can publish — a corporate domain such as `wonder-group.test`, whose\n * \"IT department\" on a developer machine is a test double (`client-org-mock`) rather than a DNS zone.\n *\n * A domain-ownership proof is what PUBLIC DNS says, everywhere else. So this is LOCAL-ONLY — refused by this schema in\n * any other environment — and the backend honours it only where its declared runtime environment is development or\n * test, and REFUSES TO START with it set anywhere else (`assertOwnershipDnsStandInAdmitted` in the backend). The\n * stand-in answers `GET {baseUrl}/__wildo/dns/txt?name=<name>` with `{ \"records\": [\"…\"] }`.\n *\n * Projected to `WILDO_OWNERSHIP_DNS_STAND_IN_URL` (`PlatformOwnershipDnsEnvKey`) by `env-vars-builder`, for the\n * application backend that serves the domain-ownership doors. Absent, every ownership challenge asks public DNS.\n */\nexport const WildoOwnershipDnsStandInConfigSchema = z.strictObject({\n // http(s) only: a bare `z.url()` admits `localhost:18319` as a URL whose SCHEME is `localhost:`, which the backend\n // would then fail to fetch at the first verification instead of here.\n baseUrl: z.url({ protocol: /^https?$/ }).describe(\"The stand-in's base URL, e.g. `http://localhost:18319`. Its DNS path is appended to it.\"),\n});\n\nexport type WildoOwnershipDnsStandInConfig = z.output<typeof WildoOwnershipDnsStandInConfigSchema>;\n\n/**\n * The shape of a STANDALONE environment descriptor — one that owns its infrastructure.\n *\n * Kept as a plain object rather than inlined into `z.object(...)` because the HOSTED descriptor\n * ({@link WildoHostedInfraEnvConfigSchema}) is built from a subset of these same members. Zod 4 refuses\n * `.pick()` on an object that carries refinements, so sharing the members is the only way the two\n * descriptors can agree on what an application-owned field IS without restating it.\n */\nconst WILDO_INFRA_ENV_CONFIG_SHAPE = {\n /*\n * No `version` key, deliberately (#3496): the descriptor's compatibility is fixed by the `@wildo-ai/*` release the\n * application installs, exactly as for `wildo.saas.config.ts`. The strict object refuses one if it is authored.\n */\n environment: WildoEnvironmentIdSchema,\n locationType: z.enum(WildoLocationType).optional(),\n runtimeEnvironment: z.enum(RuntimeEnvironment).optional(),\n runtime: z.enum(WildoDeploymentRuntime),\n /**\n * Where the self-hosted backing services of a DOCKER_COMPOSE environment keep their data —\n * a Docker named volume, or a bind mount onto `<saas-root>/.wildo-saas/local_data/<service>/`.\n *\n * Omit it and the environment takes {@link resolveDefaultLocalDataStorage}: a named volume\n * locally (the host-filesystem crossing costs ~4 CPU cores on macOS and Windows, and a named\n * volume costs a Linux developer nothing), a host path remotely (the operator chooses the disk\n * the database lands on). Author it to say otherwise — a remote deployment happy with Docker's\n * own storage, or a local developer who wants to read the files directly.\n *\n * Ignored by KUBERNETES environments, which take their storage from PVs rather than from here.\n */\n localDataStorage: z.enum(WildoLocalDataStorage).optional(),\n /**\n * Which optional backing services this environment runs — its footprint (#2303). Omit it and the\n * environment runs `FULL`, every service its declarations ask for.\n *\n * `SMALL` runs no ClamAV, no immudb and no mongot. A small internal tool usually needs none of them, and\n * they are the heaviest containers in the stack. Each capability that depends on one is REFUSED at the\n * application's boot when the application declares it, with a message naming this profile and the remedy:\n * a `z_file({ scanPolicy: 'required' })` field (antivirus), an enabled `COMPLIANCE_AUDIT_TRAIL` with no\n * external audit store (immudb), a `.ragSource()` field on a MongoDB-persisted resource (mongot; on\n * PostgreSQL pgvector serves vector search inside the database, so it stays available).\n *\n * Moving between profiles migrates no data: a service the profile adds starts empty (an audit store with\n * no history, a search index that mongot builds from the collections), and one it removes leaves its\n * data where it was.\n *\n * Docker Compose environments only for now: a KUBERNETES environment declaring a non-`FULL` profile is\n * refused, because its manifests would ignore it.\n */\n serviceProfile: z.enum(EnvironmentServiceProfile).optional(),\n /**\n * The store the PLATFORM's own data lives in (apps-manager + module-registry:\n * users, organizations, applications, sessions, API keys).\n *\n * **This is a DECLARED property of the environment, and that is the whole point.** It used to\n * exist only as an answer to an interactive prompt, persisted to the machine-local\n * `environments.json` — so it could not be committed, reviewed, or reproduced on a second\n * machine, and a value inferred from which backing services happened to be declared filled the\n * gap. Authoring it here makes it travel with the repository like every other environment\n * property.\n *\n * OPTIONAL. When omitted, the engine is INFERRED from the declared backing services\n * (`inferDatabaseChoiceFromInfraConfig`), which is what every pre-existing environment relies\n * on — so omitting this field preserves today's behaviour exactly. When authored, it is the\n * AUTHORITY and the inference is not consulted.\n *\n * Authoring it is REQUIRED to express a PostgreSQL platform that ALSO runs a mongod, because the\n * inference resolves `postgresql && mongodb` to MongoDB — so that dual-store combination is\n * unreachable by inference, by construction. Since 2026-08-28 a PostgreSQL platform no longer has\n * to declare `backingServices.mongodb` at all (see the refinement below), so the single-store case\n * is now expressible too.\n *\n * @example A PostgreSQL platform, no mongod.\n * ```ts\n * database: { engine: DatabaseEngine.POSTGRESQL, source: BackingServiceSource.SELF },\n * backingServices: { postgresql: { source: BackingServiceSource.SELF } },\n * ```\n *\n * @example A DUAL-STORE platform — PostgreSQL for itself, a mongod beside it for the Mongo-backed\n * applications it hosts. This is the shape that needs `database` authored.\n * ```ts\n * database: { engine: DatabaseEngine.POSTGRESQL, source: BackingServiceSource.SELF },\n * backingServices: {\n * mongodb: { source: BackingServiceSource.SELF },\n * postgresql: { source: BackingServiceSource.SELF },\n * },\n * ```\n *\n * NOTE this is the PLATFORM's engine. An APPLICATION's own store is chosen separately by that\n * application's `DATABASE_DEFAULT_ADAPTER`; declaring `backingServices.postgresql` alone gives an\n * application a PostgreSQL substrate without moving the platform.\n */\n database: z\n .strictObject({\n engine: z.enum(DatabaseEngine),\n source: z.enum(BackingServiceSource),\n /**\n * Managed-brand identifier when `source === MANAGED` — `'atlas'` for Mongo; one of\n * `'aws-rds' | 'gcp-cloud-sql' | 'azure-database' | 'supabase' | 'neon' | 'render'` for\n * Postgres. Mirrors `PlatformEnvConfigJson['database'].provider` exactly; this field is\n * deliberately the same vocabulary rather than a parallel one.\n */\n provider: z.string().min(1).optional(),\n })\n .optional(),\n /** @wildo_source:part:start platform.config.application-database facet:layer:platform facet:family:bootstrap facet:audience:app-developer */\n /**\n * Which declared backing store the APPLICATION's own resources persist to.\n *\n * ## Why this is a SEPARATE field from `database`\n *\n * `database` above is the PLATFORM's engine — where apps-manager's own tables live. This one is the\n * application's, and the two move independently: a PostgreSQL platform can host a MongoDB\n * application and vice versa. Collapsing them would make one decision imply the other, which is\n * exactly the conflation the emitter's own contract warns against.\n *\n * ## Why it carries only `engine`\n *\n * The SUBSTRATE is already declared: `backingServices.postgresql` says where the database is and\n * who provisions it, and `env-vars-builder` already emits `POSTGRESQL_HOST/PORT/DATABASE` to the\n * application backend whenever the environment self-hosts one. What was missing is the SELECTION,\n * and only the selection belongs here.\n *\n * ## Why an authored field rather than an env variable\n *\n * The emitter states the rule this field exists to satisfy: *\"which store an application persists to\n * is a deployment decision that must be legible in one place, not an emergent property of which\n * variables happen to be set\"*. Before this, the only way to select PostgreSQL for an application\n * was to hand-edit `backend-api/.env` — machine-local, ungitted, and not reproducible on another\n * developer's machine. That is the same defect the platform `database` field above was added to\n * remove, and the reason both live in the authored, committed config.\n *\n * Absent means POSTGRESQL (`DEFAULT_APPLICATION_DATABASE_ENGINE`, decided 2026-09-24, #1571), and\n * every reader resolves it through `resolveApplicationDatabaseEngine` rather than re-deriving it —\n * two readers answering silence differently is what stranded an application on 2026-09-15. So an\n * environment that authors nothing here must still declare `backingServices.postgresql`; the\n * refinement below refuses it otherwise.\n *\n * @example An application on PostgreSQL, on a platform that is also on PostgreSQL.\n * ```ts\n * database: { engine: DatabaseEngine.POSTGRESQL, source: BackingServiceSource.SELF },\n * applicationDatabase: { engine: DatabaseEngine.POSTGRESQL },\n * backingServices: {\n * postgresql: { source: BackingServiceSource.SELF, database: 'my-app-db' },\n * },\n * ```\n */\n applicationDatabase: z\n .strictObject({\n engine: z.enum(DatabaseEngine),\n })\n .optional(),\n /**\n * ## Choosing PostgreSQL creates a standing obligation — MIGRATIONS\n *\n * This is the part that is easy to miss, and it is not a detail of deployment: on MongoDB a\n * collection exists the moment something writes to it, so a new resource needs nothing. On\n * PostgreSQL a resource's TABLE is built by a MIGRATION, and nothing creates it implicitly. So on\n * this engine, adding or reshaping a resource owes an artifact:\n *\n * - `wildo db diff` — what separates the model from the accepted plan;\n * - `wildo db generate --name <label>` — writes `backend-api/migrations/<timestamp>_<name>/`\n * AND advances `backend-api/migrations/schema-plan.lock.json`, in one step. Commit them\n * TOGETHER; either one alone is the two-artifact drift the design exists to prevent;\n * - `wildo db migrate` — applies pending migrations by hand. Usually unnecessary: the application\n * backend applies them at BOOT, and `wildo local dev` reconciles drift before the app starts.\n *\n * Skip it and nothing warns until the backend refuses to start with\n * `postgresql_table_schema_mismatch` — an accurate message that names neither the migration nor\n * the command. See the `application-database-migrations` skill.\n */\n /** @wildo_source:part:end platform.config.application-database */\n /**\n * Public domain that browsers and external clients use to reach this\n * deployment. Ingress / reverse proxy / DNS terminate here; every\n * service-level subdomain is mounted under it via {@link serviceHosts}\n * (`https://<serviceHost>.<publicDomain>`, e.g. `app.example.com`; a\n * `serviceHosts` value of `''` mounts the service at the apex). Greenfield,\n * single-app, mono-env — there is NO `<service>-<appSlug>-<env>` fan-out.\n *\n * Applies to BOTH `WildoDeploymentRuntime.KUBERNETES` and\n * `WildoDeploymentRuntime.DOCKER_COMPOSE`. For compose envs without a\n * reverse proxy, author `'localhost'` explicitly. For K8s local,\n * author `'local.wildo.ai'` (or your `*.local` apex). For remote,\n * author your apex (e.g. `'wonder-todos.com'`).\n *\n * NOT to be confused with the K8s-internal service-mesh hostname\n * (`<service>.<namespace>.svc.cluster.local`), which stays implicit\n * and is derived from `kubernetes.namespace` at composition time.\n *\n * REQUIRED — there is no read-time fallback. The default that\n * `wildo init` writes into the generated config file lives in\n * `PUBLIC_DOMAIN_DEFAULTS` (`infrastructure-defaults.schemas.ts`),\n * but the schema enforces explicit authoring so a hand-edited\n * config that drops the field fails Zod parse with a clear error\n * instead of silently falling back.\n */\n publicDomain: z.string().min(1),\n /**\n * Per-service public hostname authoring for this environment.\n *\n * The app developer maps each publicly-exposed service (by its\n * `services.<key>` in `wildo.saas.config.ts`) to the subdomain\n * chain under `publicDomain` where it is reachable in this\n * environment. An empty string value mounts the service at the\n * apex of `publicDomain`.\n *\n * An UNMAPPED service falls back to its own key, lowercased, as its\n * subdomain (`buildServicePublicHost`) — a defined path, not an error;\n * nothing is derived from `frontendType`. Author an entry whenever the\n * key is not the host you want, or is not a valid DNS label. Two\n * services resolving to one host are refused when a REMOTE\n * environment's ingress routes are built (`buildK8sApplicationIngressRoutes`);\n * a local environment builds none and a CDN-served frontend is excluded\n * from them, so neither is checked. (Corrected\n * 2026-09-13: this comment said there was NO derivation from the key,\n * which the resolver has not matched.) An app-dev who wants the\n * docs service to live at `dev.example.com` (rather than the more\n * conventional `docs.example.com`) writes\n * `serviceHosts: { docs: 'dev' }` here; an app-dev who splits\n * marketing across `example.com` and `landing.example.com` can\n * author `serviceHosts: { www: '', landing: 'landing' }` without\n * the framework second-guessing the intent.\n *\n * Field is `.optional()` because many projects (local dev,\n * Docker Compose collapsed to `localhost`, single-frontend SaaS\n * apps) do not need per-service hostname authoring. Downstream\n * consumers (URL composers, ingress manifest generators) MUST\n * handle both \"no mapping authored\" and \"service key not\n * mapped\" as defined fallback paths — never as silent errors.\n */\n serviceHosts: ServiceHostsMapSchema.optional(),\n kubernetes: InfraEnvKubernetesSchema.optional(),\n remoteProvider: WildoRemoteProviderSchema.strict().optional(),\n deployment: WildoDeploymentConfigSchema.optional(),\n backingServices: BackingServicesEnvConfigSchema,\n /**\n * Per-environment logging posture. `level` is projected to `LOG_LEVEL`\n * by `env-vars-builder` for every long-running platform/application\n * process (`LoggerService.loadConfiguration` reads it at boot);\n * `formattedConsoleErrors` is projected to `LOG_FORMATTED_CONSOLE_ERRORS`\n * and overrides the auto-detected pino-pretty / JSON branch for\n * environments that want explicit control. Persisted into\n * `PlatformEnvConfigJson.logging` and hydrated back by\n * `hydrateEnvironmentFromConfig` so the runtime contract survives a\n * `wildo config sync` cycle.\n */\n logging: WildoLoggingConfigSchema.optional(),\n /**\n * Per-environment OTLP telemetry posture (Slice 2 Phase 5). `enabled` is projected to\n * `OTEL_ENABLED` and drives the `--import @wildo-ai/saas-backend-lib/otel-preload` wiring;\n * `endpoint` is projected to `OTEL_EXPORTER_OTLP_ENDPOINT`. The provider auth header\n * (`OTEL_EXPORTER_OTLP_HEADERS`) is derived from the selected `OBSERVABILITY_TELEMETRY`\n * provider's secret by `env-vars-builder`, not authored here. Persisted into\n * `PlatformEnvConfigJson.observability` and hydrated by `hydrateEnvironmentFromConfig`.\n */\n observability: WildoObservabilityConfigSchema.optional(),\n /**\n * Per-environment external-provider SELECTION override. Overrides the\n * app-wide `providers.scopes.backend.selection[capability]` primary/whenUnavailable\n * from `wildo.saas.config.ts` for THIS environment only — e.g. author\n * `providerSelection: { EMAIL_TRANSACTIONAL: { primary: 'email-preview' } }`\n * in `wildo.infra.local.config.ts` so local uses the non-sending\n * `email-preview` provider while remote envs keep the SaaS-config default\n * (`resend`). Projected to `WILDO_PROVIDER_SELECTION_OVERRIDES` by\n * `env-vars-builder` and applied by `ExternalProvidersRegistryBackendService`.\n * See {@link WildoProviderSelectionOverridesSchema}.\n */\n providerSelection: WildoProviderSelectionOverridesSchema.optional(),\n /**\n * Per-environment provider configuration values — an OAuth client ID, a frontend SDK DSN or site key — laid over\n * `wildo.saas.config.ts > providerConfigurations` key by key for THIS environment. Author here every value a vendor\n * issued against one deployment; keep application policy (an agent execution profile) in the SaaS config.\n * Never a secret: those stay in `secrets.json → providerEnv`. See\n * {@link WildoEnvironmentProviderConfigurationsSchema}.\n */\n providerConfigurations: WildoEnvironmentProviderConfigurationsSchema.optional(),\n /**\n * Per-environment email values — today the shared RECEIVING domain, `email.inbound.sharedDomain`, which differs\n * per deployment. See {@link WildoInfraEmailConfigSchema}.\n */\n email: WildoInfraEmailConfigSchema.optional(),\n /**\n * What THIS environment does with the agents' classifier-backed content guardrails (`contentGuardrails.promptInjection`,\n * `.outputModeration`) where no `AI_CONTENT_SAFETY` classifier offers them. Absent means REFUSE: such an agent refuses\n * every turn. `{ withoutClassifier: RUN_UNGUARDED, reason }` runs it unscreened and unmoderated, named at startup and, outside a\n * local environment, listed by `wildo context launch-blockers`. Projected to `WILDO_AGENT_CONTENT_GUARDRAILS` by\n * `env-vars-builder`. See {@link EnvironmentAgentContentGuardrailsSchema}.\n */\n agentContentGuardrails: EnvironmentAgentContentGuardrailsSchema.optional(),\n /**\n * LOCAL-ONLY: the double that answers domain-ownership challenges for names nobody can publish (#2519). See\n * {@link WildoOwnershipDnsStandInConfigSchema}.\n */\n ownershipDnsStandIn: WildoOwnershipDnsStandInConfigSchema.optional(),\n /**\n * Per-environment origins the documentation site is BUILT against.\n *\n * A docs bundle is static, so the origins are compiled in: a bundle built with the\n * wrong ones points every reader at the wrong host rather than failing. Authoring them\n * per environment is what lets `wildo config sync` carry them, instead of an operator\n * remembering three env vars on a build command.\n *\n * Passed as `WILDO_DOCS_API_BASE_URL` / `WILDO_DOCS_APP_URL` /\n * `WILDO_DOCS_FRONTEND_SERVICE_NAME` to the documentation image's build and to the CI workflow, read from the\n * loaded descriptor; no runtime environment carries them (#2310).\n * See {@link WildoDocumentationSiteConfigSchema}.\n */\n documentationSite: WildoDocumentationSiteConfigSchema.optional(),\n /**\n * Local-only operator configuration for application-creation verification.\n * The authored value is snapshotted into generated `config.json` and then\n * projected into the app-root `.env`; `.env` is never the authoring source.\n */\n applicationCreationVerification: ApplicationCreationVerificationConfigSchema.optional(),\n serviceAuth: WildoAuthConfigSchema.strict().optional(),\n /**\n * Per-environment Content-Security-Policy overrides, keyed by SaaS-config\n * service key (parallel to the `serviceHosts` keying convention).\n *\n * # Consumer wiring\n *\n * The generic resolver in `platform-config-lib` accepts this layer,\n * and `wildo dev sync-csp` is the first build-time consumer that\n * threads `parsed.csp[serviceKey]` into generated frontend CSP\n * artifacts and nginx marker rewrites. `defineInfraEnvConfig` still\n * emits a one-line stderr warning for authored service keys that are\n * not explicitly declared as consumed by the current loader; known\n * CSP-capable frontend keys are suppressed by the CLI while it loads\n * the shared infra config.\n *\n * Cross-validation against SaaS-config service keys is not enforceable\n * inside this schema alone because the infra config file is parsed\n * independently. Consumers that load both files together must validate\n * their own seam; `wildo dev sync-csp` rejects unknown `csp.<key>`\n * entries before emitting generated artifacts.\n *\n * # Where this fits in the layered CSP cake\n *\n * 1. Platform default (per-`AppFrontendType` baseline) — `csp-defaults.ts`.\n * 2. App-static (per-frontend `csp?` block) — authored on each\n * service-definition (today: `wildo.tech-doc.config.ts.csp?`).\n * 3. **THIS FIELD** — env-specific overrides authored under\n * `wildo.infra.<env>.config.ts.csp?[serviceKey]`. The\n * `resolveCspPolicy({ envOverride, environmentId })` resolver\n * in `platform-config-lib/src/project-config/shared/csp-emit.ts`\n * accepts this shape, the schema's `superRefine` enforces the\n * LOCAL-only `viteDevLoosening` rule, and `wildo dev sync-csp`\n * reads `parsed.csp[serviceKey]` when generating service-local\n * artifacts.\n *\n * # Why per-env overrides exist\n *\n * - Sentry / DataDog ingest origins differ per deployment (staging\n * vs production violation collectors).\n * - Vite dev mode needs `'unsafe-inline'` + `'unsafe-eval'` in\n * `script-src` (HMR client bootstrap injects an inline `<script>`,\n * module/sourcemap transforms run through `eval()`). The\n * framework auto-applies this for `local` + `SAAS_APP` via the\n * resolver's auto-default; the `viteDevLoosening` field exists\n * only for explicit opt-out (debugging real CSP issues) or for\n * non-canonical envs that also run Vite dev.\n * - Per-env `reportOnly` ramping: ship `reportOnly: true` in\n * staging while the violation collector ramps up, flip to\n * enforcing in prod once the directive overrides settle.\n *\n * # Always additive (resolver contract)\n *\n * Env-layer entries can only LOOSEN policy (`extraDirectives` is\n * APPEND-only over the app-static layer; `reportOnly` / `reportUri`\n * scalars override the app-static value when present;\n * `viteDevLoosening: true` appends `'unsafe-inline'` and\n * `'unsafe-eval'` to `script-src`). There is no `'replace-baseline'`\n * equivalent at this layer — env config exists to LOOSEN per-\n * deployment, not to replace an app's chosen posture. If an env\n * genuinely needs a different posture, the right answer is to fix\n * the app-static layer.\n *\n * # `.optional()` rationale\n *\n * Most environments (local dev, single-frontend SaaS apps that\n * accept the baseline policy verbatim) do not author per-service\n * CSP overrides. Downstream consumers MUST handle both \"no overrides\n * authored\" and \"service key not mapped\" as defined no-op fallbacks\n * — never as silent errors.\n *\n * `EnvCspOverrideSchema` is itself `z.strictObject` (csp.schemas.ts),\n * so unknown keys inside an authored override are rejected at the\n * inner-record level — no need to re-apply `.strict()` at the\n * `z.record` value position.\n */\n csp: z\n .record(z.string().min(1), EnvCspOverrideSchema)\n .optional(),\n /**\n * Per-service OPT-IN to CDN serving, keyed by SaaS-config service key\n * (same keyspace as `serviceHosts` / `csp`). Authoring an `enabled` entry\n * makes the deploy render skip the service's nginx Deployment/Service AND\n * its ingress / compose route — its public host is served off-cluster by a\n * CDN fronting an object-storage bucket, while `runtime.endPoints.publicUrl`\n * stays `<serviceHost>.<publicDomain>` (coherence preserved). See\n * {@link WildoCdnConfigSchema}. `wildo frontend publish` uploads the built\n * `dist/` + re-homes CSP to the edge for these services.\n *\n * `.optional()` — most apps serve every frontend from an nginx pod (no CDN);\n * consumers MUST treat \"no cdn authored\" and \"service key not mapped\" as the\n * defined no-op (nginx-served) fallback. `WildoCdnConfigSchema` is itself\n * `z.strictObject`, so unknown keys inside an authored entry are rejected at\n * the inner level — no `.strict()` needed at the `z.record` value position.\n */\n cdn: z\n .record(z.string().min(1), WildoCdnConfigSchema)\n .optional(),\n /**\n * WHERE each declared system of record lives in THIS environment, keyed by the instance name the\n * saas config declares (#1055). See {@link WildoSystemsOfRecordEnvConfigSchema}: either an address,\n * or `{ enabled: false }` for an environment that has no access to the instance at all.\n *\n * `.optional()` — an application that reads nothing out of another system authors none. An instance\n * the saas config DOES declare and this block omits is refused at `wildo config sync` and at boot,\n * because silence is not a declaration of absence; `{ enabled: false }` is.\n */\n systemsOfRecord: WildoSystemsOfRecordEnvConfigSchema.optional(),\n /**\n * The PLATFORM tier's own object-storage bucket, REMOTE environments only (#1112). See\n * {@link WildoPlatformStorageConfigSchema}: not this application's bucket (that is `backingServices.s3.bucket`),\n * and refused in a local environment, whose platform bucket is a constant shared by every application.\n */\n platformStorage: WildoPlatformStorageConfigSchema.optional(),\n /**\n * Where the PLATFORM keeps the keys it holds for applications (#2933): a self-hosted OpenBao the CLI renders, or the\n * operator's own Vault. See {@link WildoPlatformKeyManagementConfigSchema}. Absent, apps-manager seals every key\n * under its own key-encryption root and serves no Vault provider.\n */\n platformKeyManagement: WildoPlatformKeyManagementConfigSchema.optional(),\n devCompanion: InfraServiceAddressingSchema.optional(),\n /**\n * Present only on an environment RESOLVED from a hosted descriptor: this application runs on the\n * infrastructure of another application, whose root and descriptor are named here as absolute paths.\n *\n * Never authored in this form. An application declares its host with a RELATIVE\n * `infrastructureHost.applicationRoot` in a hosted descriptor (`defineHostedInfraEnvConfig`, {@link WildoHostedInfraEnvConfigSchema}),\n * and `loadInfraEnvConfig` produces this value while merging the host's platform-level fields in. The\n * absolute-path requirement is what keeps the two apart: a committed descriptor cannot carry a\n * machine-local path, so it cannot pass itself off as already resolved.\n *\n * Every consumer that would otherwise act on SHARED infrastructure — render the platform compose file,\n * converge containers, start or initialize the platform, write platform-service env files, bootstrap a\n * cluster — reads this field and leaves that action to the host.\n */\n infrastructureHost: z.strictObject({\n applicationRoot: z.string().regex(ABSOLUTE_PATH_PATTERN, 'infrastructureHost.applicationRoot must be absolute once resolved.'),\n infraConfigPath: z.string().regex(ABSOLUTE_PATH_PATTERN, 'infrastructureHost.infraConfigPath must be absolute once resolved.'),\n }).optional(),\n};\n\n/**\n * #2303 — the database families an environment that OWNS its platform runs, each with the declarations that bring it\n * in, derived from what the descriptor declares rather than asked: the platform's engine (authored, or inferred from\n * the declared stores), the application's (`resolveApplicationDatabaseEngine`, absent means PostgreSQL), and every\n * declared database store.\n *\n * The inferred platform engine needs no copy of the CLI's inference (`inferDatabaseChoiceFromInfraConfig`): it always\n * names a DECLARED store when one is declared, so it can add no family the declared stores do not already add. Only\n * when NO store is declared does it bring one in on its own, MongoDB, as an implicit self-hosted mongod.\n */\nfunction databaseFamiliesRunByEnvironment(config: {\n readonly database?: { readonly engine: DatabaseEngine };\n readonly applicationDatabase?: { readonly engine: DatabaseEngine };\n readonly backingServices: Partial<Record<BackingServiceKind, unknown>>;\n}): Map<DatabaseEngine, string[]> {\n const families = new Map<DatabaseEngine, string[]>();\n const add = (engine: DatabaseEngine, why: string): void => {\n families.set(engine, [...(families.get(engine) ?? []), why]);\n };\n const declaredStores: ReadonlyArray<readonly [BackingServiceKind, DatabaseEngine]> = [\n [BackingServiceKind.MONGODB, DatabaseEngine.MONGODB],\n [BackingServiceKind.POSTGRESQL, DatabaseEngine.POSTGRESQL],\n ];\n let anyStoreDeclared = false;\n for (const [kind, engine] of declaredStores) {\n if (config.backingServices[kind] !== undefined) {\n anyStoreDeclared = true;\n add(engine, `backingServices.${kind}`);\n }\n }\n if (config.database) add(config.database.engine, 'database.engine');\n else if (!anyStoreDeclared) add(DatabaseEngine.MONGODB, 'the platform store inferred when no database store is declared');\n add(\n resolveApplicationDatabaseEngine(config.applicationDatabase),\n config.applicationDatabase ? 'applicationDatabase.engine' : 'the application\\'s default engine (applicationDatabase absent)',\n );\n return families;\n}\n\nconst WildoInfraEnvConfigInputSchema = z.object(WILDO_INFRA_ENV_CONFIG_SHAPE).strict().superRefine((config, ctx) => {\n const resolvedEnvironment = config.environment;\n\n const resolvedLocationType = config.locationType\n ?? (isLocalEnvironmentId(resolvedEnvironment) ? WildoLocationType.LOCAL : WildoLocationType.REMOTE);\n\n if (isLocalEnvironmentId(resolvedEnvironment) && resolvedLocationType === WildoLocationType.REMOTE) {\n ctx.addIssue({\n code: 'custom',\n path: ['locationType'],\n message: `\"${resolvedEnvironment}\" environment cannot use remote locationType`,\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && resolvedLocationType === WildoLocationType.LOCAL) {\n ctx.addIssue({\n code: 'custom',\n path: ['locationType'],\n message: 'Only the \"local\" environment id can use local locationType',\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && !config.runtimeEnvironment) {\n ctx.addIssue({\n code: 'custom',\n path: ['runtimeEnvironment'],\n message: 'runtimeEnvironment is required for remote environments',\n });\n }\n\n /**\n * A declared PostgreSQL platform must declare the stores it actually needs — checked HERE, at\n * author time, rather than only at env generation.\n *\n * `env-vars-builder` already throws on both of these, but it throws during\n * `wildo config sync`, i.e. after the operator has committed the config and moved on. The same\n * refusal at parse time names the problem while the file is still open. The runtime throws\n * REMAIN as the backstop — they also guard generated/non-authored paths this schema never sees\n * (see `.claude/rules/invariant-call-site-enumeration.md`: an invariant enforced at one of its\n * sites is enforced at none of the others).\n */\n /*\n * Scoped to an environment that OWNS its platform. A hosted environment's `database` is the host's,\n * validated when the host's own descriptor was parsed; its `backingServices` are only the stores the\n * hosted application itself uses, so a Mongo-backed application on a PostgreSQL platform would be\n * refused here for a store it never asked for.\n */\n if (config.database?.engine === DatabaseEngine.POSTGRESQL && config.infrastructureHost === undefined) {\n if (!config.backingServices[BackingServiceKind.POSTGRESQL]) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['backingServices', BackingServiceKind.POSTGRESQL],\n message:\n 'database.engine is POSTGRESQL but no `backingServices.postgresql` is declared: the platform '\n + 'would be pointed at a PostgreSQL that nothing provisions. Declare it, or drop `database` '\n + 'to let the engine be inferred.',\n });\n }\n\n /**\n * RETIRED 2026-08-28. A PostgreSQL-engined platform no longer requires a mongod.\n *\n * This used to refuse a PostgreSQL platform that did not also declare\n * `backingServices.mongodb: { source: SELF }`, on two stated grounds — and BOTH had since been\n * met, which is exactly why it needed retiring rather than keeping:\n *\n * 1. \"six resources declare `persistenceAdapter: MONGODB`\" — retired 2026-08-22 (item C).\n * `bootstrap-plane-persistence-adapter.test.ts` now asserts the INVERSE, that none of the\n * six declares an adapter, so re-pinning any one of them fails that suite.\n * 2. \"`crontabs-batches-manager` … with zero PostgreSQL awareness\" — ported (item D). On a\n * PostgreSQL platform it takes `connectWithUrl(postgresUrl)` and never opens a Mongo\n * connection at all.\n *\n * The guard's own instruction was \"retire this together with those pins and the crontabs port —\n * NOT before\". Both landed; nobody came back. What kept a mongod alive after that was a THIRD\n * reason neither the guard nor its message ever named: apps-manager's env schema declared\n * `MONGO_CONNECT_URL` and `BASE_MONGO_SERVER_URL` as unconditionally REQUIRED, and its INIT\n * threw without them. That is the shape worth remembering — a transitional guard whose recorded\n * checklist is fully ticked while the real blocker sits somewhere it does not mention. Those\n * env keys are now engine-conditional, so nothing forces a mongod any more.\n *\n * A mongod remains perfectly legal to declare, and is still REQUIRED in practice for a platform\n * that hosts Mongo-backed applications — but that is an operator's judgment about the\n * applications they run, exactly as the `applicationDatabase` rule below already argues, and not\n * something this schema can decide for them.\n */\n }\n\n /**\n * An application cannot persist to a store the environment does not declare — including the store\n * it selects by SILENCE, which is PostgreSQL. Resolved rather than compared to the authored value,\n * so an environment that declares nothing and provisions no PostgreSQL is refused at authoring time\n * instead of registering an application with no store.\n *\n * Deliberately NOT symmetric with the platform rule above: that one also requires MongoDB to stay\n * declared, because the platform's own BOOTSTRAP plane is Mongo-wired. An application has no such\n * plane — once its resources are on PostgreSQL, nothing of the application's needs a mongod — so\n * requiring one here would forbid the very end-state this field exists to reach.\n */\n if (resolveApplicationDatabaseEngine(config.applicationDatabase) === DatabaseEngine.POSTGRESQL\n && config.backingServices[BackingServiceKind.POSTGRESQL] === undefined) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['backingServices', BackingServiceKind.POSTGRESQL],\n message:\n 'The application persists to PostgreSQL (declared, or selected because `applicationDatabase` is '\n + 'absent) but no `backingServices.postgresql` is declared: it would be pointed at a PostgreSQL that '\n + 'nothing provisions. Declare it, or author `applicationDatabase: { engine: DatabaseEngine.MONGODB }`.',\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && config.applicationCreationVerification !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['applicationCreationVerification'],\n message: 'applicationCreationVerification is local-only and must be authored in wildo.infra.local.config.ts.',\n });\n }\n\n if (!isLocalEnvironmentId(resolvedEnvironment) && config.ownershipDnsStandIn !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['ownershipDnsStandIn'],\n message: 'ownershipDnsStandIn is local-only and must be authored in wildo.infra.local.config.ts: in every other environment a '\n + 'domain-ownership proof is what public DNS says, and a backend outside development and test refuses to start with it set.',\n });\n }\n\n if (\n !isLocalEnvironmentId(resolvedEnvironment)\n && resolvedLocationType === WildoLocationType.REMOTE\n && config.runtime === WildoDeploymentRuntime.KUBERNETES\n ) {\n if (!config.remoteProvider) {\n ctx.addIssue({\n code: 'custom',\n path: ['remoteProvider'],\n message: 'remoteProvider is required for remote Kubernetes environments',\n });\n }\n if (!config.kubernetes) {\n ctx.addIssue({\n code: 'custom',\n path: ['kubernetes'],\n message: 'kubernetes is required for remote Kubernetes environments',\n });\n }\n }\n\n // CSP env-layer dev-only escape hatch — `viteDevLoosening: true`\n // injects BOTH `'unsafe-inline'` and `'unsafe-eval'` into `script-src`\n // (Vite's HMR client bootstrap is an inline `<script>` and its module\n // / sourcemap transforms run through `eval()`). The auto-default\n // already handles the canonical case (`local` + `SAAS_APP` →\n // auto-true). Explicit `viteDevLoosening: true` is REJECTED outside\n // the LOCAL environment because shipping `'unsafe-inline'` +\n // `'unsafe-eval'` to staging / production would punch a hole through\n // the entire CSP posture (every XSS payload becomes scriptable via\n // `eval()`-style sinks the baseline specifically denies, and inline\n // `<script>` injection escapes nonce-/hash-based mitigation). Failing\n // fast at parse time prevents an authored `csp.app.viteDevLoosening:\n // true` entry from silently shipping to production via a copy-paste\n // from the local config.\n if (config.csp && !isLocalEnvironmentId(resolvedEnvironment)) {\n for (const [serviceKey, override] of Object.entries(config.csp)) {\n if (override?.viteDevLoosening === true) {\n ctx.addIssue({\n code: 'custom',\n path: ['csp', serviceKey, 'viteDevLoosening'],\n message:\n `csp.${serviceKey}.viteDevLoosening cannot be true in environment \"${resolvedEnvironment}\" — `\n + `the dev-only escape hatch is restricted to \"${WildoEnvironment.LOCAL}\". `\n + `Author this flag ONLY in wildo.infra.local.config.ts; remote envs MUST reject `\n + `'unsafe-inline'/'unsafe-eval' so XSS payloads can't reach eval-style sinks or `\n + `inline-script injection. Production Vite builds emit <script type=\"module\"> with `\n + `no inline scripts and no eval(), so production envs never NEED this flag.`,\n });\n }\n }\n }\n\n // CDN serving is a REMOTE-only concern: it replaces a frontend's nginx pod\n // (Deployment + Service + ingress route), which exists ONLY in a remote\n // k8s/compose deploy. Local dev runs native frontend dev servers — there is\n // no nginx pod to skip and nowhere to publish to. Reject an authored `cdn`\n // block outside a remote env at parse time so a config copy-pasted from a\n // remote env can't silently make `wildo frontend publish --env local`\n // attempt an S3 upload (and so the semantic stays enforced, not implicit).\n // The platform's own bucket is authored only for a REMOTE environment (#1112). A local platform is shared by\n // every application beside it, and each has its own infra file, so letting one author it would make the\n // platform's bucket whichever application synced last — the defect this field exists to remove.\n if (config.platformStorage && resolvedLocationType !== WildoLocationType.REMOTE) {\n ctx.addIssue({\n code: 'custom',\n path: ['platformStorage'],\n message:\n 'platformStorage is only valid in a REMOTE environment — a local platform is shared by every '\n + 'application beside it and uses the fixed platform bucket. Author it only in wildo.infra.remote.config.ts.',\n });\n }\n\n /*\n * #2303 — a service profile and a declaration that contradict it. `backingServices.clamav` / `.immudb`\n * with `source: SELF` asks the environment to RUN a service the profile says it does not run; neither\n * can win silently, so the descriptor is refused here, while it is open. The compose generator refuses\n * the same pair again (an invariant enforced at one site is enforced at none of the others).\n */\n if (config.serviceProfile !== undefined) {\n // #2303 — both lanes render a profile now (the Kubernetes manifests since the second slice), so a KUBERNETES\n // environment may declare one; its refusal was the stand-in for a lane that ignored the declaration.\n const databaseFamilies = databaseFamiliesRunByEnvironment(config);\n if (environmentServiceProfileRunsOneDatabaseFamily(config.serviceProfile) && config.infrastructureHost === undefined && databaseFamilies.size > 1) {\n ctx.addIssue({\n code: 'custom',\n path: ['serviceProfile'],\n message:\n `serviceProfile '${config.serviceProfile}' runs ONE database family, and this environment runs `\n + `${[...databaseFamilies.entries()].map(([engine, why]) => `${engine} (${why.join(', ')})`).join(' and ')}. `\n + 'Put the platform and the application on the same engine (`database.engine` and `applicationDatabase.engine`) '\n + `and declare only that store in \\`backingServices\\`, or set serviceProfile to '${EnvironmentServiceProfile.FULL}'.`,\n });\n }\n // #2303 slice D — a profile whose queue lives in the application's database runs no broker, so ANY RabbitMQ\n // declaration contradicts it: `SELF` asks the environment to run one, and a `MANAGED` broker would be one nothing uses.\n if (config.backingServices[BackingServiceKind.RABBITMQ] !== undefined && !environmentServiceProfileRunsMessageBroker(config.serviceProfile)) {\n ctx.addIssue({\n code: 'custom',\n path: ['backingServices', BackingServiceKind.RABBITMQ],\n message:\n `serviceProfile '${config.serviceProfile}' runs the application's background work on its own database and runs `\n + `no message broker, and \\`backingServices.${BackingServiceKind.RABBITMQ}\\` declares one. Remove the declaration, `\n + `or set serviceProfile to '${EnvironmentServiceProfile.FULL}'.`,\n });\n }\n for (const [kind, service] of [\n [BackingServiceKind.CLAMAV, EnvironmentServiceProfileOptionalService.ANTIVIRUS_SCANNER],\n [BackingServiceKind.IMMUDB, EnvironmentServiceProfileOptionalService.IMMUTABLE_AUDIT_STORE],\n ] as const) {\n if (\n config.backingServices[kind]?.source === BackingServiceSource.SELF\n && environmentServiceProfileOmits(config.serviceProfile, service)\n ) {\n ctx.addIssue({\n code: 'custom',\n path: ['backingServices', kind],\n message:\n `${describeServiceOmittedByEnvironmentServiceProfile(config.serviceProfile, service)} `\n + `\\`backingServices.${kind}: { source: SELF }\\` asks it to run one. Remove the declaration, or set `\n + `serviceProfile to '${EnvironmentServiceProfile.FULL}'.`,\n });\n }\n }\n }\n\n if (config.cdn && resolvedLocationType !== WildoLocationType.REMOTE) {\n for (const serviceKey of Object.keys(config.cdn)) {\n ctx.addIssue({\n code: 'custom',\n path: ['cdn', serviceKey],\n message:\n `cdn.${serviceKey} is only valid in a REMOTE environment — CDN serving replaces the `\n + `frontend's nginx pod, which local dev does not have. Author cdn blocks only in `\n + `wildo.infra.remote.config.ts (staging / production).`,\n });\n }\n }\n});\n\nexport const WildoInfraEnvConfigSchema = WildoInfraEnvConfigInputSchema.transform((config) => {\n const environment = config.environment;\n const locationType = config.locationType\n ?? (isLocalEnvironmentId(environment) ? WildoLocationType.LOCAL : WildoLocationType.REMOTE);\n\n return {\n environment,\n locationType,\n runtimeEnvironment: config.runtimeEnvironment,\n runtime: config.runtime,\n /**\n * Resolved here rather than left `undefined` for a downstream consumer to default, so every\n * reader sees one answer. The derivation is total over `WildoLocationType`.\n */\n localDataStorage: config.localDataStorage ?? resolveDefaultLocalDataStorage(locationType),\n /** Resolved here, like `localDataStorage`, so every reader sees the settled answer (#2303). */\n serviceProfile: config.serviceProfile ?? DEFAULT_ENVIRONMENT_SERVICE_PROFILE,\n /**\n * Projected EXPLICITLY, like every field here — this list IS the contract, and a field omitted\n * from it is silently dropped no matter what the input schema accepted. `undefined` when the\n * environment does not author one, which is the signal downstream consumers use to fall back to\n * `inferDatabaseChoiceFromInfraConfig`.\n */\n database: config.database,\n applicationDatabase: config.applicationDatabase,\n publicDomain: config.publicDomain,\n serviceHosts: config.serviceHosts,\n kubernetes: config.kubernetes,\n remoteProvider: config.remoteProvider,\n deployment: config.deployment,\n backingServices: config.backingServices,\n logging: config.logging,\n observability: config.observability,\n providerSelection: config.providerSelection,\n providerConfigurations: config.providerConfigurations,\n email: config.email,\n agentContentGuardrails: config.agentContentGuardrails,\n ownershipDnsStandIn: config.ownershipDnsStandIn,\n applicationCreationVerification: config.applicationCreationVerification,\n serviceAuth: config.serviceAuth,\n csp: config.csp,\n cdn: config.cdn,\n systemsOfRecord: config.systemsOfRecord,\n platformStorage: config.platformStorage,\n platformKeyManagement: config.platformKeyManagement,\n documentationSite: config.documentationSite,\n devCompanion: config.devCompanion,\n infrastructureHost: config.infrastructureHost,\n };\n});\n\nexport type WildoInfraEnvConfig = z.output<typeof WildoInfraEnvConfigSchema>;\nexport type WildoInfraEnvConfigInput = z.input<typeof WildoInfraEnvConfigSchema>;\n\n// =============================================================================\n// Hosted environment descriptors — an application running on another application's infrastructure\n// =============================================================================\n\n/**\n * Who decides one member of an environment descriptor when the application is HOSTED.\n *\n * Several applications share one platform per environment: one application OWNS the infrastructure\n * (the platform services and every backing service), and the others reference it through\n * `infrastructureHost`. Each member of the descriptor belongs to exactly one side, and this vocabulary is\n * how that is stated — per member, in {@link INFRA_ENV_FIELD_OWNERSHIP}, so a member added tomorrow cannot\n * compile until somebody decides whose it is.\n */\nexport enum InfraEnvFieldOwner {\n /**\n * The hosted application authors it, and it may differ from the host's: its public domain, its CSP,\n * its provider choices, its companion port. Taken verbatim from the hosted descriptor.\n */\n APPLICATION = 'application',\n /**\n * The host decides it, and a hosted descriptor may not author it: the runtime, the platform database,\n * the cluster, the remote provider, the platform bucket. Authoring one in a hosted descriptor is\n * refused — two applications on one platform cannot disagree about what that platform is.\n */\n HOST = 'host',\n /**\n * Split inside the member. Backing services: the host owns each SERVER (`source`, `host`, `port`,\n * `provider`, `endpoint`), the application owns its NAME on that server (database, vhost, bucket).\n * Kubernetes: the host owns the namespace and ingress class, the application its replica counts.\n * Deployment: the host owns the runtime, the application its branch and image tagging.\n */\n PARTITIONED = 'partitioned',\n /**\n * Produced by resolution and never authored in its resolved form (`infrastructureHost`).\n */\n RESOLUTION = 'resolution',\n}\n\n/**\n * Whose decision each member of a standalone descriptor is, when the application is hosted.\n *\n * Total over {@link WILDO_INFRA_ENV_CONFIG_SHAPE} by type, which is the point: `providerConfigurations`\n * landed on the shape while this feature was being written, and a hosted descriptor built from a\n * hand-kept list would have dropped it silently. `hosted-infra-env-config.test.ts` pins that the hosted\n * schema accepts exactly the APPLICATION and PARTITIONED members.\n */\nexport const INFRA_ENV_FIELD_OWNERSHIP: Readonly<Record<keyof typeof WILDO_INFRA_ENV_CONFIG_SHAPE, InfraEnvFieldOwner>> = {\n environment: InfraEnvFieldOwner.APPLICATION,\n locationType: InfraEnvFieldOwner.HOST,\n runtimeEnvironment: InfraEnvFieldOwner.HOST,\n runtime: InfraEnvFieldOwner.HOST,\n /*\n * HOST. It says how the SHARED backing services store their data, and there is one set of those\n * containers per platform — a hosted application cannot have mongod keep its data in a volume\n * while the host keeps it on a bind mount, because it is the same mongod. Same family as\n * `runtime` and `database`: a property of the substrate, not of anyone running on it. The host\n * also writes the compose file this member shapes, so a hosted descriptor authoring it would be\n * describing a file it does not own.\n */\n localDataStorage: InfraEnvFieldOwner.HOST,\n /*\n * HOST, for the same reason as `localDataStorage`: it decides which containers the SHARED platform runs.\n * A hosted application cannot ask for an immudb its host does not run, and the profile reaches it from\n * the host so its boot refuses a capability the shared platform does not back (#2303).\n */\n serviceProfile: InfraEnvFieldOwner.HOST,\n database: InfraEnvFieldOwner.HOST,\n applicationDatabase: InfraEnvFieldOwner.APPLICATION,\n publicDomain: InfraEnvFieldOwner.APPLICATION,\n serviceHosts: InfraEnvFieldOwner.APPLICATION,\n kubernetes: InfraEnvFieldOwner.PARTITIONED,\n remoteProvider: InfraEnvFieldOwner.HOST,\n deployment: InfraEnvFieldOwner.PARTITIONED,\n backingServices: InfraEnvFieldOwner.PARTITIONED,\n logging: InfraEnvFieldOwner.APPLICATION,\n /*\n * APPLICATION, deliberately: `enabled` and `llmObservability` are per-application postures. The OTLP\n * `endpoint` usually names the shared collector, and nothing stops an application pointing its own\n * telemetry elsewhere — that is a destination choice, not a divergence in what the platform runs.\n */\n observability: InfraEnvFieldOwner.APPLICATION,\n providerSelection: InfraEnvFieldOwner.APPLICATION,\n providerConfigurations: InfraEnvFieldOwner.APPLICATION,\n /*\n * APPLICATION. The receiving domain is THIS application's address space in this environment: two applications on one\n * platform receive on different domains, and a hosted application inheriting its host's would route its mail into\n * another tenant's organizations.\n */\n email: InfraEnvFieldOwner.APPLICATION,\n /*\n * APPLICATION. Whether THIS application's agents run unguarded where no classifier offers a guardrail is a decision about its\n * own agents; an application hosted on another's platform does not inherit its host's.\n */\n agentContentGuardrails: InfraEnvFieldOwner.APPLICATION,\n /*\n * APPLICATION. The stand-in answers for the domains THIS application's tenants prove they own on a developer machine —\n * the double standing in for their corporate IT. A hosted application inheriting its host's would verify its tenants'\n * domains against another application's test double.\n */\n ownershipDnsStandIn: InfraEnvFieldOwner.APPLICATION,\n /*\n * APPLICATION. `systemsOfRecord` says where the instances THIS application declares in its saas config live in\n * this environment — an external system it reads from (an ERP), never part of the shared substrate its host\n * runs. Two applications on one platform read from different systems, or from none: handing a hosted\n * application its host's ERP address and credential would be a cross-tenant read nobody asked for, and\n * `{ enabled: false }` is exactly how an environment says it has no access.\n */\n systemsOfRecord: InfraEnvFieldOwner.APPLICATION,\n documentationSite: InfraEnvFieldOwner.APPLICATION,\n applicationCreationVerification: InfraEnvFieldOwner.APPLICATION,\n serviceAuth: InfraEnvFieldOwner.APPLICATION,\n csp: InfraEnvFieldOwner.APPLICATION,\n cdn: InfraEnvFieldOwner.APPLICATION,\n platformStorage: InfraEnvFieldOwner.HOST,\n /*\n * HOST. One apps-manager holds one Vault for every application on the platform, and the host writes the compose file\n * and manifests that run it; a hosted application authoring it would be describing a custodian it does not run.\n */\n platformKeyManagement: InfraEnvFieldOwner.HOST,\n devCompanion: InfraEnvFieldOwner.APPLICATION,\n infrastructureHost: InfraEnvFieldOwner.RESOLUTION,\n};\n\n/**\n * Which field of a backing-service entry names the APPLICATION'S OWN slice of a shared server.\n *\n * `mustDifferFromHost` is true where the framework's fallback for an unnamed slice is a SHARED constant —\n * `'wildo_app'` for a Mongo or PostgreSQL database, the default vhost `/`, the fixed platform bucket. On\n * those servers two applications that name the same slice are one application's data, silently, so a\n * hosted application must name its own and it must not be the host's. Redis is exempt: every application\n * already shares index 0, isolated by its own ACL principal and key prefix. Immudb's `database` has no\n * consumer today, so it is stripped from the host's entry and not authored by the hosted one.\n */\nexport const BACKING_SERVICE_APPLICATION_NAME_FIELDS = {\n [BackingServiceKind.MONGODB]: { field: 'database', mustDifferFromHost: true },\n [BackingServiceKind.REDIS]: { field: 'database', mustDifferFromHost: false },\n [BackingServiceKind.RABBITMQ]: { field: 'vhost', mustDifferFromHost: true },\n [BackingServiceKind.S3]: { field: 'bucket', mustDifferFromHost: true },\n [BackingServiceKind.POSTGRESQL]: { field: 'database', mustDifferFromHost: true },\n [BackingServiceKind.CLAMAV]: null,\n [BackingServiceKind.IMMUDB]: { field: 'database', mustDifferFromHost: false },\n} as const satisfies Record<BackingServiceKind, { field: string; mustDifferFromHost: boolean } | null>;\n\n/**\n * Error-map for a strict object whose unknown keys are almost always host-owned members an author\n * carried over from a standalone descriptor. Zod's own \"Unrecognized key\" names the key but not the\n * reason, and the reason is the whole lesson.\n */\nfunction refuseHostOwnedKeys(scope: string): { error: (issue: { code?: string; keys?: readonly string[] }) => string | undefined } {\n return {\n error: (issue) => {\n if (issue.code !== 'unrecognized_keys' || !issue.keys?.length) return undefined;\n const keys = issue.keys.map((key) => `\\`${key}\\``).join(', ');\n return `${scope}: ${keys} cannot be authored by a hosted application. Its infrastructure host decides `\n + 'the platform (runtime, database, cluster, remote provider, platform storage) and every backing-service '\n + 'server; a hosted application authors only its own names on those servers (database, vhost, bucket).';\n },\n };\n}\n\nconst HOSTED_BACKING_SERVICES_SHAPE = {\n [BackingServiceKind.MONGODB]: z.strictObject({ database: z.string().min(1) }, refuseHostOwnedKeys('backingServices.mongodb')).optional(),\n [BackingServiceKind.REDIS]: z.strictObject({ database: z.number().int().min(0).max(15).optional() }, refuseHostOwnedKeys('backingServices.redis')).optional(),\n [BackingServiceKind.RABBITMQ]: z.strictObject({ vhost: z.string().min(1) }, refuseHostOwnedKeys('backingServices.rabbitmq')).optional(),\n [BackingServiceKind.S3]: z.strictObject({ bucket: z.string().min(1) }, refuseHostOwnedKeys('backingServices.s3')).optional(),\n [BackingServiceKind.POSTGRESQL]: z.strictObject({ database: z.string().min(1) }, refuseHostOwnedKeys('backingServices.postgresql')).optional(),\n [BackingServiceKind.CLAMAV]: z.strictObject({}, refuseHostOwnedKeys('backingServices.clamav')).optional(),\n [BackingServiceKind.IMMUDB]: z.strictObject({}, refuseHostOwnedKeys('backingServices.immudb')).optional(),\n} satisfies Record<BackingServiceKind, z.ZodOptional<z.ZodType>>;\n\n/**\n * The backing services a HOSTED application uses — each one a store its host must declare.\n *\n * Listing a kind is how the application states it NEEDS that store; the entry carries only the\n * application's own name on the host's server. Every name field is REQUIRED where\n * {@link BACKING_SERVICE_APPLICATION_NAME_FIELDS} says the unnamed fallback is shared.\n */\nexport const HostedBackingServicesEnvConfigSchema = z.strictObject(HOSTED_BACKING_SERVICES_SHAPE, refuseHostOwnedKeys('backingServices'));\nexport type HostedBackingServicesEnvConfig = z.output<typeof HostedBackingServicesEnvConfigSchema>;\n\n/** @wildo_source:part:start platform.config.infrastructure-host facet:layer:platform facet:family:bootstrap facet:audience:app-developer */\n/**\n * An environment descriptor for an application that runs on ANOTHER application's infrastructure.\n *\n * One application per environment owns the infrastructure — its platform services (apps-manager,\n * module-registry, crontabs) and every backing service. Other applications declare that owner as their\n * `infrastructureHost` and author only what is theirs: domain, CSP, provider choices, companion address,\n * and their own database/vhost/bucket names on the host's servers. Everything else comes from the host's\n * descriptor for the SAME environment when the descriptor is loaded, so the two cannot diverge — not in\n * which stores exist, not in how they are reached, not between Docker Compose and Kubernetes.\n *\n * The link is per environment: author it in `wildo.infra.local.config.ts` to share a local platform while\n * `staging` stays standalone, or in both.\n *\n * Refusals, all at load time, all naming both descriptors:\n * - the host root holds no `wildo.saas.config.ts` — a hosted application needs its host's SOURCE checked\n * out at that path;\n * - the host has no descriptor for this environment, or is itself hosted;\n * - a store this application lists is not declared by the host;\n * - a database, vhost or bucket name equals the host's.\n *\n * @example Wonder CRM on Wonder Todos' local platform.\n * ```ts\n * export default defineHostedInfraEnvConfig({\n * environment: WildoEnvironment.LOCAL,\n * infrastructureHost: { applicationRoot: '../wonder-todos' },\n * publicDomain: 'localhost',\n * applicationDatabase: { engine: DatabaseEngine.POSTGRESQL },\n * backingServices: {\n * postgresql: { database: 'wonder-crm-db' },\n * redis: { database: 0 },\n * rabbitmq: { vhost: 'wonder-crm' },\n * s3: { bucket: 'wonder-crm-local' },\n * },\n * devCompanion: { host: 'localhost', port: 4351 },\n * });\n * ```\n */\nexport const WildoHostedInfraEnvConfigSchema = z.strictObject({\n infrastructureHost: z.strictObject({\n /**\n * The host application's root — the directory holding its `wildo.saas.config.ts` — RELATIVE to this\n * application's root. Relative because the descriptor is committed: an absolute path is one machine's\n * checkout layout, and would break on every other.\n */\n applicationRoot: z.string().min(1).refine(\n (value) => !ABSOLUTE_PATH_PATTERN.test(value),\n 'infrastructureHost.applicationRoot must be relative to this application root (e.g. \"../wonder-todos\"): the descriptor is committed, and an absolute path only exists on one machine.',\n ),\n }, refuseHostOwnedKeys('infrastructureHost')),\n environment: WILDO_INFRA_ENV_CONFIG_SHAPE.environment,\n applicationDatabase: WILDO_INFRA_ENV_CONFIG_SHAPE.applicationDatabase,\n publicDomain: WILDO_INFRA_ENV_CONFIG_SHAPE.publicDomain,\n serviceHosts: WILDO_INFRA_ENV_CONFIG_SHAPE.serviceHosts,\n kubernetes: z.strictObject({\n services: WildoKubernetesConfigSchema.shape.services,\n }, refuseHostOwnedKeys('kubernetes')).optional(),\n deployment: z.strictObject({\n branch: z.string().min(1),\n imageTagStrategy: z.enum(WildoImageTagStrategy).optional(),\n // No `registry`: images live at the host's `remoteProvider.registryEndpoint`, which its manifests pull from (#1165).\n }, refuseHostOwnedKeys('deployment')).optional(),\n backingServices: HostedBackingServicesEnvConfigSchema.optional(),\n logging: WILDO_INFRA_ENV_CONFIG_SHAPE.logging,\n observability: WILDO_INFRA_ENV_CONFIG_SHAPE.observability,\n providerSelection: WILDO_INFRA_ENV_CONFIG_SHAPE.providerSelection,\n providerConfigurations: WILDO_INFRA_ENV_CONFIG_SHAPE.providerConfigurations,\n email: WILDO_INFRA_ENV_CONFIG_SHAPE.email,\n agentContentGuardrails: WILDO_INFRA_ENV_CONFIG_SHAPE.agentContentGuardrails,\n ownershipDnsStandIn: WILDO_INFRA_ENV_CONFIG_SHAPE.ownershipDnsStandIn,\n systemsOfRecord: WILDO_INFRA_ENV_CONFIG_SHAPE.systemsOfRecord,\n documentationSite: WILDO_INFRA_ENV_CONFIG_SHAPE.documentationSite,\n applicationCreationVerification: WILDO_INFRA_ENV_CONFIG_SHAPE.applicationCreationVerification,\n serviceAuth: WILDO_INFRA_ENV_CONFIG_SHAPE.serviceAuth,\n csp: WILDO_INFRA_ENV_CONFIG_SHAPE.csp,\n cdn: WILDO_INFRA_ENV_CONFIG_SHAPE.cdn,\n devCompanion: WILDO_INFRA_ENV_CONFIG_SHAPE.devCompanion,\n}, refuseHostOwnedKeys('a hosted environment descriptor'));\n/** @wildo_source:part:end platform.config.infrastructure-host */\n\nexport type WildoHostedInfraEnvConfig = z.output<typeof WildoHostedInfraEnvConfigSchema>;\nexport type WildoHostedInfraEnvConfigInput = z.input<typeof WildoHostedInfraEnvConfigSchema>;\n\n/**\n * What an authored `wildo.infra.<env>.config.ts` evaluates to: a standalone descriptor, or a hosted one\n * that is NOT usable until `loadInfraEnvConfig` resolves it against its host.\n */\nexport type WildoAuthoredInfraEnvConfig = WildoInfraEnvConfig | WildoHostedInfraEnvConfig;\n\n/**\n * Whether an evaluated descriptor is a hosted one still awaiting resolution.\n *\n * Keyed on the AUTHORED key, exactly as {@link defineInfraEnvConfig} dispatches: an `infrastructureHost`\n * in its authored form, which names a relative root and no `infraConfigPath`. A RESOLVED hosted\n * environment carries `infraConfigPath` and is a {@link WildoInfraEnvConfig} — consumers ask\n * `config.infrastructureHost !== undefined` for that.\n *\n * An earlier revision keyed on the absence of `runtime`, reasoning that every standalone descriptor\n * requires it. That holds for a descriptor built through `defineInfraEnvConfig` and not for a plain\n * `export default {…}` object, which the loader also evaluates: a partial standalone descriptor with no\n * `runtime` was read as hosted and crashed on its missing host. Discriminate on what the author wrote,\n * never on what a schema happens to require.\n */\nexport function isHostedInfraEnvConfig(config: WildoAuthoredInfraEnvConfig): config is WildoHostedInfraEnvConfig {\n const host = (config as { infrastructureHost?: object }).infrastructureHost;\n return host !== undefined && host !== null && !('infraConfigPath' in host);\n}\n\n/**\n * Define an app-owned environment descriptor under `infrastructure/<env>`.\n *\n * This is the canonical authored env contract for the flattened targeted-app\n * layout.\n */\nexport function defineInfraEnvConfig(config: WildoInfraEnvConfigInput): WildoInfraEnvConfig {\n /*\n * An `infrastructureHost` is never authored here: a hosted environment is a different descriptor with its\n * own entry point, and its resolved form (absolute paths) is produced only by `loadInfraEnvConfig`.\n * Refused by name before the schema runs, because the schema's own complaint (\"must be absolute once\n * resolved\") would send the author in the wrong direction.\n */\n if ((config as { infrastructureHost?: unknown }).infrastructureHost !== undefined) {\n throw new Error(\n 'defineInfraEnvConfig describes an environment that OWNS its infrastructure, so it takes no infrastructureHost. '\n + 'An application running on another application\\'s infrastructure is declared with defineHostedInfraEnvConfig({ '\n + 'infrastructureHost: { applicationRoot: \\'../<host-app>\\' }, … }).',\n );\n }\n return WildoInfraEnvConfigSchema.parse(config);\n}\n\n/**\n * Define an environment descriptor for an application that runs on ANOTHER application's infrastructure.\n * See {@link WildoHostedInfraEnvConfigSchema} for what it may author and what comes from the host.\n *\n * A separate entry point rather than a variant of {@link defineInfraEnvConfig}, deliberately. \"This\n * environment owns its platform\" and \"this environment runs on someone else's\" are different decisions\n * with different fields, and one function accepting both made a type error in either shape report as \"No\n * overload matches this call\" at the call instead of at the offending property — worse feedback for every\n * author of every descriptor, standalone ones included.\n *\n * The result is NOT an environment yet: `loadInfraEnvConfig` resolves it against the host.\n */\nexport function defineHostedInfraEnvConfig(config: WildoHostedInfraEnvConfigInput): WildoHostedInfraEnvConfig {\n return WildoHostedInfraEnvConfigSchema.parse(config);\n}\n\n"]}
@@ -1,6 +1,6 @@
1
1
  import { BACKING_SERVICE_APPLICATION_NAME_FIELDS, isHostedInfraEnvConfig, WildoInfraEnvConfigSchema, } from './define-infra-env-config.js';
2
2
  import { BackingServiceKind } from './shared/backing-services.schemas.js';
3
- import { WildoDeploymentRuntime } from './shared/environment.schemas.js';
3
+ import { environmentServiceProfileRunsMessageBroker, WildoDeploymentRuntime } from './shared/environment.schemas.js';
4
4
  /**
5
5
  * A hosted descriptor that cannot be resolved against its host. Carries every issue at once: an author
6
6
  * fixing a descriptor should not have to rediscover the next problem one load at a time.
@@ -122,6 +122,13 @@ function resolveBackingServices(hosted, host, hostConfigPath, issues) {
122
122
  const hostedEntry = hosted.backingServices?.[kind];
123
123
  if (hostedEntry === undefined)
124
124
  continue;
125
+ // #2303 slice D — a host whose profile runs no broker gives its hosted applications none: their background work runs
126
+ // on their own database. Named here, because "declare it on the host" would send the author to a refusal there.
127
+ if (kind === BackingServiceKind.RABBITMQ && !environmentServiceProfileRunsMessageBroker(host.serviceProfile)) {
128
+ issues.push(`this application declares backingServices.${kind}, and its host runs serviceProfile '${host.serviceProfile}', `
129
+ + 'which runs no message broker: background work runs on the application\'s own database. Remove the declaration.');
130
+ continue;
131
+ }
125
132
  const hostEntry = host.backingServices[kind];
126
133
  if (hostEntry === undefined) {
127
134
  issues.push(`this application uses backingServices.${kind}, which its host does not declare. Every backing service a `
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-infra-env-config.js","sourceRoot":"","sources":["../../../src/project-config/hosted-infra-env-config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uCAAuC,EACvC,sBAAsB,EACtB,yBAAyB,GAK1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAiC,MAAM,mCAAmC,CAAC;AACtG,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAiBtE;;;GAGG;AACH,MAAM,OAAO,mCAAoC,SAAQ,KAAK;IACnD,MAAM,CAAoB;IAEnC,YAAY,gBAAwB,EAAE,cAAsB,EAAE,MAAyB;QACrF,KAAK,CAAC;YACJ,oDAAoD,gBAAgB,oCAAoC,cAAc,GAAG;YACzH,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC;SACzC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,qCAAqC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,2BAA2B,CAAC,KAA0C;IACpF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACjE,MAAM,IAAI,GAAG,CAAC,MAAyB,EAAS,EAAE;QAChD,MAAM,IAAI,mCAAmC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AE7C,IAAI,IAAI,CAAC,OAAO,KAAK,sBAAsB,CAAC,UAAU,EAAE,CAAC;QACvD,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,KAAK,sBAAsB,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7H,OAAO;YACL,OAAO,EAAE,sBAAsB,CAAC,UAAU;YAC1C,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,GAAG,CAAC,QAAQ,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnG,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACrE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,sBAAsB,CAAC,cAAc;QAC9C,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,GAAG,CAAC,QAAQ,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpG,CAAC;AACJ,CAAC","sourcesContent":["import {\n BACKING_SERVICE_APPLICATION_NAME_FIELDS,\n isHostedInfraEnvConfig,\n WildoInfraEnvConfigSchema,\n type WildoAuthoredInfraEnvConfig,\n type WildoHostedInfraEnvConfig,\n type WildoInfraEnvConfig,\n type WildoInfraEnvConfigInput,\n} from './define-infra-env-config';\nimport { BackingServiceKind, type BackingServicesEnvConfig } from './shared/backing-services.schemas';\nimport { WildoDeploymentRuntime } from './shared/environment.schemas';\n\n/**\n * Everything {@link resolveHostedInfraEnvConfig} needs, with the file paths kept so every refusal can name\n * BOTH descriptors — the one being resolved and the one it depends on.\n */\nexport interface HostedInfraEnvConfigResolutionInput {\n hosted: WildoHostedInfraEnvConfig;\n hostedConfigPath: string;\n /** The host's descriptor as evaluated — refused if it is itself hosted. */\n host: WildoAuthoredInfraEnvConfig;\n /** Absolute. */\n hostApplicationRoot: string;\n /** Absolute. */\n hostConfigPath: string;\n}\n\n/**\n * A hosted descriptor that cannot be resolved against its host. Carries every issue at once: an author\n * fixing a descriptor should not have to rediscover the next problem one load at a time.\n */\nexport class HostedInfraEnvConfigResolutionError extends Error {\n readonly issues: readonly string[];\n\n constructor(hostedConfigPath: string, hostConfigPath: string, issues: readonly string[]) {\n super([\n `Cannot resolve the hosted environment descriptor ${hostedConfigPath} against its infrastructure host ${hostConfigPath}:`,\n ...issues.map((issue) => ` - ${issue}`),\n ].join('\\n'));\n this.name = 'HostedInfraEnvConfigResolutionError';\n this.issues = issues;\n }\n}\n\n/**\n * Turn a hosted descriptor into the environment it actually runs in: the host's platform, the\n * application's own settings.\n *\n * A PURE function of the two evaluated descriptors — no filesystem — so the whole merge contract is\n * testable without a checkout. `loadInfraEnvConfig` does the reading and calls this.\n *\n * ## What comes from where\n *\n * Decided per member by `INFRA_ENV_FIELD_OWNERSHIP`:\n * - HOST members (runtime, location, runtime environment, platform database, remote provider, platform\n * storage) are the host's, verbatim;\n * - APPLICATION members are the hosted descriptor's, verbatim;\n * - `backingServices`: the kinds are the ones the HOSTED application lists (its needs), each of which the\n * host must declare; each entry is the host's server with the host's own name removed, overlaid with the\n * application's name;\n * - `kubernetes`: the host's namespace and ingress class, the application's replica counts;\n * - `deployment`: the host's runtime, the application's branch and tagging. The image registry is the host's\n * `remoteProvider.registryEndpoint` like everything else about where images live (#1165).\n *\n * ## Why the kinds are the application's, not the host's\n *\n * Rejected: handing a hosted application every store its host declares. That would give Wonder CRM a\n * MongoDB address it never asked for, named by the shared `'wildo_app'` fallback — the exact collision\n * the name rule exists to prevent. Declaring a kind stays how an application says it needs a store; what\n * changes is that it cannot say where that store is.\n *\n * ## The merged result is re-validated\n *\n * The merge is parsed through the STANDALONE schema, so every cross-field rule that holds for an owning\n * environment (an application on PostgreSQL needs `backingServices.postgresql`; a local environment cannot\n * author `cdn`; …) holds for the effective hosted one. Validating the hosted descriptor alone could not do\n * that: it does not know whether its host is local or remote.\n */\nexport function resolveHostedInfraEnvConfig(input: HostedInfraEnvConfigResolutionInput): WildoInfraEnvConfig {\n const { hosted, host, hostedConfigPath, hostConfigPath } = input;\n const fail = (issues: readonly string[]): never => {\n throw new HostedInfraEnvConfigResolutionError(hostedConfigPath, hostConfigPath, issues);\n };\n\n if (isHostedInfraEnvConfig(host)) {\n fail([\n `the host is itself hosted (its infrastructureHost is '${host.infrastructureHost.applicationRoot}'). An infrastructure `\n + 'host must OWN its infrastructure: point infrastructureHost at the application that does.',\n ]);\n }\n const owningHost = host as WildoInfraEnvConfig;\n const issues: string[] = [];\n\n if (owningHost.environment !== hosted.environment) {\n issues.push(`the host describes environment '${owningHost.environment}', this descriptor '${hosted.environment}'. A hosted `\n + 'application shares its host\\'s platform for ONE environment at a time, so both must describe the same one.');\n }\n\n const backingServices = resolveBackingServices(hosted, owningHost, hostConfigPath, issues);\n const kubernetes = resolveKubernetes(hosted, owningHost, issues);\n const deployment = resolveDeployment(hosted, owningHost, issues);\n\n if (issues.length > 0) fail(issues);\n\n const merged: WildoInfraEnvConfigInput = {\n environment: hosted.environment,\n locationType: owningHost.locationType,\n runtimeEnvironment: owningHost.runtimeEnvironment,\n runtime: owningHost.runtime,\n serviceProfile: owningHost.serviceProfile,\n database: owningHost.database,\n applicationDatabase: hosted.applicationDatabase,\n publicDomain: hosted.publicDomain,\n serviceHosts: hosted.serviceHosts,\n kubernetes,\n remoteProvider: owningHost.remoteProvider,\n deployment,\n backingServices,\n logging: hosted.logging,\n observability: hosted.observability,\n providerSelection: hosted.providerSelection,\n providerConfigurations: hosted.providerConfigurations,\n email: hosted.email,\n agentContentGuardrails: hosted.agentContentGuardrails,\n ownershipDnsStandIn: hosted.ownershipDnsStandIn,\n systemsOfRecord: hosted.systemsOfRecord,\n documentationSite: hosted.documentationSite,\n applicationCreationVerification: hosted.applicationCreationVerification,\n serviceAuth: hosted.serviceAuth,\n csp: hosted.csp,\n cdn: hosted.cdn,\n platformStorage: owningHost.platformStorage,\n platformKeyManagement: owningHost.platformKeyManagement,\n devCompanion: hosted.devCompanion,\n infrastructureHost: {\n applicationRoot: input.hostApplicationRoot,\n infraConfigPath: hostConfigPath,\n },\n };\n\n const parsed = WildoInfraEnvConfigSchema.safeParse(merged);\n if (!parsed.success) {\n fail(parsed.error.issues.map((issue) => {\n const path = issue.path.length > 0 ? `${issue.path.join('.')}: ` : '';\n return `the effective environment (host platform + this application) is invalid — ${path}${issue.message}`;\n }));\n }\n return (parsed as { data: WildoInfraEnvConfig }).data;\n}\n\nfunction resolveBackingServices(\n hosted: WildoHostedInfraEnvConfig,\n host: WildoInfraEnvConfig,\n hostConfigPath: string,\n issues: string[],\n): BackingServicesEnvConfig {\n const resolved: Record<string, Record<string, unknown>> = {};\n for (const kind of Object.values(BackingServiceKind)) {\n const hostedEntry = hosted.backingServices?.[kind] as Record<string, unknown> | undefined;\n if (hostedEntry === undefined) continue;\n\n const hostEntry = host.backingServices[kind] as Record<string, unknown> | undefined;\n if (hostEntry === undefined) {\n issues.push(`this application uses backingServices.${kind}, which its host does not declare. Every backing service a `\n + `hosted application needs is declared by its host: add backingServices.${kind} to ${hostConfigPath}.`);\n continue;\n }\n\n const nameField = BACKING_SERVICE_APPLICATION_NAME_FIELDS[kind];\n const server = { ...hostEntry };\n if (nameField !== null) delete server[nameField.field];\n\n if (nameField?.mustDifferFromHost) {\n const hostName = hostEntry[nameField.field];\n if (hostName === undefined) {\n /*\n * An unnamed host slice uses the framework's SHARED fallback (`'wildo_app'`, the default vhost `/`, the\n * fixed bucket). Those constants live with the env generators, not here, so the collision cannot be\n * decided by value — and refusing is the only answer that stays right when a fallback changes. A host\n * whose store is shared names its own slice.\n */\n issues.push(`the host declares backingServices.${kind} without a ${nameField.field}, so it uses the framework's `\n + `shared fallback name — which an application on its platform could collide with without either naming it. `\n + `A host whose ${kind} is shared must name its own ${nameField.field}: add it to ${hostConfigPath}.`);\n } else if (hostName === hostedEntry[nameField.field]) {\n issues.push(`backingServices.${kind}.${nameField.field} is '${String(hostedEntry[nameField.field])}', the same as the `\n + `host's. Both applications would read and write one ${kind} ${nameField.field}: name this application's own.`);\n }\n }\n\n resolved[kind] = { ...server, ...hostedEntry };\n }\n return resolved as BackingServicesEnvConfig;\n}\n\nfunction resolveKubernetes(\n hosted: WildoHostedInfraEnvConfig,\n host: WildoInfraEnvConfig,\n issues: string[],\n): WildoInfraEnvConfigInput['kubernetes'] {\n const services = hosted.kubernetes?.services;\n if (host.kubernetes === undefined) {\n if (services !== undefined) {\n issues.push('kubernetes.services sets replica counts, but the host declares no kubernetes block: there is no cluster '\n + 'for them to apply to. Remove them, or run the host on Kubernetes.');\n }\n return undefined;\n }\n return {\n namespace: host.kubernetes.namespace,\n ...(host.kubernetes.ingressClass !== undefined ? { ingressClass: host.kubernetes.ingressClass } : {}),\n ...(services !== undefined ? { services } : {}),\n };\n}\n\nfunction resolveDeployment(\n hosted: WildoHostedInfraEnvConfig,\n host: WildoInfraEnvConfig,\n issues: string[],\n): WildoInfraEnvConfigInput['deployment'] {\n const authored = hosted.deployment;\n if (authored === undefined) return undefined;\n\n if (host.runtime === WildoDeploymentRuntime.KUBERNETES) {\n const hostNamespace = host.deployment?.runtime === WildoDeploymentRuntime.KUBERNETES ? host.deployment.namespace : undefined;\n return {\n runtime: WildoDeploymentRuntime.KUBERNETES,\n branch: authored.branch,\n ...(authored.imageTagStrategy !== undefined ? { imageTagStrategy: authored.imageTagStrategy } : {}),\n ...(hostNamespace !== undefined ? { namespace: hostNamespace } : {}),\n };\n }\n\n return {\n runtime: WildoDeploymentRuntime.DOCKER_COMPOSE,\n branch: authored.branch,\n ...(authored.imageTagStrategy !== undefined ? { imageTagStrategy: authored.imageTagStrategy } : {}),\n };\n}\n"]}
1
+ {"version":3,"file":"hosted-infra-env-config.js","sourceRoot":"","sources":["../../../src/project-config/hosted-infra-env-config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uCAAuC,EACvC,sBAAsB,EACtB,yBAAyB,GAK1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAiC,MAAM,mCAAmC,CAAC;AACtG,OAAO,EAAE,0CAA0C,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAiBlH;;;GAGG;AACH,MAAM,OAAO,mCAAoC,SAAQ,KAAK;IACnD,MAAM,CAAoB;IAEnC,YAAY,gBAAwB,EAAE,cAAsB,EAAE,MAAyB;QACrF,KAAK,CAAC;YACJ,oDAAoD,gBAAgB,oCAAoC,cAAc,GAAG;YACzH,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,CAAC;SACzC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,qCAAqC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,2BAA2B,CAAC,KAA0C;IACpF,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACjE,MAAM,IAAI,GAAG,CAAC,MAAyB,EAAS,EAAE;QAChD,MAAM,IAAI,mCAAmC,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IAC1F,CAAC,CAAC;IAEF,IAAI,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,yDAAyD,IAAI,CAAC,kBAAkB,CAAC,eAAe,wBAAwB;kBACtH,0FAA0F;SAC7F,CAAC,CAAC;IACL,CAAC;IACD,MAAM,UAAU,G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CAAC;IAE7C,IAAI,IAAI,CAAC,OAAO,KAAK,sBAAsB,CAAC,UAAU,EAAE,CAAC;QACvD,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,KAAK,sBAAsB,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7H,OAAO;YACL,OAAO,EAAE,sBAAsB,CAAC,UAAU;YAC1C,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,GAAG,CAAC,QAAQ,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnG,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACrE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,sBAAsB,CAAC,cAAc;QAC9C,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,GAAG,CAAC,QAAQ,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpG,CAAC;AACJ,CAAC","sourcesContent":["import {\n BACKING_SERVICE_APPLICATION_NAME_FIELDS,\n isHostedInfraEnvConfig,\n WildoInfraEnvConfigSchema,\n type WildoAuthoredInfraEnvConfig,\n type WildoHostedInfraEnvConfig,\n type WildoInfraEnvConfig,\n type WildoInfraEnvConfigInput,\n} from './define-infra-env-config';\nimport { BackingServiceKind, type BackingServicesEnvConfig } from './shared/backing-services.schemas';\nimport { environmentServiceProfileRunsMessageBroker, WildoDeploymentRuntime } from './shared/environment.schemas';\n\n/**\n * Everything {@link resolveHostedInfraEnvConfig} needs, with the file paths kept so every refusal can name\n * BOTH descriptors — the one being resolved and the one it depends on.\n */\nexport interface HostedInfraEnvConfigResolutionInput {\n hosted: WildoHostedInfraEnvConfig;\n hostedConfigPath: string;\n /** The host's descriptor as evaluated — refused if it is itself hosted. */\n host: WildoAuthoredInfraEnvConfig;\n /** Absolute. */\n hostApplicationRoot: string;\n /** Absolute. */\n hostConfigPath: string;\n}\n\n/**\n * A hosted descriptor that cannot be resolved against its host. Carries every issue at once: an author\n * fixing a descriptor should not have to rediscover the next problem one load at a time.\n */\nexport class HostedInfraEnvConfigResolutionError extends Error {\n readonly issues: readonly string[];\n\n constructor(hostedConfigPath: string, hostConfigPath: string, issues: readonly string[]) {\n super([\n `Cannot resolve the hosted environment descriptor ${hostedConfigPath} against its infrastructure host ${hostConfigPath}:`,\n ...issues.map((issue) => ` - ${issue}`),\n ].join('\\n'));\n this.name = 'HostedInfraEnvConfigResolutionError';\n this.issues = issues;\n }\n}\n\n/**\n * Turn a hosted descriptor into the environment it actually runs in: the host's platform, the\n * application's own settings.\n *\n * A PURE function of the two evaluated descriptors — no filesystem — so the whole merge contract is\n * testable without a checkout. `loadInfraEnvConfig` does the reading and calls this.\n *\n * ## What comes from where\n *\n * Decided per member by `INFRA_ENV_FIELD_OWNERSHIP`:\n * - HOST members (runtime, location, runtime environment, platform database, remote provider, platform\n * storage) are the host's, verbatim;\n * - APPLICATION members are the hosted descriptor's, verbatim;\n * - `backingServices`: the kinds are the ones the HOSTED application lists (its needs), each of which the\n * host must declare; each entry is the host's server with the host's own name removed, overlaid with the\n * application's name;\n * - `kubernetes`: the host's namespace and ingress class, the application's replica counts;\n * - `deployment`: the host's runtime, the application's branch and tagging. The image registry is the host's\n * `remoteProvider.registryEndpoint` like everything else about where images live (#1165).\n *\n * ## Why the kinds are the application's, not the host's\n *\n * Rejected: handing a hosted application every store its host declares. That would give Wonder CRM a\n * MongoDB address it never asked for, named by the shared `'wildo_app'` fallback — the exact collision\n * the name rule exists to prevent. Declaring a kind stays how an application says it needs a store; what\n * changes is that it cannot say where that store is.\n *\n * ## The merged result is re-validated\n *\n * The merge is parsed through the STANDALONE schema, so every cross-field rule that holds for an owning\n * environment (an application on PostgreSQL needs `backingServices.postgresql`; a local environment cannot\n * author `cdn`; …) holds for the effective hosted one. Validating the hosted descriptor alone could not do\n * that: it does not know whether its host is local or remote.\n */\nexport function resolveHostedInfraEnvConfig(input: HostedInfraEnvConfigResolutionInput): WildoInfraEnvConfig {\n const { hosted, host, hostedConfigPath, hostConfigPath } = input;\n const fail = (issues: readonly string[]): never => {\n throw new HostedInfraEnvConfigResolutionError(hostedConfigPath, hostConfigPath, issues);\n };\n\n if (isHostedInfraEnvConfig(host)) {\n fail([\n `the host is itself hosted (its infrastructureHost is '${host.infrastructureHost.applicationRoot}'). An infrastructure `\n + 'host must OWN its infrastructure: point infrastructureHost at the application that does.',\n ]);\n }\n const owningHost = host as WildoInfraEnvConfig;\n const issues: string[] = [];\n\n if (owningHost.environment !== hosted.environment) {\n issues.push(`the host describes environment '${owningHost.environment}', this descriptor '${hosted.environment}'. A hosted `\n + 'application shares its host\\'s platform for ONE environment at a time, so both must describe the same one.');\n }\n\n const backingServices = resolveBackingServices(hosted, owningHost, hostConfigPath, issues);\n const kubernetes = resolveKubernetes(hosted, owningHost, issues);\n const deployment = resolveDeployment(hosted, owningHost, issues);\n\n if (issues.length > 0) fail(issues);\n\n const merged: WildoInfraEnvConfigInput = {\n environment: hosted.environment,\n locationType: owningHost.locationType,\n runtimeEnvironment: owningHost.runtimeEnvironment,\n runtime: owningHost.runtime,\n serviceProfile: owningHost.serviceProfile,\n database: owningHost.database,\n applicationDatabase: hosted.applicationDatabase,\n publicDomain: hosted.publicDomain,\n serviceHosts: hosted.serviceHosts,\n kubernetes,\n remoteProvider: owningHost.remoteProvider,\n deployment,\n backingServices,\n logging: hosted.logging,\n observability: hosted.observability,\n providerSelection: hosted.providerSelection,\n providerConfigurations: hosted.providerConfigurations,\n email: hosted.email,\n agentContentGuardrails: hosted.agentContentGuardrails,\n ownershipDnsStandIn: hosted.ownershipDnsStandIn,\n systemsOfRecord: hosted.systemsOfRecord,\n documentationSite: hosted.documentationSite,\n applicationCreationVerification: hosted.applicationCreationVerification,\n serviceAuth: hosted.serviceAuth,\n csp: hosted.csp,\n cdn: hosted.cdn,\n platformStorage: owningHost.platformStorage,\n platformKeyManagement: owningHost.platformKeyManagement,\n devCompanion: hosted.devCompanion,\n infrastructureHost: {\n applicationRoot: input.hostApplicationRoot,\n infraConfigPath: hostConfigPath,\n },\n };\n\n const parsed = WildoInfraEnvConfigSchema.safeParse(merged);\n if (!parsed.success) {\n fail(parsed.error.issues.map((issue) => {\n const path = issue.path.length > 0 ? `${issue.path.join('.')}: ` : '';\n return `the effective environment (host platform + this application) is invalid — ${path}${issue.message}`;\n }));\n }\n return (parsed as { data: WildoInfraEnvConfig }).data;\n}\n\nfunction resolveBackingServices(\n hosted: WildoHostedInfraEnvConfig,\n host: WildoInfraEnvConfig,\n hostConfigPath: string,\n issues: string[],\n): BackingServicesEnvConfig {\n const resolved: Record<string, Record<string, unknown>> = {};\n for (const kind of Object.values(BackingServiceKind)) {\n const hostedEntry = hosted.backingServices?.[kind] as Record<string, unknown> | undefined;\n if (hostedEntry === undefined) continue;\n\n // #2303 slice D — a host whose profile runs no broker gives its hosted applications none: their background work runs\n // on their own database. Named here, because \"declare it on the host\" would send the author to a refusal there.\n if (kind === BackingServiceKind.RABBITMQ && !environmentServiceProfileRunsMessageBroker(host.serviceProfile)) {\n issues.push(`this application declares backingServices.${kind}, and its host runs serviceProfile '${host.serviceProfile}', `\n + 'which runs no message broker: background work runs on the application\\'s own database. Remove the declaration.');\n continue;\n }\n const hostEntry = host.backingServices[kind] as Record<string, unknown> | undefined;\n if (hostEntry === undefined) {\n issues.push(`this application uses backingServices.${kind}, which its host does not declare. Every backing service a `\n + `hosted application needs is declared by its host: add backingServices.${kind} to ${hostConfigPath}.`);\n continue;\n }\n\n const nameField = BACKING_SERVICE_APPLICATION_NAME_FIELDS[kind];\n const server = { ...hostEntry };\n if (nameField !== null) delete server[nameField.field];\n\n if (nameField?.mustDifferFromHost) {\n const hostName = hostEntry[nameField.field];\n if (hostName === undefined) {\n /*\n * An unnamed host slice uses the framework's SHARED fallback (`'wildo_app'`, the default vhost `/`, the\n * fixed bucket). Those constants live with the env generators, not here, so the collision cannot be\n * decided by value — and refusing is the only answer that stays right when a fallback changes. A host\n * whose store is shared names its own slice.\n */\n issues.push(`the host declares backingServices.${kind} without a ${nameField.field}, so it uses the framework's `\n + `shared fallback name — which an application on its platform could collide with without either naming it. `\n + `A host whose ${kind} is shared must name its own ${nameField.field}: add it to ${hostConfigPath}.`);\n } else if (hostName === hostedEntry[nameField.field]) {\n issues.push(`backingServices.${kind}.${nameField.field} is '${String(hostedEntry[nameField.field])}', the same as the `\n + `host's. Both applications would read and write one ${kind} ${nameField.field}: name this application's own.`);\n }\n }\n\n resolved[kind] = { ...server, ...hostedEntry };\n }\n return resolved as BackingServicesEnvConfig;\n}\n\nfunction resolveKubernetes(\n hosted: WildoHostedInfraEnvConfig,\n host: WildoInfraEnvConfig,\n issues: string[],\n): WildoInfraEnvConfigInput['kubernetes'] {\n const services = hosted.kubernetes?.services;\n if (host.kubernetes === undefined) {\n if (services !== undefined) {\n issues.push('kubernetes.services sets replica counts, but the host declares no kubernetes block: there is no cluster '\n + 'for them to apply to. Remove them, or run the host on Kubernetes.');\n }\n return undefined;\n }\n return {\n namespace: host.kubernetes.namespace,\n ...(host.kubernetes.ingressClass !== undefined ? { ingressClass: host.kubernetes.ingressClass } : {}),\n ...(services !== undefined ? { services } : {}),\n };\n}\n\nfunction resolveDeployment(\n hosted: WildoHostedInfraEnvConfig,\n host: WildoInfraEnvConfig,\n issues: string[],\n): WildoInfraEnvConfigInput['deployment'] {\n const authored = hosted.deployment;\n if (authored === undefined) return undefined;\n\n if (host.runtime === WildoDeploymentRuntime.KUBERNETES) {\n const hostNamespace = host.deployment?.runtime === WildoDeploymentRuntime.KUBERNETES ? host.deployment.namespace : undefined;\n return {\n runtime: WildoDeploymentRuntime.KUBERNETES,\n branch: authored.branch,\n ...(authored.imageTagStrategy !== undefined ? { imageTagStrategy: authored.imageTagStrategy } : {}),\n ...(hostNamespace !== undefined ? { namespace: hostNamespace } : {}),\n };\n }\n\n return {\n runtime: WildoDeploymentRuntime.DOCKER_COMPOSE,\n branch: authored.branch,\n ...(authored.imageTagStrategy !== undefined ? { imageTagStrategy: authored.imageTagStrategy } : {}),\n };\n}\n"]}