@runeditrun/rer 0.2.24 → 0.2.25

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 (48) hide show
  1. package/README.md +16 -7
  2. package/cli/browser-runtime.mjs +65 -0
  3. package/cli/deploy-claim-request.mjs +5 -4
  4. package/cli/deploy-command.mjs +3 -3
  5. package/cli/deploy-inputs.mjs +2 -1
  6. package/cli/deploy.mjs +16 -4
  7. package/cli/export.mjs +1 -1
  8. package/cli/hydration/browser.mjs +3 -9
  9. package/cli/inspect.mjs +3 -1
  10. package/cli/lifecycle.mjs +4 -1
  11. package/global/CHANGELOG.md +21 -0
  12. package/global/README.md +16 -7
  13. package/global/browser-runtime.mjs +45 -0
  14. package/global/cli/layout.mjs +8 -4
  15. package/global/main.mjs +13 -3
  16. package/install.sh +56 -3
  17. package/modules/container/README.md +6 -0
  18. package/modules/container/build.mjs +2 -1
  19. package/modules/container/image-variables.mjs +27 -0
  20. package/modules/delivery-producer/declarations.mjs +6 -1
  21. package/modules/delivery-producer/mail.mjs +66 -0
  22. package/modules/demo/label.mjs +5 -2
  23. package/modules/deploy-kit/README.md +6 -4
  24. package/modules/deploy-kit/asset-health.mjs +28 -0
  25. package/modules/deploy-kit/d1-import.mjs +22 -4
  26. package/modules/deploy-kit/diagnostics.mjs +30 -0
  27. package/modules/deploy-kit/health.mjs +2 -23
  28. package/modules/deploy-kit/migration-ledger.mjs +6 -2
  29. package/modules/deploy-kit/migration-retry.mjs +91 -0
  30. package/modules/deploy-kit/migrations.mjs +9 -5
  31. package/modules/deploy-kit/owner-cli.mjs +6 -3
  32. package/modules/deploy-kit/owner-remove.mjs +87 -65
  33. package/modules/deploy-kit/provider-transport.mjs +28 -5
  34. package/modules/deploy-kit/provider.mjs +9 -6
  35. package/modules/deploy-kit/worker.mjs +5 -2
  36. package/modules/operator-auth/README.md +10 -2
  37. package/modules/operator-auth/config.mjs +1 -0
  38. package/modules/operator-auth/conformance/presentation.mjs +2 -2
  39. package/modules/operator-auth/identity/email-link/confirmation.mjs +2 -1
  40. package/modules/operator-auth/identity/email-link/expiry.mjs +8 -0
  41. package/modules/operator-auth/identity/email-link/index.mjs +2 -1
  42. package/modules/operator-auth/identity/email-link/message.mjs +3 -2
  43. package/modules/operator-auth/index.d.mts +2 -0
  44. package/modules/portability/README.md +7 -2
  45. package/modules/portability/import-staging.mjs +45 -0
  46. package/modules/portability/import.mjs +8 -8
  47. package/modules/portability/storage.mjs +5 -2
  48. package/package.json +1 -1
package/README.md CHANGED
@@ -22,13 +22,19 @@ refuses archives with absolute paths, `..` entries, links or devices, then runs
22
22
  the package's own `rer cli install`. A failed or refused download leaves the
23
23
  version you had selected.
24
24
 
25
+ With no Node 22 or later on PATH, the script installs Node 22.20.0 from
26
+ `nodejs.org` into `~/.local/share/rer/runtimes` (under `XDG_DATA_HOME` when set),
27
+ verifies the tarball against that release's published `SHASUMS256.txt`, and
28
+ prints its location. The launcher uses this private runtime on later runs.
29
+ System Node and other PATH directories are left alone.
30
+
25
31
  No installer edits shell profiles. The canonical launcher is `~/.local/bin/rer`.
26
32
  Installation creates that directory if needed and never writes into another
27
33
  PATH directory. It names any existing `rer` elsewhere on PATH and leaves it
28
34
  unchanged. If `~/.local/bin` is absent from PATH or another command shadows it,
29
35
  it prints one activation line to run in the current shell:
30
- `export PATH="$HOME/.local/bin:$PATH"` (with fish syntax for fish). The launcher runs `node` from
31
- PATH, so a Node upgrade does not break it. A re-run with the same build changes
36
+ `export PATH="$HOME/.local/bin:$PATH"` (with fish syntax for fish). Without a
37
+ private runtime, the launcher uses `node` from PATH. A re-run with the same build changes
32
38
  nothing; a different build is installed beside the current one, the previous one
33
39
  is kept and older ones are removed. It refuses to replace a `~/.local/bin/rer`
34
40
  that it did not write.
@@ -47,11 +53,14 @@ install in place.
47
53
  ### Requirements
48
54
 
49
55
  - macOS or Linux, on x64 or arm64. WSL2 counts as Linux.
50
- - Node 22 or later on PATH; `rer` stops with one line naming the minimum on an
51
- older Node.
52
- - For `install.sh`: `curl` and `tar`.
53
- - For `rer dev` in a checkout: the checkout's own package manager (pnpm for
54
- Run Edit Run seeds).
56
+ - For `install.sh`: `curl`, `tar`, and `shasum` or `sha256sum` when it installs
57
+ Node. macOS includes these tools.
58
+ - For the npm/npx install alternatives: Node 22 or later on PATH.
59
+ - Checkout commands acquire the checkout's pinned Node and pnpm when needed.
60
+ `rer install` also downloads the checkout's Playwright Chromium and headless
61
+ shell for verification; `rer verify` installs missing browser files on first
62
+ need. Downloads print progress. `rer doctor` reports a missing browser and
63
+ directs you to `rer install`, without downloading anything itself.
55
64
 
56
65
  Not supported: native Windows (`install.sh` and `rer` say to use WSL2), and
57
66
  `OPERATIONS.json` version 1 projects.
@@ -0,0 +1,65 @@
1
+ // Browser prerequisites come from the checkout's Playwright, including its
2
+ // platform/revision and PLAYWRIGHT_BROWSERS_PATH handling. Inspection never
3
+ // launches a browser or downloads anything.
4
+ import { access, constants } from 'node:fs/promises';
5
+ import { createRequire } from 'node:module';
6
+ import { dirname, join } from 'node:path';
7
+ import { RerError } from './errors.mjs';
8
+ import { shared } from './shared.mjs';
9
+
10
+ export const browserRepair = 'rer install';
11
+
12
+ export function checkoutPlaywright(root, { required = true } = {}) {
13
+ const require = createRequire(join(root, 'package.json'));
14
+ for (const name of ['playwright-core', '@playwright/test', 'playwright']) {
15
+ let entry;
16
+ try { entry = require.resolve(name); } catch (error) { if (error.code === 'MODULE_NOT_FOUND') continue; throw error; }
17
+ const playwright = require(name);
18
+ if (!playwright.chromium) continue;
19
+ let scope = createRequire(entry);
20
+ if (name === '@playwright/test') scope = createRequire(scope.resolve('playwright'));
21
+ const core = dirname(scope.resolve('playwright-core/package.json'));
22
+ const manifest = scope(join(core, 'package.json'));
23
+ // Playwright's bundled releases export the same registry through coreBundle;
24
+ // older checkout pins keep it in the server module tree.
25
+ const { registry } = manifest.exports?.['./lib/coreBundle']
26
+ ? scope('playwright-core/lib/coreBundle').registry
27
+ : scope(join(core, 'lib/server/registry/index.js'));
28
+ return { name, playwright, registry, cli: join(core, 'cli.js') };
29
+ }
30
+ if (required) throw new RerError('browser_dependency_missing', `The checkout's Playwright is missing. Run ${browserRepair} to install its locked dependencies; verification requires playwright-core, @playwright/test or playwright.`, 3);
31
+ }
32
+
33
+ export async function browserDoctor(root) {
34
+ let resolved;
35
+ try { resolved = checkoutPlaywright(root); }
36
+ catch (error) { return { ok: false, issue: error instanceof RerError ? error.message : `The checkout's Playwright could not be inspected. Run ${browserRepair}.`, fix: browserRepair, executables: [] }; }
37
+ const executables = [];
38
+ for (const name of ['chromium', 'chromium-headless-shell']) {
39
+ // Releases before the separate headless shell use the Chromium executable.
40
+ const executable = resolved.registry.findExecutable(name);
41
+ if (!executable && name === 'chromium-headless-shell') continue;
42
+ const path = executable?.executablePath();
43
+ let ok = false;
44
+ if (path) try { await access(path, process.platform === 'win32' ? constants.F_OK : constants.X_OK); ok = true; } catch {}
45
+ executables.push({ name, ...(path ? { path } : {}), ok });
46
+ }
47
+ const missing = executables.filter(executable => !executable.ok).map(executable => executable.name);
48
+ return { ok: !missing.length, package: resolved.name, executables, ...(missing.length ? { issue: `Playwright browser executables are missing: ${missing.join(', ')}. Run ${browserRepair}.`, fix: browserRepair } : {}) };
49
+ }
50
+
51
+ export async function ensureChromium(root, store, signal, { required = true } = {}) {
52
+ // Installing a first-party adapter without browser dependencies remains valid.
53
+ // Verification requires Playwright; installation provisions it when declared.
54
+ const resolved = checkoutPlaywright(root, { required });
55
+ if (!resolved) return;
56
+ const before = await browserDoctor(root);
57
+ if (before.ok) return;
58
+ const { cli } = resolved;
59
+ const { dependencyEnvironment } = await shared('dependency-environment.mjs');
60
+ const env = dependencyEnvironment();
61
+ if (process.env.PLAYWRIGHT_BROWSERS_PATH !== undefined) env.PLAYWRIGHT_BROWSERS_PATH = process.env.PLAYWRIGHT_BROWSERS_PATH;
62
+ await store.run('Installing Chromium and its headless shell from the checkout’s Playwright', 'pnpm', ['exec', 'node', cli, 'install', 'chromium'], { cwd: root, signal, env });
63
+ const after = await browserDoctor(root);
64
+ if (!after.ok) throw new RerError('browser_install_incomplete', after.issue, 3);
65
+ }
@@ -1,6 +1,7 @@
1
1
  import { observedReadiness } from '../modules/deploy-kit/readiness-window.mjs';
2
2
  // Retry only the bootstrap HTTP exchange, never the hook's other effects. The
3
- // current invocation must prove it uploaded this token to a newly created Worker.
3
+ // current invocation must prove it uploaded this token to a fresh Worker version.
4
+ // The route can still answer 404 after /health first reaches another edge.
4
5
  export async function ownerClaimRequest(fetch, input, init, { deployed, tokenKey = 'SETUP_TOKEN', signal } = {}) {
5
6
  const url = new URL(input instanceof Request ? input.url : input);
6
7
  if (deployed?.origin && url.origin !== deployed.origin) throw new Error('owner-claim-origin-mismatch');
@@ -21,11 +22,11 @@ export async function ownerClaimRequest(fetch, input, init, { deployed, tokenKey
21
22
  const destination = response.headers.get('location');
22
23
  if (destination && new URL(destination, url).origin !== url.origin) throw new Error('owner-claim-origin-mismatch');
23
24
  }
24
- let invalid = false;
25
+ let pending = fresh && !response.redirected && response.status === 404;
25
26
  if (fresh && response.status === 403) {
26
- try { invalid = (await response.clone().json())?.error === 'invalid_setup_token'; } catch {}
27
+ try { pending = (await response.clone().json())?.error === 'invalid_setup_token'; } catch {}
27
28
  }
28
- if (!invalid || window.remaining() <= 0) return response;
29
+ if (!pending || window.remaining() <= 0) return response;
29
30
  await response.body?.cancel();
30
31
  await window.pause();
31
32
  }
@@ -15,7 +15,7 @@ import { rememberHookState, hookState } from './deploy-hook-record.mjs';
15
15
  import { main as owner } from '../modules/deploy-kit/owner-cli.mjs';
16
16
  import { localOnlyBinding, ownerWorkerName } from '../modules/deploy-kit/owner.mjs';
17
17
  import { refuseLocalModels } from '../modules/deploy-kit/local-only.mjs';
18
- import { providerFailure } from '../modules/deploy-kit/diagnostics.mjs';
18
+ import { migrationFailure, providerFailure, assetFailure } from '../modules/deploy-kit/diagnostics.mjs';
19
19
  import { shared } from './shared.mjs';
20
20
 
21
21
  export function validateDeployOptions(options) {
@@ -136,9 +136,9 @@ export async function deployCommand(context) {
136
136
  if (setup) throw commandFailure(redact(setup));
137
137
  const readiness = mutationReadinessFailure(error, { again, redact });
138
138
  if (readiness) throw commandFailure(readiness);
139
- const refused = providerFailure(error,redact);
139
+ const refused = [providerFailure(error,redact), assetFailure(error)].filter(Boolean).join('; '), migration = migrationFailure(error, again);
140
140
  const exchange = error.ownerExchange ?? (error.message === 'owner-claim-failed' ? observedClaims.lastExchange ?? observedClaims.at(-1) : undefined);
141
141
  const ownerCause = ownerExchangeFailure(exchange);
142
- throw commandFailure(redact(`${state} Failed at ${step}: ${error.message}${refused ? ` (${refused})` : ''}${ownerCause ? ` (${ownerCause})` : ''}${error.cause ? ` (${error.cause})` : ''}. Fix the cause and run ${again} again using the same environment credentials. ${outcome && recorded ? `To retire the token without rebuilding: ${again} --unset-secret ${setupManifest?.steps?.find(item => item.type === 'owner-claim')?.tokenField ?? 'SETUP_TOKEN'}.` : ''}`));
142
+ throw commandFailure(redact(`${state} Failed at ${step}: ${error.message}${refused ? ` (${refused})` : ''}${ownerCause ? ` (${ownerCause})` : ''}${error.cause ? ` (${error.cause})` : ''}.${migration ? ` ${migration}` : ''} Fix the cause and run ${again} again using the same environment credentials. ${outcome && recorded ? `To retire the token without rebuilding: ${again} --unset-secret ${setupManifest?.steps?.find(item => item.type === 'owner-claim')?.tokenField ?? 'SETUP_TOKEN'}.` : ''}`));
143
143
  }
144
144
  }
@@ -1,4 +1,5 @@
1
1
  import { randomBytes } from 'node:crypto';
2
+ import { relative } from 'node:path';
2
3
  import { shared } from './shared.mjs';
3
4
  import { invalid } from './errors.mjs';
4
5
  import { readDeployEnvFile } from '../modules/deploy-kit/env-file.mjs';
@@ -54,5 +55,5 @@ export async function withDeployEnvironment(root, options, run) {
54
55
 
55
56
  export function deployAgain(options) {
56
57
  const quote = value => /^[a-zA-Z0-9_./-]+$/.test(value) ? value : `'${String(value).replaceAll("'", "'\"'\"'")}'`;
57
- return `rer deploy --environment ${quote(options.environment ?? 'production')}${options.envFile ? ` --env-file ${quote(options.envFile)}` : ''}${options.cwd ? ` --cwd ${quote(options.cwd)}` : ''}`;
58
+ return `rer deploy --environment ${quote(options.environment ?? 'production')}${options.envFile ? ` --env-file ${quote(options.envFile)}` : ''}${options.cwd ? ` --cwd ${quote(relative(process.cwd(), options.cwd) || '.')}` : ''}`;
58
59
  }
package/cli/deploy.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { requireProductionAuth } from './production-auth.mjs';
2
2
  import { readFile } from 'node:fs/promises';
3
- import { deployDiagnostic, providerFailure } from '../modules/deploy-kit/diagnostics.mjs';
3
+ import { deployDiagnostic, migrationFailure, providerFailure, assetFailure } from '../modules/deploy-kit/diagnostics.mjs';
4
4
  import { shared } from './shared.mjs';
5
5
  import { contained } from './project.mjs';
6
6
  import { missing, invalid, refuse, RerError } from './errors.mjs';
@@ -110,6 +110,15 @@ export function ownerDeploy(declarationPath, lifecycle) {
110
110
 
111
111
  // The failing step, its redacted cause, what this run created and the command that continues.
112
112
  function failureText({ error, step, created, again, retry, secretChange, deployed, redact }) {
113
+ if (step === 'remove') {
114
+ const remaining = error.remaining;
115
+ if (error.message === 'nothing-to-remove') return `There are no recorded resources to remove; nothing was removed.`;
116
+ const cause = deployDiagnostic(error, redact)?.code ?? error.message;
117
+ const count = Array.isArray(remaining) ? `${remaining.length} resources remain (${remaining.join(', ') || 'none'})` : 'the remaining resource count could not be read';
118
+ const detail = providerFailure(error, redact);
119
+ const failed = error.failed?.map(item => `${item.resource}: ${providerFailure(item.error, redact) ?? item.code}`).join('; ');
120
+ return redact(`Removal failed: ${count}; run ${retry} again. Cause: ${cause}${detail ? ` (${detail})` : ''}${failed ? `; ${failed}` : ''}.`);
121
+ }
113
122
  const setup = hostedSetupFailure(error, { origin: deployed?.origin, again });
114
123
  if (setup) return redact(setup);
115
124
  const readiness = mutationReadinessFailure(error, { again, redact });
@@ -119,18 +128,21 @@ function failureText({ error, step, created, again, retry, secretChange, deploye
119
128
  const at = step === 'deploy' ? diagnostic?.step ?? 'prepare deploy' : step;
120
129
  const input = /^missing-secret-([A-Z][A-Z0-9_]*)$/.exec(code)?.[1];
121
130
  if (input) return `Deploy needs ${input}, which the deploy declaration lists as a secret and the Worker does not hold it. Set ${input} in the environment or in an --env-file file (an owned 0600 file of KEY=VALUE lines), then run the same command again. Nothing was uploaded.${created.length ? ` Resources created this attempt: ${created.join(', ')}.` : ''}`;
122
- if (code === 'remove-incomplete') return `Removal stopped with ${error.remaining.join(', ')} still present${error.failed.length ? ` (${error.failed.map(item => `${item.resource}: ${providerFailure(item.error, redact) ?? item.code}`).join('; ')})` : ''}. Removed: ${error.removed.join(', ') || 'nothing'}. Confirmed owned R2 buckets are emptied automatically; unproved buckets are never purged. Run ${again} --remove --yes again to finish.`;
123
131
  if (code === 'nothing-to-remove') return `The deployment record selected by ${again} has no resources that rer owns, so --remove deletes nothing.`;
124
132
  if (code === 'owner-token-retirement-failed') return `The application is deployed at ${deployed?.origin}; owner ${error.owner}; setup token retirement failed (${redact(String(error.cause))}${providerFailure(error,redact) ? `; ${providerFailure(error,redact)}` : ''}). Run ${again} --unset-secret ${error.tokenKey ?? 'SETUP_TOKEN'} using the same environment credentials, or run ${again} again to finish.`;
125
133
  if (code === 'owner-claim-failed') return `The application is deployed at ${deployed?.origin}, but claiming its owner failed: ${redact(String(error.cause))}. Owner claim and setup token retirement are not confirmed; run ${again} again using the same environment credentials to finish.`;
126
134
  const resource = diagnostic?.resource ?? (error.resource ? redact(String(error.resource)) : undefined);
127
135
  if (code === 'resource-not-listed') return `Deploy stopped at ${at}: ${resource} was created, but Cloudflare's account listing still does not show it after two minutes. Nothing was uploaded.\nResources created this attempt: ${created.join(', ') || 'none'}.\nRun ${again} again once the listing catches up: it reuses ${resource}. To delete what this environment created instead: ${again} --remove --yes.`;
128
136
  const lines = [`Deploy failed at ${at}: ${code}${resource ? ` (${resource})` : ''}${diagnostic?.providerCodes?.length ? ` (provider ${diagnostic.providerCodes.join(', ')})` : ''}.`];
137
+ const asset = assetFailure(error, redact);
138
+ if (asset) lines.push(`${asset}.`);
129
139
  const transport = providerFailure(error, redact);
130
140
  if (transport) lines.push(`${transport}.`);
131
141
  if (diagnostic?.output && diagnostic.output !== '(no provider output)') lines.push(`First redacted output lines:\n${diagnostic.output}`);
132
142
  lines.push(`Resources created this attempt: ${created.join(', ') || 'none'}.`);
133
- lines.push(recovery({ code, at, resource, again, retry, secretChange }));
143
+ const migration = migrationFailure(error, again);
144
+ if (migration) lines.push(redact(migration));
145
+ if (code !== 'uncertain-migration-claim') lines.push(recovery({ code, at, resource, again, retry, secretChange }));
134
146
  return lines.join('\n');
135
147
  }
136
148
 
@@ -145,7 +157,7 @@ function recovery({ code, at, resource, again, retry, secretChange }) {
145
157
  }
146
158
  if (code === 'uncertain-resource-not-empty') return `Possibly created: ${resource}, but it holds data, so it may not be the one rer's interrupted run made and rer will not delete it. Inspect it in the Cloudflare dashboard; delete it yourself only if its data is disposable, then run ${retry} again.`;
147
159
  if (code === 'uncertain-resource-unverifiable') return `Possibly created: ${resource}. rer cannot read whether a queue holds messages, so it will not delete it. Inspect it in the Cloudflare dashboard: if it is the empty one from the interrupted run, delete it, then run ${retry} again.`;
148
- if (code === 'changed-or-uncertain-migration-history') return `${resource ?? 'A D1 database'} holds a migration rer started but could not confirm, or one changed since it was applied; rer never retries or guesses a migration. Inspect it in the Cloudflare dashboard: if it is the empty one from this interrupted first deploy, delete it with ${remove} (that deletes everything this environment created), then run ${again} again. If it holds data, resolve the interrupted migration by hand first (deploy-kit README, Migration safety).`;
160
+ if (code === 'changed-or-uncertain-migration-history') return `${resource ?? 'A D1 database'} holds migration history this build does not match: a migration changed or missing since it was applied, or an unconfirmed one that is not this build's next migration; rer never guesses migration history. Inspect it in the Cloudflare dashboard: if it is the empty one from this interrupted first deploy, delete it with ${remove} (that deletes everything this environment created), then run ${again} again. If it holds data, resolve the interrupted migration by hand first (deploy-kit README, Migration safety).`;
149
161
  if (removing) return `Fix the cause, then run ${retry} again.`;
150
162
  if (secretChange) return `Fix the cause, then run ${retry} again; a plain ${again} does not make this change.`;
151
163
  return `Fix the cause, then run ${again} again: it continues with what was created. To delete what this environment created instead: ${remove}.`;
package/cli/export.mjs CHANGED
@@ -6,7 +6,7 @@ import { cliVersion } from './version.mjs';
6
6
 
7
7
  // Copy whole maintained source/tooling directories. Python publication scans
8
8
  // load sibling modules and data dynamically; they belong in the inventory too.
9
- export const sourceRoots = ['bin/rer.mjs', 'cli', 'modules/delivery-producer/declarations.mjs', 'modules/delivery-producer/bindings.mjs', 'modules/delivery-producer/migrations.mjs', 'modules/job-queue', 'modules/release', 'modules/deploy-kit', 'modules/container', 'modules/demo-host', 'modules/demo', 'modules/integrations/core', 'modules/mail', 'modules/ai', 'modules/portability', 'modules/d1-transport', 'modules/erasure', 'modules/dependencies', 'modules/operator-auth', 'modules/owner-claim', 'operations', 'scripts/publish-check', 'scripts/publish-check.mjs', 'composition/git-source.mjs', 'edition-authoring/manifest.mjs', 'edition-authoring/files.mjs'];
9
+ export const sourceRoots = ['bin/rer.mjs', 'cli', 'modules/delivery-producer/declarations.mjs', 'modules/delivery-producer/bindings.mjs', 'modules/delivery-producer/migrations.mjs', 'modules/delivery-producer/mail.mjs', 'modules/job-queue', 'modules/release', 'modules/deploy-kit', 'modules/container', 'modules/demo-host', 'modules/demo', 'modules/integrations/core', 'modules/mail', 'modules/ai', 'modules/portability', 'modules/d1-transport', 'modules/erasure', 'modules/dependencies', 'modules/operator-auth', 'modules/owner-claim', 'operations', 'scripts/publish-check', 'scripts/publish-check.mjs', 'composition/git-source.mjs', 'edition-authoring/manifest.mjs', 'edition-authoring/files.mjs'];
10
10
  export async function inventory(base, roots = sourceRoots) {
11
11
  const files = [];
12
12
  async function walk(path) {
@@ -1,24 +1,18 @@
1
1
  // Chromium from the seed's own Playwright, the two ways of serving pages to it
2
2
  // (the production build as rer deploy hosts it, or a running origin), and one
3
3
  // load: scripts held until the probe releases them, every external request aborted.
4
- import { createRequire } from 'node:module';
5
- import { join } from 'node:path';
4
+ import { checkoutPlaywright, browserRepair } from '../browser-runtime.mjs';
6
5
  import { RerError } from '../errors.mjs';
7
6
  import { serveHosted } from '../hosted-output.mjs';
8
7
  import { probe } from './probe.mjs';
9
8
  import { cloudflareRewrite } from './cases.mjs';
10
9
 
11
- const INSTALL = 'pnpm exec playwright install chromium';
12
-
13
10
  export async function launchChromium(root) {
14
- const require = createRequire(join(root, 'package.json'));
15
- let playwright, name;
16
- for (const candidate of ['playwright-core', '@playwright/test', 'playwright']) { try { playwright = require(candidate); name = candidate; break; } catch {} }
17
- if (!playwright?.chromium) throw new RerError('hydration_browser_missing', `The hydration check runs Chromium through the seed's own Playwright, and none of playwright-core, @playwright/test or playwright resolves from ${join(root, 'package.json')}. Add @playwright/test to devDependencies, install, then run ${INSTALL}.`, 1);
11
+ const { playwright, name } = checkoutPlaywright(root);
18
12
  // Pages fulfilled by the check would otherwise count as public, and Chromium would
19
13
  // refuse a dev server's loopback HMR socket from them.
20
14
  try { return await playwright.chromium.launch({ args: ['--disable-features=LocalNetworkAccessChecks'] }); }
21
- catch (error) { throw new RerError('hydration_browser_missing', `The hydration check could not start Chromium from the seed's ${name}: ${String(error.message).split('\n').find(line => line.trim()) ?? error}. Install the browser it pins with ${INSTALL}.`, 1); }
15
+ catch (error) { throw new RerError('hydration_browser_missing', `The hydration check could not start Chromium from the seed's ${name}: ${String(error.message).split('\n').find(line => line.trim()) ?? error}. Install the browser it pins with ${browserRepair}.`, 1); }
22
16
  }
23
17
 
24
18
  const strip = new Set(['content-encoding', 'content-length', 'transfer-encoding', 'connection']);
package/cli/inspect.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { browserDoctor } from './browser-runtime.mjs';
1
2
  import { dependencyDoctor } from './dependency-doctor.mjs';
2
3
  import { inventory } from './export.mjs';
3
4
  import { lstat, readFile } from 'node:fs/promises';
@@ -185,12 +186,13 @@ export async function doctor(project, store, signal) {
185
186
  if (directory) { usePnpm(directory); try { pnpm = await probePnpm(project.root, store, signal); pnpmIssues.length = 0; } catch (error) { if (signal?.aborted) throw error; pnpmIssues.push(store.redact(error.message)); } }
186
187
  }
187
188
  }
189
+ const browser = project.profile === 'first-party' ? await browserDoctor(project.root) : undefined;
188
190
  const aiIssues = await localAiDiagnostics(project,process.env);
189
191
  const dependencies=project.profile==='first-party'?await dependencyDoctor(project.root):[];
190
192
  const expectedNode = await projectNodePin(project.root);
191
193
  const inputs = project.profile === 'first-party' ? requiredLocalSettings(project, values) : [];
192
194
  const warnings = project.profile === 'first-party' ? await cacheWarnings(project.root) : [];
193
- return { dependencies, warnings, operations: diagnostic, ok: !aiIssues.length && dependencies.every(d=>d.ok) && diagnostic.ok && stateValid && !inputs.length && (project.profile !== 'first-party' || (Boolean(expectedPnpm) && process.versions.node === expectedNode && pnpm === expectedPnpm)),
195
+ return { dependencies, warnings, browser, operations: diagnostic, ok: browser?.ok !== false && !aiIssues.length && dependencies.every(d=>d.ok) && diagnostic.ok && stateValid && !inputs.length && (project.profile !== 'first-party' || (Boolean(expectedPnpm) && process.versions.node === expectedNode && pnpm === expectedPnpm)),
194
196
  node: { actual: process.versions.node, expected: expectedNode },
195
197
  pnpm: project.profile === 'first-party' ? { actual: pnpm, expected: expectedPnpm ?? null, ...(pnpmIssues.length ? { issue: [...new Set(pnpmIssues)].join('\n') } : {}) } : undefined,
196
198
  ai: { issues: aiIssues },
package/cli/lifecycle.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { ensureChromium } from './browser-runtime.mjs';
1
2
  import { dependencyInputs } from './dependency-input.mjs';
2
3
  import { linkDependencies } from './dependencies.mjs';
3
4
  import { savedSetupAnswers } from './setup-answers.mjs';
@@ -86,11 +87,13 @@ async function runLifecycle(project, options, out, deployRedaction) {
86
87
  if (options.verb === 'deploy' && options.demo) return await (await import('./demo-host.mjs')).demoHostCommand(project, options, store, signal, out, operation);
87
88
  if (options.verb === 'install') {
88
89
  const { dependencyEnvironment } = await shared('dependency-environment.mjs');
89
- await store.run('Installing frozen dependencies', 'pnpm', ['install', '--frozen-lockfile'], { cwd: project.root, signal, env: { ...dependencyEnvironment(), CI: 'true' } }); return {};
90
+ await store.run('Installing frozen dependencies', 'pnpm', ['install', '--frozen-lockfile'], { cwd: project.root, signal, env: { ...dependencyEnvironment(), CI: 'true' } });
91
+ await ensureChromium(project.root, store, signal, { required: false }); return {};
90
92
  }
91
93
  if (options.verb === 'verify') {
92
94
  const target = adapter.verify;
93
95
  if (!Array.isArray(target)) throw refuse('A complete internal verification target is missing.');
96
+ await ensureChromium(project.root, store, signal);
94
97
  await store.run('Verifying application', target[0], target[1], { cwd: project.root, signal, env: { ...process.env, RER_LOCAL_OPERATION: operation.token } });
95
98
  await store.step('Serving the production build as rer deploy hosts it');
96
99
  const declaration = adapter.deployDeclaration ?? adapter.deploy?.declaration;
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.25
4
+
5
+ - Invitations stay valid for seven days (`invitationSeconds`), separately from sign-in and step-up links, which keep their short lifetime.
6
+ - Demo and Dev title suffixes are added once, including for missing, empty and suffix-only titles.
7
+ - The shell installer acquires checksum-verified Node 22 in rer's private prefix when needed, leaving system tools alone. The launcher keeps using it without Node on PATH. `rer install` and `rer verify` acquire the checkout's Playwright Chromium and headless shell; `rer doctor` reports missing browser files with `rer install` as the fix, including through the global command for older checkout pins.
8
+ - Portability imports stage their writes in batches within D1's transport budget, with a durable cursor, so populated archives no longer hit `D1_RPC_TRANSPORT_LIMIT`. A same-hash retry resumes an interrupted part, and conflicting content is refused.
9
+ - On a fresh hosted deployment, the owner claim waits through a new route that still answers 404, within the upload propagation window. Asset uploads and checks replay a transient asset failure once; a final asset failure names the asset and its HTTP status.
10
+ - Environment removal retries transient provider 5xx responses within its deadline. A failed removal names the resources still present or not confirmed absent, and gives the same command to finish.
11
+ - Demo image builds accept `MAIL_PROVIDER` and `MAIL_FROM` as public configuration when the managed-mail spec declares them public. Credentials as image variables are still refused.
12
+ - A migration whose D1 import failed is retried by the next deploy of the same bytes, once rer proves none of it applied. Otherwise it stays refused as `uncertain-migration-claim`, and `rer deploy` names the migration, what is present and the exact recovery step.
13
+ - A failed D1 import keeps Cloudflare's codes and messages (credentials and URLs removed, 300 characters each) and names the migration it was running.
14
+ - The deployment spec emits the optional `surfaces.app.signIn` and `nativeExport` declarations from packaging `artifact.specInputs`, using platform's field rules.
15
+ - The owner-claim recovery command prints a relative cwd.
16
+ - The import-kit security test's fixture token now starts with `synthetic-` (`modules/import-kit/tests/readers/security.test.ts`), so credential scans no longer match it.
17
+
18
+ ### Upgrade notes
19
+
20
+ - Update the exact rer package pin, or refresh vendored operating commands, to receive these changes.
21
+ - A deployment stuck at `changed-or-uncertain-migration-history` because its last migration stayed `applying` after a failed import recovers with a plain `rer deploy` of the same build, when that migration's effects are absent.
22
+ - Remove `MAIL_PROVIDER` and `MAIL_FROM` from `deploy.json` secrets and keep them as public spec or Wrangler variables.
23
+
3
24
  ## 0.2.24
4
25
 
5
26
  - Hosted demos stay up through redeploys. The demo's Container application keeps a live demo's instance for an hour (`rollout_active_grace_period`), so a deploy that changes the image, instance type or limit no longer ends idle visitors' demos ("This demo has ended" within two minutes before).
package/global/README.md CHANGED
@@ -22,13 +22,19 @@ refuses archives with absolute paths, `..` entries, links or devices, then runs
22
22
  the package's own `rer cli install`. A failed or refused download leaves the
23
23
  version you had selected.
24
24
 
25
+ With no Node 22 or later on PATH, the script installs Node 22.20.0 from
26
+ `nodejs.org` into `~/.local/share/rer/runtimes` (under `XDG_DATA_HOME` when set),
27
+ verifies the tarball against that release's published `SHASUMS256.txt`, and
28
+ prints its location. The launcher uses this private runtime on later runs.
29
+ System Node and other PATH directories are left alone.
30
+
25
31
  No installer edits shell profiles. The canonical launcher is `~/.local/bin/rer`.
26
32
  Installation creates that directory if needed and never writes into another
27
33
  PATH directory. It names any existing `rer` elsewhere on PATH and leaves it
28
34
  unchanged. If `~/.local/bin` is absent from PATH or another command shadows it,
29
35
  it prints one activation line to run in the current shell:
30
- `export PATH="$HOME/.local/bin:$PATH"` (with fish syntax for fish). The launcher runs `node` from
31
- PATH, so a Node upgrade does not break it. A re-run with the same build changes
36
+ `export PATH="$HOME/.local/bin:$PATH"` (with fish syntax for fish). Without a
37
+ private runtime, the launcher uses `node` from PATH. A re-run with the same build changes
32
38
  nothing; a different build is installed beside the current one, the previous one
33
39
  is kept and older ones are removed. It refuses to replace a `~/.local/bin/rer`
34
40
  that it did not write.
@@ -47,11 +53,14 @@ install in place.
47
53
  ### Requirements
48
54
 
49
55
  - macOS or Linux, on x64 or arm64. WSL2 counts as Linux.
50
- - Node 22 or later on PATH; `rer` stops with one line naming the minimum on an
51
- older Node.
52
- - For `install.sh`: `curl` and `tar`.
53
- - For `rer dev` in a checkout: the checkout's own package manager (pnpm for
54
- Run Edit Run seeds).
56
+ - For `install.sh`: `curl`, `tar`, and `shasum` or `sha256sum` when it installs
57
+ Node. macOS includes these tools.
58
+ - For the npm/npx install alternatives: Node 22 or later on PATH.
59
+ - Checkout commands acquire the checkout's pinned Node and pnpm when needed.
60
+ `rer install` also downloads the checkout's Playwright Chromium and headless
61
+ shell for verification; `rer verify` installs missing browser files on first
62
+ need. Downloads print progress. `rer doctor` reports a missing browser and
63
+ directs you to `rer install`, without downloading anything itself.
55
64
 
56
65
  Not supported: native Windows (`install.sh` and `rer` say to use WSL2), and
57
66
  `OPERATIONS.json` version 1 projects.
@@ -0,0 +1,45 @@
1
+ // An older checkout pin still runs its own verbs. The installed launcher
2
+ // supplies the browser prerequisite those pins did not yet provision.
3
+ import { mkdtemp, rm } from 'node:fs/promises';
4
+ import { tmpdir } from 'node:os';
5
+ import { join } from 'node:path';
6
+ import { browserDoctor, ensureChromium } from '../cli/browser-runtime.mjs';
7
+ import { output } from '../cli/output.mjs';
8
+ import { RerError } from '../cli/errors.mjs';
9
+ import { shared } from '../cli/shared.mjs';
10
+
11
+ export async function browserPreflight(root, argv) {
12
+ const verb = argv[0], out = output({ verb, json: argv.includes('--json') });
13
+ if (verb === 'doctor') {
14
+ const browser = await browserDoctor(root);
15
+ if (browser.ok) return;
16
+ const diagnostics = { browser, ok: false, scope: 'browser-prerequisite' };
17
+ if (!argv.includes('--json')) out.human(JSON.stringify(diagnostics, null, 2));
18
+ out.result(false, 3, { diagnostics });
19
+ return 3;
20
+ }
21
+ const cancellation = new AbortController();
22
+ let directory, store, termination;
23
+ const handlers = new Map(['SIGINT', 'SIGTERM'].map(name => [name, () => { termination ??= name; cancellation.abort(name); }]));
24
+ for (const [name, handler] of handlers) process.on(name, handler);
25
+ try {
26
+ directory = await mkdtemp(join(tmpdir(), 'rer-browser-'));
27
+ const { createCommands } = await shared('commands.mjs');
28
+ store = await createCommands(directory, { logs: [] }, { terminal: text => out.progress(text) });
29
+ store.setCommandSignal(cancellation.signal);
30
+ // A fresh vendored pin installs its own dependencies; verify will acquire
31
+ // their browser on first need. Package pins have already been bootstrapped.
32
+ await ensureChromium(root, store, cancellation.signal, { required: verb === 'verify' });
33
+ } catch (error) {
34
+ const failure = error instanceof RerError ? error : new RerError('browser_install_failed', `The checkout's Chromium installation failed. Run rer install to retry; inspect the browser download progress for the cause.`, 1);
35
+ if (termination) { failure.exitCode = termination === 'SIGINT' ? 130 : 143; failure.message = `Stopped by ${termination} after owned children were stopped.`; }
36
+ out.error(failure); out.result(false, failure.exitCode);
37
+ return failure.exitCode;
38
+ } finally {
39
+ try { await store?.closeCommands(); }
40
+ finally {
41
+ if (directory) await rm(directory, { recursive: true, force: true });
42
+ for (const [name, handler] of handlers) process.removeListener(name, handler);
43
+ }
44
+ }
45
+ }
@@ -1,6 +1,6 @@
1
1
  // Where a user install lives. Data: ${XDG_DATA_HOME:-$HOME/.local/share}/rer,
2
2
  // as immutable versions/<version>-<digest8> directories and a `current` link.
3
- // Launcher: $HOME/.local/bin/rer, a POSIX sh script that runs node from PATH.
3
+ // Launcher: $HOME/.local/bin/rer, using the installer's private Node when present.
4
4
  import { readFile, lstat } from 'node:fs/promises';
5
5
  import { homedir } from 'node:os';
6
6
  import { join } from 'node:path';
@@ -15,14 +15,18 @@ export function layout(env = process.env) {
15
15
  const marker = '# rer launcher, written by `rer cli install` (@runeditrun/rer). Do not edit.';
16
16
  const quote = value => `'${value.replaceAll("'", `'\\''`)}'`;
17
17
 
18
- // No absolute Node path is baked in, so a Node upgrade never breaks it.
18
+ // The managed runtime stays inside the install root; npx installs use PATH.
19
19
  export function launcherScript(data) {
20
20
  return `#!/bin/sh
21
21
  ${marker}
22
- # It runs the installed version with the node on PATH.
22
+ # It uses the installer's private Node when present, otherwise Node on PATH.
23
23
  root=${quote(data)}
24
+ if [ -x "$root/node/bin/node" ]; then
25
+ PATH="$root/node/bin:$PATH"
26
+ export PATH
27
+ fi
24
28
  if ! command -v node >/dev/null 2>&1; then
25
- echo "rer: node is not on PATH. Install Node 22 or later, then run rer again." >&2
29
+ echo "rer: Node is missing. Run: curl -fsSL https://runeditrun.com/install.sh | sh" >&2
26
30
  exit 127
27
31
  fi
28
32
  exec node "$root/current/global/rer.mjs" "$@"
package/global/main.mjs CHANGED
@@ -36,7 +36,7 @@ import, doctor, describe, check, release. Run rer VERB --help in a checkout for
36
36
 
37
37
  // The checkout verbs that install the pinned package before they run when
38
38
  // node_modules holds another version or none (dev installs it in its launch).
39
- const installsFirst = new Set([...Object.keys(verbs), 'signin', 'release'].filter(verb => verb !== 'dev'));
39
+ const installsFirst = new Set([...Object.keys(verbs), 'signin', 'release'].filter(verb => !['dev', 'doctor'].includes(verb)));
40
40
 
41
41
  export async function main(argv) {
42
42
  handleBrokenPipes();
@@ -51,7 +51,7 @@ export async function main(argv) {
51
51
  delete process.env[localDefaults];
52
52
  if (verb === 'update') return (await import('./update/command.mjs')).update(argv.slice(1));
53
53
  const notice = await import('./update/notice.mjs');
54
- if (notice.wantsNotice(argv)) await notice.updateNotice();
54
+ if (verb !== 'doctor' && notice.wantsNotice(argv)) await notice.updateNotice();
55
55
  if (!verb || verb === '--help' || verb === '-h' || verb === 'help') { process.stdout.write(help); return 0; }
56
56
  if (verb === 'cli') return (await import('./cli/command.mjs')).cliCommand(argv.slice(1));
57
57
  if (verb === 'list') return (await import('./list.mjs')).listCommand(argv.slice(1));
@@ -65,6 +65,13 @@ export async function main(argv) {
65
65
  const { jobsDirectory } = await import('../modules/job-queue/config.mjs');
66
66
  process.env.RER_SERVERS_DIR = serversDirectory(process.env);
67
67
  process.env.RER_JOBS_DIR = jobsDirectory(process.env);
68
+ if ((mode !== 'bundled' || pinnedPackage(target.root)) && verb === 'doctor' && !argv.includes('--help')) {
69
+ const { parse } = await import('../cli/parse.mjs');
70
+ try { parse(target.args, target.root); }
71
+ catch (error) { process.stderr.write(error.message + '\n'); return error.exitCode ?? 2; }
72
+ const code = await (await import('./browser-runtime.mjs')).browserPreflight(target.root, target.args);
73
+ if (code !== undefined) return code;
74
+ }
68
75
  const bootstrap = pinnedPackage(target.root)?.ready === false && installsFirst.has(verb);
69
76
  if ((bootstrap || ['install', 'setup', 'dev', 'preview', 'build', 'verify'].includes(verb)) && !argv.includes('--help') && !argv.includes('--stop')) {
70
77
  const { parse } = await import('../cli/parse.mjs');
@@ -98,9 +105,12 @@ export async function main(argv) {
98
105
  const { installPinned } = await import('./launch/install-pinned.mjs'), { LaunchFailure } = await import('./launch/failure.mjs');
99
106
  try { await installPinned(target.root); }
100
107
  catch (failure) { if (!(failure instanceof LaunchFailure)) throw failure; process.stderr.write(failure.message + '\n'); return failure.exitCode; }
101
- return delegate(target, target.args);
102
108
  }
103
109
  if (mode === 'package' && installsFirst.has(verb)) await (await import('./launch/install-pinned.mjs')).settledPin(target.root);
110
+ if (first && dispatcher(target.root).mode !== 'bundled' && ['install', 'verify'].includes(verb) && !argv.includes('--help') && !argv.includes('--site')) {
111
+ const code = await (await import('./browser-runtime.mjs')).browserPreflight(target.root, target.args);
112
+ if (code !== undefined) return code;
113
+ }
104
114
  if (verb === 'dev' && mode && mode !== 'package' && !argv.includes('--help')) return (await import('./launch/dev.mjs')).launchDev(target);
105
115
  // Every other server start or queued job on a vendored pin gets the person
106
116
  // defaults too (a pinned package applies its own).
package/install.sh CHANGED
@@ -12,8 +12,8 @@
12
12
  # `npx -y @runeditrun/rer cli install`. A failure leaves any previous install
13
13
  # selected and working. It never edits shell profiles.
14
14
  #
15
- # Needs curl, tar and Node (the package's minimum). macOS or Linux on x64 or
16
- # arm64; on Windows, run it inside WSL2.
15
+ # Needs curl and tar. If Node 22 or later is absent, installs the pinned official
16
+ # Node release in rer's own data directory. macOS/Linux x64/arm64; Windows: WSL2.
17
17
 
18
18
  # Everything runs from main, so a partly downloaded script does nothing.
19
19
  main() {
@@ -29,7 +29,7 @@ main() {
29
29
  x86_64 | amd64 | arm64 | aarch64) ;;
30
30
  *) fail "this processor ($(uname -m)) is not supported; rer runs on x64 and arm64." ;;
31
31
  esac
32
- for tool in curl tar node; do
32
+ for tool in curl tar; do
33
33
  command -v "$tool" >/dev/null 2>&1 || fail "$tool is required. Install it, then run this again."
34
34
  done
35
35
 
@@ -39,6 +39,11 @@ main() {
39
39
  trap 'rm -rf "$work"' EXIT
40
40
  trap 'exit 130' INT TERM
41
41
 
42
+ # Bootstrap before reading npm metadata; no npm global install or PATH links.
43
+ if ! command -v node >/dev/null 2>&1 || ! node -e 'process.exit(Number(process.versions.node.split(".")[0]) >= 22 ? 0 : 1)' >/dev/null 2>&1; then
44
+ install_node
45
+ fi
46
+
42
47
  curl -fsSL --proto '=http,https' -H 'Accept: application/json' "$registry/@runeditrun%2frer" -o "$work/metadata.json" \
43
48
  || fail "could not read $package from $registry."
44
49
  # Writes version, tarball URL, integrity, file count and unpacked size, one per line.
@@ -136,6 +141,54 @@ NODE
136
141
  || fail "rer cli install failed; any previous install is still selected."
137
142
  }
138
143
 
144
+ install_node() {
145
+ node_version=22.20.0
146
+ case "$(uname -s)" in Darwin) node_os=darwin ;; Linux) node_os=linux ;; esac
147
+ case "$(uname -m)" in x86_64 | amd64) node_arch=x64 ;; arm64 | aarch64) node_arch=arm64 ;; esac
148
+ node_name="node-v$node_version-$node_os-$node_arch"
149
+ data="${XDG_DATA_HOME:-$HOME/.local/share}/rer"
150
+ node_home="$data/runtimes/$node_name"
151
+ if [ ! -x "$node_home/bin/node" ] || [ "$("$node_home/bin/node" --version 2>/dev/null)" != "v$node_version" ]; then
152
+ printf 'Installing Node %s in %s from the checksum-verified nodejs.org release.\n' "$node_version" "$node_home"
153
+ archive="$node_name.tar.gz"
154
+ release="https://nodejs.org/dist/v$node_version"
155
+ curl -fsSL --proto '=https' "$release/SHASUMS256.txt" -o "$work/SHASUMS256.txt" \
156
+ || fail "could not download Node $node_version checksums from nodejs.org."
157
+ curl -fL --proto '=https' "$release/$archive" -o "$work/$archive" \
158
+ || fail "could not download Node $node_version from nodejs.org."
159
+ expected=$(awk -v file="$archive" '$2 == file { print $1 }' "$work/SHASUMS256.txt")
160
+ [ "${#expected}" -eq 64 ] || fail "nodejs.org gives no unique SHA-256 for $archive."
161
+ case "$expected" in *[!0-9a-f]*) fail "nodejs.org gives an invalid SHA-256 for $archive." ;; esac
162
+ if command -v shasum >/dev/null 2>&1; then
163
+ actual=$(shasum -a 256 "$work/$archive")
164
+ elif command -v sha256sum >/dev/null 2>&1; then
165
+ actual=$(sha256sum "$work/$archive")
166
+ else
167
+ fail 'SHA-256 verification needs shasum or sha256sum. Install one, then run this again.'
168
+ fi
169
+ [ "${actual%% *}" = "$expected" ] || fail "Node $node_version does not match nodejs.org's SHA-256; nothing was installed."
170
+ mkdir "$work/node"
171
+ tar -xzf "$work/$archive" -C "$work/node" || fail "could not unpack Node $node_version."
172
+ [ "$("$work/node/$node_name/bin/node" --version)" = "v$node_version" ] || fail "Node $node_version cannot run on this system."
173
+ mkdir -p "$data/runtimes"
174
+ # Move only into our prefix, and never overlay an existing runtime.
175
+ [ ! -e "$node_home" ] || fail "the private Node runtime at $node_home is damaged; remove that directory and run this again."
176
+ mv "$work/node/$node_name" "$node_home"
177
+ fi
178
+ # A private link lets future launchers and updates find the managed runtime.
179
+ # Node's rename replaces an existing symlink atomically on macOS and Linux.
180
+ "$node_home/bin/node" - "$data" "$node_name" <<'NODE' || exit 1
181
+ var fs = require('fs'), path = require('path');
182
+ var root = process.argv[2], temporary = path.join(root, '.node-' + process.pid);
183
+ try {
184
+ fs.symlinkSync(path.join('runtimes', process.argv[3]), temporary);
185
+ fs.renameSync(temporary, path.join(root, 'node'));
186
+ } finally { try { fs.unlinkSync(temporary); } catch (error) { if (error.code !== 'ENOENT') throw error; } }
187
+ NODE
188
+ PATH="$node_home/bin:$PATH"
189
+ export PATH
190
+ }
191
+
139
192
  fail() {
140
193
  printf 'rer install: %s\n' "$*" >&2
141
194
  exit 1
@@ -68,6 +68,12 @@ SQLite stays on the Docker host's local filesystem; host-shared checkout mounts
68
68
  are not used for database storage. Back up with export before deleting a volume. Build
69
69
  uses the ordinary private-file custody and command admission boundary. Secrets
70
70
  are provided at runtime, never baked into the image or transferred in archives.
71
+ Managed mail's `MAIL_PROVIDER` and `MAIL_FROM` are public configuration. Keep
72
+ them in the mail spec's public variables and Wrangler `vars`, and remove them
73
+ from `deploy.json` secrets. For migration, the image builder accepts those two
74
+ legacy secret declarations when the managed-mail spec declares them public,
75
+ and prints that correction. Demo runtime settings override their image defaults.
76
+ API keys, tokens and other secrets in image variables remain refused.
71
77
 
72
78
  `rer deploy --platform container --host ssh://user@host --env-file FILE` uses
73
79
  strict SSH host-key checking and a Linux host with Python 3 and Docker. FILE must