@wtfalch/foundry 0.26.0 → 0.26.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.
@@ -117,6 +117,15 @@ export declare function toPlan(detail: PlanDetail): Plan;
117
117
  * against this seam.
118
118
  */
119
119
  export declare function computePlanDetail(org: DeclaredOrg, live: LiveResource[], recordedIds?: Readonly<Record<string, string>>, agoraHost?: AgoraHostReading, jobsAvailable?: boolean, platformReadiness?: OrgPlatformReadiness, options?: PlanOrgOptions): PlanDetail;
120
+ /**
121
+ * #488: the bare hostname out of an issuer URL (`https://<hostname>`, the
122
+ * only shape {@link agoraHostValuesFromPlatform} or a host-supplied
123
+ * `AgoraHostPort` ever hands back), or `null` when there is no issuer to
124
+ * read one from. What {@link loginHostnameFor} compares the org's own
125
+ * computed `auth.<domain>` against, so the platform's own org never plans
126
+ * its login host equal to the shared ZITADEL instance's own.
127
+ */
128
+ export declare function isPlatformOwnOrg(org: DeclaredOrg, platformApex: string | null): boolean;
120
129
  /** Restated from `executor.ts`, the same rule: the id of an ai key minted but not delivered. */
121
130
  export declare const AI_KEY_UNDELIVERED_SCOPE_KEY = "ai_key_undelivered";
122
131
  /** Restated from `executor.ts`, the same rule: the id of a jobs project registered but not delivered. */
package/dist/plan/diff.js CHANGED
@@ -734,7 +734,7 @@ function planOwners(org, recordedIds, authReady, authIssuer) {
734
734
  * computed `auth.<domain>` against, so the platform's own org never plans
735
735
  * its login host equal to the shared ZITADEL instance's own.
736
736
  */
737
- function isPlatformOwnOrg(org, platformApex) {
737
+ export function isPlatformOwnOrg(org, platformApex) {
738
738
  return Boolean(org.domain && platformApex && org.domain.toLowerCase() === platformApex.toLowerCase());
739
739
  }
740
740
  function platformAuthHostnameFrom(issuer) {
@@ -71,7 +71,9 @@ export interface HealthTarget {
71
71
  * the broker whenever the org has them; then whichever of hosting or site
72
72
  * the org runs, if either.
73
73
  */
74
- export declare function healthTargets(org: DeclaredOrg): HealthTarget[];
74
+ export declare function healthTargets(org: DeclaredOrg, options?: {
75
+ platform?: DeclaredPlatform | null;
76
+ }): HealthTarget[];
75
77
  /**
76
78
  * The seven platform services #541 names (`platform:auth`, `platform:archon`,
77
79
  * `platform:mail`, `platform:ai`, `platform:files`, `platform:integrations`,
@@ -1,6 +1,7 @@
1
1
  import { appEntry } from '../org.js';
2
2
  import { agoraHostnameFor } from './agora.js';
3
3
  import { bouleHostnameFor } from './boule.js';
4
+ import { isPlatformOwnOrg } from './diff.js';
4
5
  import { callsHostnameFor, cmsHostnameFor } from './executor.js';
5
6
  import { isBehindGate } from './gates.js';
6
7
  import { entryHostnames } from './hostnames.js';
@@ -12,8 +13,6 @@ const DEFAULT_API_HEALTH_PATH = '/api/health';
12
13
  const STATIC_PAGE_PATH = '/';
13
14
  /** zitadel-login's own readiness route (#541's "Real paths today"). `depth: 'shallow'`, not `'deep'`: login holds no database of its own (`login-host.ts`), whatever its name suggests. */
14
15
  const LOGIN_READY_PATH = '/ready';
15
- /** The broker answers on `platform.auth.hostname` under `AUTH_BROKER_PATH_PATTERN` (`platform-providers.ts`, `'^/api(/|$)'`), so its own health path carries that prefix. */
16
- const BROKER_HEALTH_PATH = '/api/healthy';
17
16
  /** `platform-providers.ts`'s own `waitForInstance` call target (`` `https://${hostname}/debug/healthz}` ``), also the one path `AUTH_ZITADEL_PATH_PATTERN` names by name. */
18
17
  const ZITADEL_HEALTH_PATH = '/debug/healthz';
19
18
  /**
@@ -26,7 +25,12 @@ const STALWART_READY_PATH = '/healthz/ready';
26
25
  const CHAT_SERVICE_HEALTH_PATH = '/_chat/health';
27
26
  const CALLS_HEALTH_PATH = '/healthz';
28
27
  /** Boule, Agora and the company's own login host: every org gets these, with no flag to check (the "Why" this issue opens with). */
29
- function alwaysOnTargets(org) {
28
+ function alwaysOnTargets(org, platform) {
29
+ // The platform's own org signs in on the shared instance host, not its own
30
+ // `loginHostnameFor` (#488; `login-host.ts`, `diff.ts`'s `planLoginHost`).
31
+ const loginHost = platform && isPlatformOwnOrg(org, platform.apex)
32
+ ? platform.auth.hostname
33
+ : loginHostnameFor(org);
30
34
  return [
31
35
  {
32
36
  service: 'boule',
@@ -49,7 +53,7 @@ function alwaysOnTargets(org) {
49
53
  },
50
54
  {
51
55
  service: 'login',
52
- url: `https://${loginHostnameFor(org)}${LOGIN_READY_PATH}`,
56
+ url: `https://${loginHost}${LOGIN_READY_PATH}`,
53
57
  expect: okExpect(),
54
58
  depth: 'shallow',
55
59
  restartSafe: false,
@@ -224,8 +228,8 @@ function appTargets(org) {
224
228
  * the broker whenever the org has them; then whichever of hosting or site
225
229
  * the org runs, if either.
226
230
  */
227
- export function healthTargets(org) {
228
- const targets = alwaysOnTargets(org);
231
+ export function healthTargets(org, options = {}) {
232
+ const targets = alwaysOnTargets(org, options.platform ?? null);
229
233
  const broker = brokerTarget(org);
230
234
  if (broker)
231
235
  targets.push(broker);
@@ -265,12 +269,18 @@ function authTargets(platform) {
265
269
  behindAccess: false,
266
270
  },
267
271
  {
272
+ // The broker's only unauthenticated route is `/healthy` at its own root
273
+ // (auth's `broker/src/server.ts`), but the tunnel hands it only
274
+ // `AUTH_BROKER_PATH_PATTERN` ('^/api(/|$)') unchanged: `/api/healthy`
275
+ // reaches the broker and answers 401, and bare `/healthy` reaches
276
+ // zitadel-login instead, which would read as the broker being up.
268
277
  service: 'auth-broker',
269
- url: `https://${hostname}${BROKER_HEALTH_PATH}`,
278
+ url: null,
270
279
  expect: okExpect(),
271
280
  depth: 'shallow',
272
281
  restartSafe: false,
273
282
  behindAccess: false,
283
+ reason: "the broker's health route (/healthy) is not reachable from outside: the tunnel sends it only /api/*, which answers 401 without a session, and /healthy on this host is zitadel-login's",
274
284
  },
275
285
  ];
276
286
  }
@@ -302,11 +312,15 @@ export function platformHealthTargets(platform) {
302
312
  ...authTargets(platform),
303
313
  {
304
314
  service: 'archon',
315
+ // `provisionPlatformArchon` always puts a Cloudflare Access app in front
316
+ // of this hostname (it throws with no Access emails), so a prober with no
317
+ // service token reads a redirect: it proves Access and the tunnel are up,
318
+ // not that Archon answers.
305
319
  url: `https://${platform.archon.hostname}${DEFAULT_API_HEALTH_PATH}`,
306
320
  expect: okExpect(),
307
- depth: 'deep',
321
+ depth: 'shallow',
308
322
  restartSafe: false,
309
- behindAccess: false,
323
+ behindAccess: true,
310
324
  },
311
325
  {
312
326
  service: 'mail',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/foundry",
3
- "version": "0.26.0",
3
+ "version": "0.26.1",
4
4
  "description": "Foundry's SDK: the declared org's types, the plan and apply contracts, and the state store's interface.",
5
5
  "repository": {
6
6
  "type": "git",