@ankhorage/infra 4.1.0 → 4.1.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/minikube/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AAUrB,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,GAAE,+BAAoC,GAC5C,8BAA8B,CAmFhC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/minikube/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AAUrB,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,GAAE,+BAAoC,GAC5C,8BAA8B,CAuFhC"}
@@ -14,6 +14,8 @@ export function generateMinikubeInfra(manifest, options = {}) {
14
14
  throw new Error(`Unsupported database provider for minikube adapter: "${manifest.database.provider}". Only "supabase" is implemented.`);
15
15
  }
16
16
  const appSlug = validateCanonicalAppSlug(options.appManifest?.metadata.slug);
17
+ const appRuntimeEnabled = options.appManifest?.deploy === undefined ||
18
+ options.appManifest.deploy.targets.web?.enabled === true;
17
19
  const namespace = APP_NAMESPACE;
18
20
  const authArtifacts = generateAuthProviderArtifacts({
19
21
  appManifest: options.appManifest,
@@ -55,6 +57,7 @@ export function generateMinikubeInfra(manifest, options = {}) {
55
57
  providerNamespaces,
56
58
  providerLifecycle,
57
59
  extraEnvEntries,
60
+ appRuntimeEnabled,
58
61
  });
59
62
  const warnings = unique([
60
63
  ...collectWarnings(manifest),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/minikube/index.ts"],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,CAAC,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import { validateInfraApiSupport } from '../../infraValidation';\nimport type {\n GeneratedPackageDependency,\n InfraManifestInput,\n InfrastructureGenerationOptions,\n InfrastructureGenerationResult,\n} from '../../types';\nimport { generateAuthProviderArtifacts } from './auth';\nimport { generateAuthorizationArtifacts } from './authz';\nimport { APP_NAMESPACE, generateMinikubeBaseArtifacts } from './base';\nimport { generateSecretStoreArtifacts } from './secrets';\nimport { generateStorageArtifacts } from './storage';\n\nconst CANONICAL_PROJECT_SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,38}[a-z0-9])?$/;\nconst BUILT_IN_NAMESPACES = new Set([APP_NAMESPACE, 'supabase']);\n\nexport function generateMinikubeInfra(\n manifest: InfraManifestInput,\n options: InfrastructureGenerationOptions = {},\n): InfrastructureGenerationResult {\n if (manifest.deployment?.target !== 'minikube') {\n throw new Error(\n `Minikube adapter only supports deployment target \"minikube\" (received \"${manifest.deployment?.target ?? 'undefined'}\").`,\n );\n }\n\n if (manifest.database?.provider && manifest.database.provider !== 'supabase') {\n throw new Error(\n `Unsupported database provider for minikube adapter: \"${manifest.database.provider}\". Only \"supabase\" is implemented.`,\n );\n }\n\n const appSlug = validateCanonicalAppSlug(options.appManifest?.metadata.slug);\n const namespace = APP_NAMESPACE;\n\n const authArtifacts = generateAuthProviderArtifacts({\n appManifest: options.appManifest,\n manifest,\n namespace,\n });\n const authzArtifacts = generateAuthorizationArtifacts({\n manifest,\n namespace,\n appManifest: options.appManifest,\n });\n const storageArtifacts = generateStorageArtifacts({ manifest, namespace });\n const secretStoreArtifacts = generateSecretStoreArtifacts({ manifest, namespace });\n\n const extraResources = unique([\n ...authArtifacts.resources,\n ...authzArtifacts.resources,\n ...storageArtifacts.resources,\n ...secretStoreArtifacts.resources,\n ]);\n const providerLifecycle = [\n ...authArtifacts.providerLifecycle,\n ...authzArtifacts.providerLifecycle,\n ...storageArtifacts.providerLifecycle,\n ...secretStoreArtifacts.providerLifecycle,\n ];\n const providerNamespaces = unique([\n ...providerLifecycle.map((contribution) => contribution.namespace),\n ]).filter((providerNamespace) => !BUILT_IN_NAMESPACES.has(providerNamespace));\n const extraEnvEntries = unique([\n ...authArtifacts.envEntries,\n ...authzArtifacts.envEntries,\n ...storageArtifacts.envEntries,\n ...secretStoreArtifacts.envEntries,\n ]);\n\n const baseFiles = generateMinikubeBaseArtifacts({\n manifest,\n appSlug,\n extraResources,\n providerNamespaces,\n providerLifecycle,\n extraEnvEntries,\n });\n\n const warnings = unique([\n ...collectWarnings(manifest),\n ...authArtifacts.warnings,\n ...authzArtifacts.warnings,\n ...storageArtifacts.warnings,\n ...secretStoreArtifacts.warnings,\n ]);\n\n return {\n files: [\n ...baseFiles,\n ...authArtifacts.files,\n ...authzArtifacts.files,\n ...storageArtifacts.files,\n ...secretStoreArtifacts.files,\n ],\n warnings,\n meta: {\n target: 'minikube',\n providers: collectProviders(manifest),\n },\n dependencies: collectDependencies(manifest),\n };\n}\n\nfunction collectProviders(manifest: InfraManifestInput): string[] {\n const providers = new Set<string>();\n\n if (manifest.auth?.provider) providers.add(manifest.auth.provider);\n if (manifest.auth?.authorization?.engine) {\n providers.add(manifest.auth.authorization.engine);\n }\n if (manifest.database?.provider) providers.add(manifest.database.provider);\n if (manifest.storage?.provider) providers.add(manifest.storage.provider);\n if (manifest.secretStore?.provider) providers.add(manifest.secretStore.provider);\n if (manifest.state?.provider) providers.add(manifest.state.provider);\n\n return [...providers].sort();\n}\n\nfunction collectDependencies(manifest: InfraManifestInput): readonly GeneratedPackageDependency[] {\n if (manifest.state?.provider !== 'legend') {\n return [];\n }\n\n return [\n {\n name: '@ankhorage/state-legend',\n version: '^0.1.0',\n reason: 'Selected by infra.state.provider=legend.',\n },\n ];\n}\n\nfunction collectWarnings(manifest: InfraManifestInput): string[] {\n const warnings = [...validateInfraApiSupport(manifest)];\n\n if (manifest.deployment?.monitoring) {\n warnings.push(\n 'Monitoring is enabled in manifest, but monitoring stack resources are not generated yet.',\n );\n }\n\n if (manifest.networking?.cdn) {\n warnings.push('CDN is enabled in manifest, but CDN resources are not generated for minikube.');\n }\n\n return warnings;\n}\n\nfunction validateCanonicalAppSlug(slug: string | undefined): string {\n if (!slug) {\n throw new Error(\n 'Cannot generate Minikube infrastructure: appManifest.metadata.slug is required.',\n );\n }\n\n if (slug.trim() !== slug || !CANONICAL_PROJECT_SLUG_RE.test(slug)) {\n throw new Error(\n 'Cannot generate Minikube infrastructure: appManifest.metadata.slug must be a canonical lowercase slug up to 40 characters using only a-z, 0-9, and hyphens, without leading or trailing hyphens.',\n );\n }\n\n return slug;\n}\n\nfunction unique(values: string[]): string[] {\n return [...new Set(values)];\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/minikube/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAOhE,OAAO,EAAE,6BAA6B,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,MAAM,yBAAyB,GAAG,wCAAwC,CAAC;AAC3E,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjE,MAAM,UAAU,qBAAqB,CACnC,QAA4B,EAC5B,UAA2C,EAAE;IAE7C,IAAI,QAAQ,CAAC,UAAU,EAAE,MAAM,KAAK,UAAU,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CACb,0EAA0E,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,WAAW,KAAK,CAC1H,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC,QAAQ,E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CAAC,UAAU,EAAE,UAAU,EAAE,CAAC;QACpC,QAAQ,CAAC,IAAI,CACX,0FAA0F,CAC3F,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC;QAC7B,QAAQ,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;IACjG,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,wBAAwB,CAAC,IAAwB;IACxD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CACb,kMAAkM,CACnM,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,MAAM,CAAC,MAAgB;IAC9B,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import { validateInfraApiSupport } from '../../infraValidation';\nimport type {\n GeneratedPackageDependency,\n InfraManifestInput,\n InfrastructureGenerationOptions,\n InfrastructureGenerationResult,\n} from '../../types';\nimport { generateAuthProviderArtifacts } from './auth';\nimport { generateAuthorizationArtifacts } from './authz';\nimport { APP_NAMESPACE, generateMinikubeBaseArtifacts } from './base';\nimport { generateSecretStoreArtifacts } from './secrets';\nimport { generateStorageArtifacts } from './storage';\n\nconst CANONICAL_PROJECT_SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,38}[a-z0-9])?$/;\nconst BUILT_IN_NAMESPACES = new Set([APP_NAMESPACE, 'supabase']);\n\nexport function generateMinikubeInfra(\n manifest: InfraManifestInput,\n options: InfrastructureGenerationOptions = {},\n): InfrastructureGenerationResult {\n if (manifest.deployment?.target !== 'minikube') {\n throw new Error(\n `Minikube adapter only supports deployment target \"minikube\" (received \"${manifest.deployment?.target ?? 'undefined'}\").`,\n );\n }\n\n if (manifest.database?.provider && manifest.database.provider !== 'supabase') {\n throw new Error(\n `Unsupported database provider for minikube adapter: \"${manifest.database.provider}\". Only \"supabase\" is implemented.`,\n );\n }\n\n const appSlug = validateCanonicalAppSlug(options.appManifest?.metadata.slug);\n const appRuntimeEnabled =\n options.appManifest?.deploy === undefined ||\n options.appManifest.deploy.targets.web?.enabled === true;\n const namespace = APP_NAMESPACE;\n\n const authArtifacts = generateAuthProviderArtifacts({\n appManifest: options.appManifest,\n manifest,\n namespace,\n });\n const authzArtifacts = generateAuthorizationArtifacts({\n manifest,\n namespace,\n appManifest: options.appManifest,\n });\n const storageArtifacts = generateStorageArtifacts({ manifest, namespace });\n const secretStoreArtifacts = generateSecretStoreArtifacts({ manifest, namespace });\n\n const extraResources = unique([\n ...authArtifacts.resources,\n ...authzArtifacts.resources,\n ...storageArtifacts.resources,\n ...secretStoreArtifacts.resources,\n ]);\n const providerLifecycle = [\n ...authArtifacts.providerLifecycle,\n ...authzArtifacts.providerLifecycle,\n ...storageArtifacts.providerLifecycle,\n ...secretStoreArtifacts.providerLifecycle,\n ];\n const providerNamespaces = unique([\n ...providerLifecycle.map((contribution) => contribution.namespace),\n ]).filter((providerNamespace) => !BUILT_IN_NAMESPACES.has(providerNamespace));\n const extraEnvEntries = unique([\n ...authArtifacts.envEntries,\n ...authzArtifacts.envEntries,\n ...storageArtifacts.envEntries,\n ...secretStoreArtifacts.envEntries,\n ]);\n\n const baseFiles = generateMinikubeBaseArtifacts({\n manifest,\n appSlug,\n extraResources,\n providerNamespaces,\n providerLifecycle,\n extraEnvEntries,\n appRuntimeEnabled,\n });\n\n const warnings = unique([\n ...collectWarnings(manifest),\n ...authArtifacts.warnings,\n ...authzArtifacts.warnings,\n ...storageArtifacts.warnings,\n ...secretStoreArtifacts.warnings,\n ]);\n\n return {\n files: [\n ...baseFiles,\n ...authArtifacts.files,\n ...authzArtifacts.files,\n ...storageArtifacts.files,\n ...secretStoreArtifacts.files,\n ],\n warnings,\n meta: {\n target: 'minikube',\n providers: collectProviders(manifest),\n },\n dependencies: collectDependencies(manifest),\n };\n}\n\nfunction collectProviders(manifest: InfraManifestInput): string[] {\n const providers = new Set<string>();\n\n if (manifest.auth?.provider) providers.add(manifest.auth.provider);\n if (manifest.auth?.authorization?.engine) {\n providers.add(manifest.auth.authorization.engine);\n }\n if (manifest.database?.provider) providers.add(manifest.database.provider);\n if (manifest.storage?.provider) providers.add(manifest.storage.provider);\n if (manifest.secretStore?.provider) providers.add(manifest.secretStore.provider);\n if (manifest.state?.provider) providers.add(manifest.state.provider);\n\n return [...providers].sort();\n}\n\nfunction collectDependencies(manifest: InfraManifestInput): readonly GeneratedPackageDependency[] {\n if (manifest.state?.provider !== 'legend') {\n return [];\n }\n\n return [\n {\n name: '@ankhorage/state-legend',\n version: '^0.1.0',\n reason: 'Selected by infra.state.provider=legend.',\n },\n ];\n}\n\nfunction collectWarnings(manifest: InfraManifestInput): string[] {\n const warnings = [...validateInfraApiSupport(manifest)];\n\n if (manifest.deployment?.monitoring) {\n warnings.push(\n 'Monitoring is enabled in manifest, but monitoring stack resources are not generated yet.',\n );\n }\n\n if (manifest.networking?.cdn) {\n warnings.push('CDN is enabled in manifest, but CDN resources are not generated for minikube.');\n }\n\n return warnings;\n}\n\nfunction validateCanonicalAppSlug(slug: string | undefined): string {\n if (!slug) {\n throw new Error(\n 'Cannot generate Minikube infrastructure: appManifest.metadata.slug is required.',\n );\n }\n\n if (slug.trim() !== slug || !CANONICAL_PROJECT_SLUG_RE.test(slug)) {\n throw new Error(\n 'Cannot generate Minikube infrastructure: appManifest.metadata.slug must be a canonical lowercase slug up to 40 characters using only a-z, 0-9, and hyphens, without leading or trailing hyphens.',\n );\n }\n\n return slug;\n}\n\nfunction unique(values: string[]): string[] {\n return [...new Set(values)];\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/infra",
3
3
  "type": "module",
4
- "version": "4.1.0",
4
+ "version": "4.1.1",
5
5
  "description": "Project-aware infrastructure generation library and executable Ankh provider for Ankhorage.",
6
6
  "homepage": "https://github.com/ankhorage/infra#readme",
7
7
  "bugs": {
@@ -25,21 +25,31 @@ when provided by caller.
25
25
 
26
26
  ## Runtime Scripts
27
27
 
28
- - `scripts/up.sh`: starts `minikube -p <slug>`, applies manifests, waits for Supabase, runs migrations with CLI telemetry disabled for that command, builds/loads the app image, and starts slug-owned port-forwards.
28
+ - `scripts/up.sh`: starts `minikube -p <slug>`, applies manifests, waits for Supabase, runs migrations with CLI telemetry disabled for that command, and starts slug-owned port-forwards. It builds and deploys the Kubernetes Web app runtime only when the canonical app manifest enables `deploy.targets.web` (legacy manifests without `deploy` retain the Web runtime).
29
29
  - `scripts/down.sh`: stops slug-owned port-forwards, then runs `minikube stop -p <slug>`. Persistent profile data remains.
30
30
  - `scripts/reset.sh`: requires `ANKH_RESET_CONFIRM=<slug>` and deletes/recreates namespaces `app` and `supabase`, including Supabase DB and Storage PVC data. It does not delete the Minikube profile.
31
31
  - `scripts/destroy.sh`: stops slug-owned port-forwards and runs `minikube delete -p <slug>`.
32
32
  - `scripts/status.sh`: reports profile, namespace, workload, and port-forward health.
33
- - `scripts/port-forward.sh`: owns named forwards for `app`, `supabase-gateway`, `studio`, and `db-migration`, plus provider-aware `runtime` and `all` groups.
33
+ - `scripts/port-forward.sh`: owns topology-derived named forwards plus provider-aware `runtime` and `all` groups.
34
34
  - `scripts/build-app-image.sh`: exports Expo web build from app source and builds the Docker image.
35
35
 
36
36
  The `runtime` group is the canonical repair lifecycle for host endpoints required by the
37
- running app. It always contains `app` and adds `supabase-gateway` when the generated
38
- Supabase Kubernetes runtime is enabled. It deliberately excludes `studio` and
39
- `db-migration`; `all` retains those operational/bootstrap forwards. Start, stop, or inspect
40
- the group with `scripts/port-forward.sh {start|stop|status} runtime`. Package consumers
41
- should call `ensureProjectInfrastructureRuntime()` from `@ankhorage/infra/project` instead
42
- of depending on concrete provider forward names.
37
+ running app. It contains `app` only when the generated topology includes the Kubernetes Web
38
+ app Service, and adds `supabase-gateway` when the generated Supabase Kubernetes runtime is
39
+ enabled. Native-only apps therefore restore provider endpoints without requiring a fictional
40
+ app Service. The group deliberately excludes `studio` and `db-migration`; `all` retains
41
+ those operational/bootstrap forwards. Start, stop, or inspect the group with
42
+ `scripts/port-forward.sh {start|stop|status} runtime`. Package consumers should call
43
+ `ensureProjectInfrastructureRuntime()` from `@ankhorage/infra/project` instead of depending
44
+ on concrete provider forward names. Forward startup retries bounded transient Kubernetes
45
+ pod-selection and readiness failures that can occur immediately after a profile restart.
46
+ Active runtime/all groups contain only targets in the generated topology. Cleanup retains
47
+ the exact identities of all Infra-managed forwards so a Web-to-native regeneration safely
48
+ stops an obsolete owned `app` forward without making it an active start target.
49
+
50
+ When the Web app runtime is disabled, `up.sh` also reconciles the former generated
51
+ `Deployment/app-runtime`, `Service/app-runtime`, and `ConfigMap/app-infra-config` with exact,
52
+ idempotent deletes. It does not prune unrelated resources or delete the `app` namespace.
43
53
 
44
54
  ## Supabase Runtime
45
55
 
@@ -387,7 +387,9 @@ describe('generateMinikubeBaseArtifacts app-owned cluster model', () => {
387
387
  );
388
388
  expect(upScript).toContain('ensure_supabase_runtime_env\nsync_app_public_supabase_env');
389
389
  expect(upScript.lastIndexOf('sync_app_public_supabase_env')).toBeLessThan(
390
- upScript.indexOf('if [[ "${APP_BUILD_ENABLED}" == "true" ]]'),
390
+ upScript.indexOf(
391
+ 'if [[ "${APP_RUNTIME_ENABLED}" == "true" && "${APP_BUILD_ENABLED}" == "true" ]]',
392
+ ),
391
393
  );
392
394
  expect(upScript).not.toContain('SUPABASE_SERVICE_ROLE_KEY" "${SUPABASE_SERVICE_ROLE_KEY}"');
393
395
  expect(buildScript).toContain(
@@ -457,13 +459,11 @@ describe('generateMinikubeBaseArtifacts app-owned cluster model', () => {
457
459
  'ALL_FORWARD_NAMES=(app supabase-gateway studio db-migration)',
458
460
  );
459
461
  expect(portForwardScript).toContain(
460
- 'start:runtime) for_each_forward start "${RUNTIME_FORWARD_NAMES[@]}"',
462
+ 'start:runtime) for_each_forward start app supabase-gateway',
461
463
  );
464
+ expect(portForwardScript).toContain('for_each_forward stop app supabase-gateway');
462
465
  expect(portForwardScript).toContain(
463
- 'stop:runtime) for_each_forward stop "${RUNTIME_FORWARD_NAMES[@]}"',
464
- );
465
- expect(portForwardScript).toContain(
466
- 'status:runtime) for_each_forward status "${RUNTIME_FORWARD_NAMES[@]}"',
466
+ 'status:runtime) for_each_forward status app supabase-gateway',
467
467
  );
468
468
  expect(portForwardScript).toContain('${PROFILE}-${1}.pid');
469
469
  expect(portForwardScript).toContain('crashed stale_pid');
@@ -519,8 +519,139 @@ describe('generateMinikubeBaseArtifacts app-owned cluster model', () => {
519
519
 
520
520
  expect(portForwardScript).toContain('RUNTIME_FORWARD_NAMES=(app)');
521
521
  expect(portForwardScript).toContain('ALL_FORWARD_NAMES=(app)');
522
+ expect(portForwardScript).toContain(
523
+ 'OBSOLETE_FORWARD_NAMES=(supabase-gateway studio db-migration)',
524
+ );
522
525
  expect(portForwardScript).not.toContain('RUNTIME_FORWARD_NAMES=(app supabase-gateway)');
523
526
  });
527
+
528
+ test('reconciles a generated Web topology to the exact native-only desired topology', () => {
529
+ const baseManifest = createAppManifest('topology-upgrade');
530
+ const webResult = generateInfrastructure(createSupabaseManifest(), {
531
+ appManifest: {
532
+ ...baseManifest,
533
+ deploy: { targets: { web: { enabled: true } } },
534
+ },
535
+ });
536
+ const nativeResult = generateInfrastructure(createSupabaseManifest(), {
537
+ appManifest: {
538
+ ...baseManifest,
539
+ deploy: {
540
+ targets: {
541
+ android: { enabled: true, package: 'com.ankh.topologyupgrade' },
542
+ },
543
+ },
544
+ },
545
+ });
546
+ const webPaths = webResult.files.map((file) => file.path);
547
+ const nativePaths = nativeResult.files.map((file) => file.path);
548
+ const webAppConfig = getFile(webResult.files, 'infra/minikube/k8s/app.configmap.yaml');
549
+ const webUpScript = getFile(webResult.files, 'infra/minikube/scripts/up.sh');
550
+ const nativeUpScript = getFile(nativeResult.files, 'infra/minikube/scripts/up.sh');
551
+ const nativePortForwardScript = getFile(
552
+ nativeResult.files,
553
+ 'infra/minikube/scripts/port-forward.sh',
554
+ );
555
+ const exactDelete =
556
+ 'delete deployment/app-runtime service/app-runtime configmap/app-infra-config --ignore-not-found';
557
+
558
+ expect(webPaths).toContain('infra/minikube/k8s/app/deployment.yaml');
559
+ expect(webPaths).toContain('infra/minikube/k8s/app/service.yaml');
560
+ expect(webPaths).toContain('infra/minikube/k8s/app.configmap.yaml');
561
+ expect(webAppConfig).toContain('name: app-infra-config');
562
+ expect(getFile(webResult.files, 'infra/minikube/scripts/port-forward.sh')).toContain(
563
+ 'RUNTIME_FORWARD_NAMES=(app supabase-gateway)',
564
+ );
565
+
566
+ expect(nativePaths).not.toContain('infra/minikube/k8s/app/deployment.yaml');
567
+ expect(nativePaths).not.toContain('infra/minikube/k8s/app/service.yaml');
568
+ expect(nativePaths).not.toContain('infra/minikube/k8s/app.configmap.yaml');
569
+ expect(nativeUpScript).toContain(exactDelete);
570
+ expect(nativeUpScript).toContain('"${PORT_FORWARD_SCRIPT}" stop obsolete');
571
+ expect(nativeUpScript.indexOf(exactDelete)).toBeLessThan(
572
+ nativeUpScript.indexOf('"${PORT_FORWARD_SCRIPT}" stop obsolete'),
573
+ );
574
+ expect(nativePortForwardScript).toContain(
575
+ 'MANAGED_FORWARD_NAMES=(app supabase-gateway studio db-migration)',
576
+ );
577
+ expect(nativePortForwardScript).toContain('OBSOLETE_FORWARD_NAMES=(app)');
578
+ expect(webUpScript).not.toContain(exactDelete);
579
+ expect(webUpScript).not.toContain('stop obsolete');
580
+ });
581
+
582
+ test('derives native-only runtime topology without a fictional Kubernetes app service', () => {
583
+ const appManifest = {
584
+ ...createAppManifest('native-only'),
585
+ deploy: {
586
+ targets: {
587
+ android: { enabled: true, package: 'com.ankh.nativeonly' },
588
+ ios: { enabled: true, bundleIdentifier: 'com.ankh.nativeonly' },
589
+ },
590
+ },
591
+ };
592
+ const result = generateInfrastructure(createSupabaseManifest(), { appManifest });
593
+ const paths = result.files.map((file) => file.path);
594
+ const kustomization = getFile(result.files, 'infra/minikube/k8s/kustomization.yaml');
595
+ const portForwardScript = getFile(result.files, 'infra/minikube/scripts/port-forward.sh');
596
+ const upScript = getFile(result.files, 'infra/minikube/scripts/up.sh');
597
+ const readme = getFile(result.files, 'infra/minikube/README.md');
598
+
599
+ expect(paths).not.toContain('infra/minikube/k8s/app/deployment.yaml');
600
+ expect(paths).not.toContain('infra/minikube/k8s/app/service.yaml');
601
+ expect(paths).not.toContain('infra/minikube/k8s/app.configmap.yaml');
602
+ expect(kustomization).not.toContain('app/deployment.yaml');
603
+ expect(kustomization).not.toContain('app/service.yaml');
604
+ expect(portForwardScript).toContain('RUNTIME_FORWARD_NAMES=(supabase-gateway)');
605
+ expect(portForwardScript).toContain('ALL_FORWARD_NAMES=(supabase-gateway studio db-migration)');
606
+ expect(portForwardScript).toContain(
607
+ 'MANAGED_FORWARD_NAMES=(app supabase-gateway studio db-migration)',
608
+ );
609
+ expect(portForwardScript).toContain('OBSOLETE_FORWARD_NAMES=(app)');
610
+ expect(portForwardScript).toContain('${name}: skipped (Web app runtime disabled)');
611
+ expect(upScript).toContain('APP_RUNTIME_ENABLED="false"');
612
+ expect(upScript).toContain(
613
+ 'delete deployment/app-runtime service/app-runtime configmap/app-infra-config --ignore-not-found',
614
+ );
615
+ expect(readme).toContain('disabled (no enabled Web deploy target)');
616
+ expect(JSON.stringify(result.files)).not.toContain('adb');
617
+ expect(JSON.stringify(result.files)).not.toContain('10.0.2.2');
618
+ });
619
+
620
+ test('keeps legacy manifests without deploy targets on the Web app runtime topology', () => {
621
+ const result = generateInfrastructure(createSupabaseManifest(), {
622
+ appManifest: createAppManifest('legacy-web'),
623
+ });
624
+ const paths = result.files.map((file) => file.path);
625
+ const portForwardScript = getFile(result.files, 'infra/minikube/scripts/port-forward.sh');
626
+ const upScript = getFile(result.files, 'infra/minikube/scripts/up.sh');
627
+
628
+ expect(paths).toContain('infra/minikube/k8s/app/service.yaml');
629
+ expect(portForwardScript).toContain('RUNTIME_FORWARD_NAMES=(app supabase-gateway)');
630
+ expect(portForwardScript).toContain('OBSOLETE_FORWARD_NAMES=()');
631
+ expect(upScript).not.toContain('delete deployment/app-runtime');
632
+ });
633
+
634
+ test('generates an empty provider-agnostic runtime group when no host target exists', () => {
635
+ const appManifest = {
636
+ ...createAppManifest('native-no-provider'),
637
+ deploy: {
638
+ targets: {
639
+ android: { enabled: true, package: 'com.ankh.nativeproviderless' },
640
+ },
641
+ },
642
+ };
643
+ const result = generateInfrastructure(
644
+ { deployment: { target: 'minikube', monitoring: false }, modules: [] },
645
+ { appManifest },
646
+ );
647
+ const portForwardScript = getFile(result.files, 'infra/minikube/scripts/port-forward.sh');
648
+
649
+ expect(portForwardScript).toContain('RUNTIME_FORWARD_NAMES=()');
650
+ expect(portForwardScript).toContain('ALL_FORWARD_NAMES=()');
651
+ expect(portForwardScript).toContain(
652
+ 'OBSOLETE_FORWARD_NAMES=(app supabase-gateway studio db-migration)',
653
+ );
654
+ });
524
655
  });
525
656
 
526
657
  function createSupabaseManifest(): InfraManifestInput {