@wtfalch/foundry 0.51.1 → 0.51.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/plan/diff.js CHANGED
@@ -600,8 +600,6 @@ export function computePlanDetail(org, live, recordedIds = {}, agoraHost = NO_AG
600
600
  (s.action.desired.homes ?? []).includes(DESKTOP_AUTH_HOME)),
601
601
  });
602
602
  claimed.add(resourceKey('coolify', 'desktop-auth', org.id));
603
- if (desktopAuth.step)
604
- plannedSteps.push(desktopAuth.step);
605
603
  // An own org's scheduler, before its registration below.
606
604
  const ownJobs = planOwnJobs({
607
605
  org,
@@ -714,6 +712,9 @@ export function computePlanDetail(org, live, recordedIds = {}, agoraHost = NO_AG
714
712
  plannedSteps.push(desktopCallbacks);
715
713
  // #444, last: a Postgres step that fails must not stop the zone, mail, app, Agora and Boule steps of a live company.
716
714
  plannedSteps.push(...orgPostgresSteps);
715
+ // After the org-postgres steps: the desktop sign-in service lives on a home they may create in this same plan.
716
+ if (desktopAuth.step)
717
+ plannedSteps.push(desktopAuth.step);
717
718
  plannedSteps.push(...orgPostgresMigration.steps);
718
719
  // #10 (resolved): "foundry manages only what the declared org names";
719
720
  // anything left unclaimed is listed, never proposed for deletion.
@@ -112,9 +112,25 @@ export async function githubReleaseHookPlanInputs(deps, hostname, recorded) {
112
112
  console.error(`github release hook: could not read Archon's env from Coolify (${error instanceof Error ? error.name : 'error'})`);
113
113
  return { blocked: GITHUB_RELEASE_HOOK_COOLIFY_READ_FAILED };
114
114
  }
115
- return secret
116
- ? { ready: true, hash: githubReleaseHookHash(githubReleaseHookUrl(hostname), secret) }
117
- : { ready: true };
115
+ if (!secret)
116
+ return { ready: true };
117
+ // A recorded hook someone deleted on GitHub: no hash, so the step plans again and makes it.
118
+ const recordedId = recorded[PLATFORM_GITHUB_RELEASE_HOOK_ID_SCOPE_KEY];
119
+ if (recordedId && !(await recordedHookLive(token, deps.fetchImpl, recordedId))) {
120
+ return { ready: true };
121
+ }
122
+ return { ready: true, hash: githubReleaseHookHash(githubReleaseHookUrl(hostname), secret) };
123
+ }
124
+ /** Whether GitHub still has the recorded hook. A failed read counts as gone: the step adopts by url, so running it again is safe. */
125
+ async function recordedHookLive(token, fetchImpl, id) {
126
+ try {
127
+ const client = createGithubHooksClient({ token, ...(fetchImpl ? { fetchImpl } : {}) });
128
+ return (await client.list(GITHUB_RELEASE_HOOK_ORG)).some((h) => String(h.id) === id);
129
+ }
130
+ catch (error) {
131
+ console.error(`github release hook: could not list the organisation's hooks (${error instanceof Error ? error.name : 'error'})`);
132
+ return false;
133
+ }
118
134
  }
119
135
  /**
120
136
  * Makes the organisation's release webhook. Adopts the hook whose url is Archon's, else creates one;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/foundry",
3
- "version": "0.51.1",
3
+ "version": "0.51.3",
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",