@wtfalch/foundry 0.8.0 → 0.9.0

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.
@@ -1198,7 +1198,7 @@ export declare class FoundryStepExecutor implements StepExecutor, StepDestroyer
1198
1198
  } | undefined>;
1199
1199
  /**
1200
1200
  * `plan/diff.ts`'s `planAccess` (#84): puts the org's app hostname behind a
1201
- * Cloudflare Access app that lets only `hosting.accessEmails` through.
1201
+ * Cloudflare Access app that lets only the `app` entry's `accessEmails` through.
1202
1202
  * foundry names its Access app `foundry:<orgId>` and reuses only an app with
1203
1203
  * that name, so a re-run after a crash does not duplicate it. It refuses,
1204
1204
  * rather than adopt, when another Access app already holds the hostname:
@@ -1384,7 +1384,7 @@ export declare class FoundryStepExecutor implements StepExecutor, StepDestroyer
1384
1384
  * P2, `.plans/2026-09-26-level-1-org-map.md`) -- a second `bulkUpsertEnvs`
1385
1385
  * call rather than folding into `pushDatabaseUrl`'s, since this one runs
1386
1386
  * unconditionally (`coolifyApp`) where that one runs only once
1387
- * `hosting.database` is declared and provisioned.
1387
+ * the `app` entry's `database` is declared and provisioned.
1388
1388
  *
1389
1389
  * `APP_URL` and `LOG_DIR` (#75) are pushed unconditionally; every other
1390
1390
  * value is pushed only once its own source step has actually recorded it
@@ -1397,7 +1397,7 @@ export declare class FoundryStepExecutor implements StepExecutor, StepDestroyer
1397
1397
  * is its own design question, left out of #204's own "How" rather than
1398
1398
  * guessed) is out of scope here (task brief). `DATABASE_URL_OWNER`/
1399
1399
  * `DATABASE_URL` are pushed by `pushDatabaseUrl` instead, not here --
1400
- * that call runs only once `hosting.database` is declared and
1400
+ * that call runs only once the `app` entry's `database` is declared and
1401
1401
  * provisioned, where this one is unconditional (#239).
1402
1402
  */
1403
1403
  private pushAppEnv;
@@ -1793,15 +1793,27 @@ export declare class FoundryStepExecutor implements StepExecutor, StepDestroyer
1793
1793
  * existed falls back to the old zone-wide pass, the one case where no
1794
1794
  * hostname list was ever written to look up instead.
1795
1795
  *
1796
- * `previousTunnelId` (round 4 finding 1): the old domain's CNAMEs were
1797
- * published under whatever tunnel id was live the *last* time this step
1798
- * recorded that domain, which is `previousTunnelId`, not necessarily
1799
- * `tunnelId` -- a tunnel recreated under the same name
1800
- * (`findTunnelByName` returning a new id) in the same apply that also
1801
- * changes the domain leaves the old domain's records pointed at the old
1802
- * id. Matching only `tunnelId`'s target left them live forever. Both
1803
- * targets are checked so this stays a no-op once a retry has already
1804
- * moved the old domain onto the new id.
1796
+ * `previousIds` (round 4 finding 1, round 6 finding 2): the old domain's
1797
+ * CNAMEs were published under whatever tunnel id was live the *last*
1798
+ * time this step recorded that domain, which may be any id this step has
1799
+ * ever replaced, not necessarily `tunnelId` -- a tunnel recreated under
1800
+ * the same name (`findTunnelByName` returning a new id), possibly more
1801
+ * than once with no successful publish in between, in the same apply
1802
+ * that also changes the domain leaves the old domain's records pointed
1803
+ * at an old id. Matching only `tunnelId`'s target left them live
1804
+ * forever; matching only the single most recent previous id (round 4)
1805
+ * still missed an older one two unresolved recreates back. Every target
1806
+ * is checked so this stays a no-op once a retry has already moved the
1807
+ * old domain onto the current id.
1808
+ *
1809
+ * Round 6 finding 1: once `previousHostnames` is non-empty, every name in
1810
+ * it has now been looked up -- deleted (its CNAME matched one of
1811
+ * `dnsTargets`), left alone (found but foreign), or never found at all
1812
+ * (already gone) -- so none of them needs tracking under `previousDomain`
1813
+ * in {@link CLOUDFLARE_TUNNEL_DNS_TRACKED_SCOPE_KEY} any longer; dropped
1814
+ * from that set accordingly. The zone-wide fallback path (no recorded
1815
+ * hostnames) never added entries of its own to begin with, so there is
1816
+ * nothing of this domain's left in that set either way.
1805
1817
  */
1806
1818
  private deleteStaleTunnelDnsRecords;
1807
1819
  /**
@@ -1828,13 +1840,15 @@ export declare class FoundryStepExecutor implements StepExecutor, StepDestroyer
1828
1840
  * (round 4 finding 3), so a crash mid-write is recovered by re-running
1829
1841
  * this same idempotent step, never silently skipped.
1830
1842
  *
1831
- * Round 3: `previousTunnelId` is the tunnel id this same step recorded
1832
- * last time it ran (`cloudflareTunnel`'s own `cloudflare:tunnel:<key>`
1833
- * resource id, read before `tunnel` above is computed for this run) -- a
1834
- * tunnel Cloudflare shows as recreated under the same name
1835
- * (`findTunnelByName` returning a new id for `<slug>-tunnel`) leaves every
1836
- * CNAME still pointed at the *old* id. That is this org's own stale
1837
- * record, not a foreign one, so it is repointed rather than refused.
1843
+ * Round 3, round 6 finding 2: `previousIds` is every tunnel id this same
1844
+ * step has ever replaced (`cloudflareTunnel`'s own accumulated set,
1845
+ * captured before `tunnel` above is computed for this run) -- a tunnel
1846
+ * Cloudflare shows as recreated under the same name (`findTunnelByName`
1847
+ * returning a new id for `<slug>-tunnel`), possibly more than once with
1848
+ * no successful publish in between, leaves every CNAME still pointed at
1849
+ * one of those old ids. That is this org's own stale record, not a
1850
+ * foreign one, so it is repointed rather than refused, whichever of
1851
+ * `previousIds` it still names.
1838
1852
  *
1839
1853
  * Round 4 finding 2: `previousHostnames` is this domain's own previously
1840
1854
  * recorded hostname list (empty when the domain just changed --
@@ -1844,17 +1858,19 @@ export declare class FoundryStepExecutor implements StepExecutor, StepDestroyer
1844
1858
  * `hostnames` below but was never cleaned up before this round: its CNAME
1845
1859
  * stayed live and its name stayed in the recorded list forever, because
1846
1860
  * only a domain *change* ever ran cleanup. Each dropped name's CNAME is
1847
- * deleted here when it still points at this tunnel or its immediately
1848
- * prior id; a name already gone, or now pointed at something foreign, is
1849
- * simply left out of the returned list -- nothing here is this method's to
1850
- * reclaim or report as a conflict.
1861
+ * deleted here when it still points at this tunnel or any of
1862
+ * `previousIds`; a name already gone, or now pointed at something
1863
+ * foreign, is simply left out of the returned list -- nothing here is
1864
+ * this method's to reclaim or report as a conflict.
1851
1865
  *
1852
- * Round 5 finding 1: `context` is used only to record
1853
- * {@link CLOUDFLARE_TUNNEL_DNS_PENDING_DOMAIN_SCOPE_KEY}/
1854
- * {@link CLOUDFLARE_TUNNEL_DNS_PENDING_HOSTNAMES_SCOPE_KEY} after each
1855
- * individual CNAME write below succeeds, so a crash or a thrown conflict
1856
- * partway through never leaves an already-created CNAME out of every
1857
- * recorded list -- `destroy` checks this pending pair too.
1866
+ * Round 5 finding 1, round 6 finding 1: `context` is used to add every
1867
+ * hostname this call confirms correct (settled, created or repointed) to
1868
+ * {@link CLOUDFLARE_TUNNEL_DNS_TRACKED_SCOPE_KEY} as soon as it is
1869
+ * confirmed, and to drop a dropped hostname from it once that hostname's
1870
+ * own CNAME is resolved one way or another -- additively, alongside
1871
+ * whatever other domains that shared set already names, never
1872
+ * overwriting them. `destroy` and {@link deleteStaleTunnelDnsRecords}
1873
+ * both read this set.
1858
1874
  */
1859
1875
  private publishTunnelDnsRecords;
1860
1876
  /**