@runeditrun/rer 0.2.106 → 0.2.108
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/README.md +8 -5
- package/cli/deploy-command.mjs +3 -3
- package/cli/deploy-secrets.mjs +2 -2
- package/cli/deploy.mjs +7 -7
- package/cli/production-auth.mjs +12 -4
- package/cli/production-mail.mjs +8 -1
- package/global/CHANGELOG.md +23 -0
- package/global/README.md +8 -5
- package/global/launch/dev.mjs +3 -2
- package/install.sh +19 -4
- package/modules/delivery-producer/declarations.mjs +13 -0
- package/modules/delivery-producer/mail.mjs +1 -1
- package/modules/operator-auth/accounts/business-team.mjs +6 -3
- package/onboarding/commands.mjs +11 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,8 +43,10 @@ The installer needs no Node: without Node 22 or later on PATH it installs a
|
|
|
43
43
|
private one for `rer` (see below). It edits no shell profile. The second step
|
|
44
44
|
uses the installed launcher directly, so it works in the same shell without
|
|
45
45
|
changing PATH: a child installer cannot change its parent shell’s PATH, and bare
|
|
46
|
-
`rer` needs `~/.local/bin` on PATH.
|
|
47
|
-
|
|
46
|
+
`rer` needs `~/.local/bin` on PATH. When the PATH the installer saw lacks
|
|
47
|
+
`~/.local/bin`, its closing lines give one required step: the
|
|
48
|
+
`export PATH="$HOME/.local/bin:$PATH"` line to run now and add to your shell
|
|
49
|
+
startup file, or `rer cli path` (by its absolute launcher) for other shells.
|
|
48
50
|
The same start also fits on one line:
|
|
49
51
|
|
|
50
52
|
```sh
|
|
@@ -84,9 +86,10 @@ With no Node 22 or later on PATH, the script installs Node 22.20.0 from
|
|
|
84
86
|
verifies the tarball against that release's published `SHASUMS256.txt`, and
|
|
85
87
|
prints its location. The launcher uses this private runtime on later runs.
|
|
86
88
|
System Node is left alone. With no arguments, the installer prints an app-start
|
|
87
|
-
command using its absolute launcher.
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
command using its absolute launcher. With a supplied command and no
|
|
90
|
+
`~/.local/bin` on PATH, it ends with the PATH line to run and keep, and
|
|
91
|
+
`rer cli path` shows the shell-specific line to make `rer` available in future
|
|
92
|
+
terminals. Only running that line changes a shell startup file; `rer` never edits one.
|
|
90
93
|
A re-run with the same build changes nothing; a different build keeps the
|
|
91
94
|
previous version and removes older ones. It refuses to replace a launcher it
|
|
92
95
|
did not write.
|
package/cli/deploy-command.mjs
CHANGED
|
@@ -86,7 +86,7 @@ export async function deployCommand(context) {
|
|
|
86
86
|
const plan = result?.plan ?? (!planned ? undefined : (await owner(['local-plan', '--declaration', path, '--environment', options.environment ?? 'production', ...await deployProductArguments(root, deployProductDirectory(declaration))], production.env, { cwd: root, localOnlyKeys })).plan);
|
|
87
87
|
result = { ...result, dryRun: true, deployed: false, providerChecked: false, plan };
|
|
88
88
|
const { signIn, mailOff } = await requireProductionAuth({ root, declaration, env: production.env, setupManifest, setupSeed: context.setupSeed, adapter, declarationPath: path, options }) ?? {};
|
|
89
|
-
if (mailOff) store.report(mailOffNotice(mailOff, options.environment ?? 'production'));
|
|
89
|
+
if (mailOff) store.report(mailOffNotice(mailOff, options.environment ?? 'production'), { names: mailOff.credentialNames });
|
|
90
90
|
// The one completion line: rer's own plan step (or its deliberate skip) succeeded. A hook's own line says only that the hook finished.
|
|
91
91
|
store.report('deploy: local dry run complete; no credentials were needed, no Cloudflare requests were made and nothing was changed remotely. Target secrets and remote readiness were not checked.');
|
|
92
92
|
const needed = [...new Set([...neededForRealDeploy({ declaration, env: production.env, signIn, secretsChecked: false }), ...(result.neededForRealDeploy ?? []), ...(extraNeeded ?? [])])];
|
|
@@ -124,7 +124,7 @@ export async function deployCommand(context) {
|
|
|
124
124
|
for (const value of [...kinds.privateValues(env), env.CLOUDFLARE_ACCOUNT_ID, ...(declaration.secrets ?? []).map(item => env[item.environment])].filter(Boolean)) addSecret(value);
|
|
125
125
|
const environment = options.environment ?? 'production';
|
|
126
126
|
// The hook uploads every value it is given: a generated secret it gets is the one the Worker keeps.
|
|
127
|
-
if (!options.dryRun) await keepHookSecrets({ root, environment, declaration, setupManifest, env, generated, reused, rotated, again: deployAgain(options), report: line => store.report(line) });
|
|
127
|
+
if (!options.dryRun) await keepHookSecrets({ root, environment, declaration, setupManifest, env, generated, reused, rotated, again: deployAgain(options), report: (line, more) => store.report(line, more) });
|
|
128
128
|
// A hook keeping the kit's record in its own state file named it; every kit
|
|
129
129
|
// step after the hook (inspect, secret, record-owner) reads that record.
|
|
130
130
|
let hookRecord = await hookState(root, environment);
|
|
@@ -187,7 +187,7 @@ export async function deployCommand(context) {
|
|
|
187
187
|
const { setupToken: _, ...result } = deployed;
|
|
188
188
|
return { ...result, ...(claimed ? { owner: claimed } : {}), dependenciesLinked: true };
|
|
189
189
|
});
|
|
190
|
-
if (claimed) store.report(`${claimed === 'claimed' ? 'Claimed the hosted owner' : 'The hosted owner was already claimed and was kept'}${recorded ? '; the one-time setup token was removed' : ''}. ${mailOff ? mailOffNotice(mailOff, environment) : `Sign in by email at ${result.origin}.`}
|
|
190
|
+
if (claimed) store.report(`${claimed === 'claimed' ? 'Claimed the hosted owner' : 'The hosted owner was already claimed and was kept'}${recorded ? '; the one-time setup token was removed' : ''}. ${mailOff ? mailOffNotice(mailOff, environment, recorded?.liveSecrets) : `Sign in by email at ${result.origin}.`}`, { names: mailOff?.credentialNames });
|
|
191
191
|
return result;
|
|
192
192
|
} catch (error) {
|
|
193
193
|
if (error instanceof DeployProductError) throw error;
|
package/cli/deploy-secrets.mjs
CHANGED
|
@@ -96,6 +96,6 @@ export async function keepHookSecrets({ root, environment, declaration, setupMan
|
|
|
96
96
|
export async function keepSecrets({ root, environment, kept, env, generated, reused, report }) {
|
|
97
97
|
await saveSecrets(root, environment, Object.fromEntries(kept.filter(item => generated.includes(item.binding)).map(item => [item.binding, env[item.environment]])));
|
|
98
98
|
const file = savedSecretsFile(environment), them = names => names.length > 1 ? 'them' : 'it';
|
|
99
|
-
if (generated.length) report(`rer generated ${generated.join(', ')} for this deployment and keeps ${them(generated)} in ${file} (private; Git ignores it), so a redeploy reuses ${them(generated)}. To deploy this environment from another checkout, copy that file there
|
|
100
|
-
if (reused.length) report(`rer reused ${reused.join(', ')} kept in ${file}
|
|
99
|
+
if (generated.length) report(`rer generated ${generated.join(', ')} for this deployment and keeps ${them(generated)} in ${file} (private; Git ignores it), so a redeploy reuses ${them(generated)}. To deploy this environment from another checkout, copy that file there.`, { names: generated });
|
|
100
|
+
if (reused.length) report(`rer reused ${reused.join(', ')} kept in ${file}.`, { names: reused });
|
|
101
101
|
}
|
package/cli/deploy.mjs
CHANGED
|
@@ -97,7 +97,7 @@ export function ownerDeploy(declarationPath, lifecycle) {
|
|
|
97
97
|
}
|
|
98
98
|
await owner('secret', ['--set', binding, ...(state ? ['--state', state] : [])]);
|
|
99
99
|
await keepSecrets({ root, environment, kept, env, generated: [binding], reused: [], report: () => {} });
|
|
100
|
-
store.report(`Rotated ${binding} on this environment's Worker to a fresh value kept in .rer/deploy/${environment}.secrets.env, recorded its new version and verified hosted readiness
|
|
100
|
+
store.report(`Rotated ${binding} on this environment's Worker to a fresh value kept in .rer/deploy/${environment}.secrets.env, recorded its new version and verified hosted readiness.`, { names: [binding] });
|
|
101
101
|
}
|
|
102
102
|
return { rotated, deployed: false };
|
|
103
103
|
}
|
|
@@ -105,7 +105,7 @@ export function ownerDeploy(declarationPath, lifecycle) {
|
|
|
105
105
|
step = 'secrets';
|
|
106
106
|
const bindings = (options.setSecret ?? options.unsetSecret).split(','), flag = options.setSecret ? '--set' : '--unset';
|
|
107
107
|
await owner('secret', [...bindings.flatMap(binding => [flag, binding]), ...(state ? ['--state', state] : [])]);
|
|
108
|
-
store.report(`${options.setSecret ? 'Set' : 'Removed'} ${bindings.join(', ')} on this environment's Worker as one new version, recorded it and verified hosted readiness
|
|
108
|
+
store.report(`${options.setSecret ? 'Set' : 'Removed'} ${bindings.join(', ')} on this environment's Worker as one new version, recorded it and verified hosted readiness.`, { names: bindings });
|
|
109
109
|
return { bindings, present: Boolean(options.setSecret), deployed: false };
|
|
110
110
|
}
|
|
111
111
|
store.report(`Deploying the ${environment} environment to your Cloudflare account.`);
|
|
@@ -113,10 +113,10 @@ export function ownerDeploy(declarationPath, lifecycle) {
|
|
|
113
113
|
deployed = await owner('deploy', [], env, { notice: line => store.report(line), onCreated: resource => created.push(redaction.redact(resource)) });
|
|
114
114
|
// A generated value the kit did not send stays unknown: the Worker kept its own.
|
|
115
115
|
const sent = supplied.filter(name => deployed.sentSecrets.includes(name)), keptSent = [...generated, ...reused].filter(name => sent.includes(name));
|
|
116
|
-
await keepSecrets({ root, environment, kept, env, generated: generated.filter(name => sent.includes(name)), reused: reused.filter(name => sent.includes(name)), report: line => store.report(line) });
|
|
116
|
+
await keepSecrets({ root, environment, kept, env, generated: generated.filter(name => sent.includes(name)), reused: reused.filter(name => sent.includes(name)), report: (line, more) => store.report(line, more) });
|
|
117
117
|
const other = sent.filter(name => !keptSent.includes(name));
|
|
118
|
-
if (other.length) store.report(`rer supplied ${other.join(', ')} from the local setup owner and fresh generated values
|
|
119
|
-
if (deployed.optionalUnset) store.report(`Optional secrets not set: ${deployed.optionalUnset.join(', ')}. The application runs without them; set one later with ${again} --set-secret NAME
|
|
118
|
+
if (other.length) store.report(`rer supplied ${other.join(', ')} from the local setup owner and fresh generated values.`, { names: other });
|
|
119
|
+
if (deployed.optionalUnset) store.report(`Optional secrets not set: ${deployed.optionalUnset.join(', ')}. The application runs without them; set one later with ${again} --set-secret NAME.`, { names: deployed.optionalUnset });
|
|
120
120
|
step = 'health';
|
|
121
121
|
await owner('health', [], env, {propagation:deployed.propagation});
|
|
122
122
|
step = 'claim owner';
|
|
@@ -132,8 +132,8 @@ export function ownerDeploy(declarationPath, lifecycle) {
|
|
|
132
132
|
// The app claims the OWNER_EMAIL the Worker holds: the local one only when this run uploaded it.
|
|
133
133
|
const email = declared(claim?.emailField);
|
|
134
134
|
const named = !email ? '' : deployed.sentSecrets.includes(email.binding) && env[email.environment] ? ` (${env[email.environment]})` : ` (the ${email.binding} already set on the Worker)`;
|
|
135
|
-
if (claimed) store.report(`${claimed === 'claimed' ? 'Claimed the hosted owner' : 'The hosted owner was already claimed and was kept'}${named}; the one-time setup token was removed. ${mailOff ? mailOffNotice(mailOff, environment) : `Sign in by email at ${deployed.origin}.`}
|
|
136
|
-
else if (mailOff) store.report(mailOffNotice(mailOff, environment));
|
|
135
|
+
if (claimed) store.report(`${claimed === 'claimed' ? 'Claimed the hosted owner' : 'The hosted owner was already claimed and was kept'}${named}; the one-time setup token was removed. ${mailOff ? mailOffNotice(mailOff, environment, liveSecrets) : `Sign in by email at ${deployed.origin}.`}`, { names: mailOff?.credentialNames });
|
|
136
|
+
else if (mailOff) store.report(mailOffNotice(mailOff, environment, liveSecrets), { names: mailOff.credentialNames });
|
|
137
137
|
return { deployed: true, origin: deployed.origin, ...(claimed ? { owner: claimed } : {}), dependenciesLinked: true };
|
|
138
138
|
} catch (error) {
|
|
139
139
|
if (error instanceof RerError) throw error;
|
package/cli/production-auth.mjs
CHANGED
|
@@ -4,9 +4,17 @@ import { hookState } from './deploy-hook-record.mjs';
|
|
|
4
4
|
import { savedSetupAnswers } from './setup-answers.mjs';
|
|
5
5
|
import { productionMail, mailOffSignInCommand } from './production-mail.mjs';
|
|
6
6
|
|
|
7
|
-
// What a deploy says when outbound email is deliberately off: the state and the way in.
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
// What a deploy says when outbound email is deliberately off: the state and the way in. A seed that
|
|
8
|
+
// declares its mail credential secrets (`mail.credentialSecretNames`) gets this line only when it is
|
|
9
|
+
// true: with the Worker's bound secret names in `live`, a bound mail secret is named instead, and
|
|
10
|
+
// without them (a dry run reads no secrets) the line says the bound secrets were not read.
|
|
11
|
+
export function mailOffNotice({ signIn, credentialNames = [] }, environment = 'production', live) {
|
|
12
|
+
if (credentialNames.length && Array.isArray(live)) {
|
|
13
|
+
const bound = credentialNames.filter(name => live.includes(name));
|
|
14
|
+
if (bound.length) return `Outbound email is configured by the secrets bound on this environment's Worker: ${bound.join(', ')} (names only; values are never printed). This deploy's MAIL_PROVIDER=none setting does not remove them; turn mail off with rer deploy --environment ${environment} --unset-secret and these names. Sign in without mail with \`${signIn}\` for the ${environment} environment, from this checkout with the Cloudflare credentials that deployed it.`;
|
|
15
|
+
}
|
|
16
|
+
const unread = credentialNames.length && !Array.isArray(live) ? ` The bound secrets were not read: if one of ${credentialNames.join(', ')} is bound on the Worker, outbound email is configured by it.` : '';
|
|
17
|
+
return `Outbound email is off (MAIL_PROVIDER=none): no mail credential is bound and this installation sends nothing. Sign in without mail with \`${signIn}\` for the ${environment} environment, from this checkout with the Cloudflare credentials that deployed it. Turn mail on later with rer deploy --environment ${environment} --set-secret and the provider inputs.${unread}`;
|
|
10
18
|
}
|
|
11
19
|
|
|
12
20
|
// Validate the shared email/identity contract using the bindings that will reach
|
|
@@ -23,7 +31,7 @@ export async function requireProductionAuth({ root, declaration, env, setupManif
|
|
|
23
31
|
const mailOffSignIn = mail.off ? declaredSignIn : undefined;
|
|
24
32
|
if (mailOffSignIn) {
|
|
25
33
|
if (mail.offConflicts.length) throw refuse(`MAIL_PROVIDER=none turns outbound email off, and ${mail.offConflicts.join(', ')} would bind a way to send. Remove ${mail.offConflicts.length > 1 ? 'them' : 'it'} or choose a mail provider. Nothing was built or uploaded.`);
|
|
26
|
-
return { mailOff: { signIn: mailOffSignIn } };
|
|
34
|
+
return { mailOff: { signIn: mailOffSignIn, credentialNames: mail.credentialNames } };
|
|
27
35
|
}
|
|
28
36
|
if (mail.senderIssue && options.verb === 'deploy' && !(options.dryRun && mail.fixtureSender)) throw refuse(`${mail.senderIssue} Nothing was built or uploaded.`);
|
|
29
37
|
if (mail.configured()) return;
|
package/cli/production-mail.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { contained } from './project.mjs';
|
|
|
3
3
|
import { refuse } from './errors.mjs';
|
|
4
4
|
import { parseAddress } from '../modules/mail/src/core/validation.mjs';
|
|
5
5
|
import { deliveryDeclarationSources } from './delivery-declarations.mjs';
|
|
6
|
+
import { mailCredentialSecretNames } from '../modules/delivery-producer/declarations.mjs';
|
|
6
7
|
import { validateRerConfig } from '../modules/mail/src/adapters/rer/contract.mjs';
|
|
7
8
|
import { validateMailSenders } from '../modules/delivery-producer/mail.mjs';
|
|
8
9
|
import { sourceMailSenders } from './deploy-variables.mjs';
|
|
@@ -40,7 +41,7 @@ export function mailOffSignInCommand(adapter) {
|
|
|
40
41
|
// root declaration later. Read that source contract, never arbitrary ambient
|
|
41
42
|
// keys or the adapter's executable source, before any build or provider write.
|
|
42
43
|
export async function productionMail(root, declaration, env, declarationPath = 'deploy.json', adapter, mailOffSignIn = mailOffSignInCommand(adapter)) {
|
|
43
|
-
const bindings = { ...declaration.vars }, secrets = new Set(), publicInputs = new Set(), declaredProviders = new Set();
|
|
44
|
+
const bindings = { ...declaration.vars }, secrets = new Set(), publicInputs = new Set(), declaredProviders = new Set(), credentialDeclarations = [];
|
|
44
45
|
const senders = [{ source: `${declarationPath} vars.MAIL_FROM`, value: declaration.vars?.MAIL_FROM }];
|
|
45
46
|
senders.push(...await sourceMailSenders(root, adapter));
|
|
46
47
|
let senderFix = `Edit vars.MAIL_FROM in ${declarationPath}`;
|
|
@@ -79,7 +80,12 @@ export async function productionMail(root, declaration, env, declarationPath = '
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
for (const provider of spec.mail?.providers ?? []) if (providers.includes(provider)) declaredProviders.add(provider);
|
|
83
|
+
try { credentialDeclarations.push(...mailCredentialSecretNames(spec.mail).map(name => ({ name, path }))); }
|
|
84
|
+
catch (error) { throw refuse(`Restore a valid mail credential declaration at ${path}: ${error.message}. Nothing was built or uploaded.`); }
|
|
82
85
|
}
|
|
86
|
+
// The seed's declared mail credentials are secrets of this deployment, or the declaration is wrong.
|
|
87
|
+
for (const { name, path } of credentialDeclarations) if (!secrets.has(name)) throw refuse(`${path} mail.credentialSecretNames names ${name}, which the deployment does not declare as a secret. Declare it in ${declarationPath} secrets or in the secret names of ${path}, or remove it from the list. Nothing was built or uploaded.`);
|
|
88
|
+
const credentialNames = [...new Set(credentialDeclarations.map(item => item.name))];
|
|
83
89
|
for (const name of publicInputs) if (present(env[name])) {
|
|
84
90
|
if (name === 'MAIL_FROM') senders.push({ source: 'public MAIL_FROM (environment or --env-file)', value: env[name] });
|
|
85
91
|
bindings[name] = env[name];
|
|
@@ -128,6 +134,7 @@ export async function productionMail(root, declaration, env, declarationPath = '
|
|
|
128
134
|
});
|
|
129
135
|
return {
|
|
130
136
|
off,
|
|
137
|
+
credentialNames,
|
|
131
138
|
offConflicts: off ? sendingBindings.filter(key => present(bindings[key])) : [],
|
|
132
139
|
declared: 'MAIL_PROVIDER' in bindings || publicInputs.has('MAIL_PROVIDER') || secrets.has('MAIL_API_KEY') || selected.length > 0,
|
|
133
140
|
senderIssue,
|
package/global/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.108
|
|
4
|
+
|
|
5
|
+
### Installer PATH step
|
|
6
|
+
|
|
7
|
+
- After `curl -fsSL https://runeditrun.com/install.sh | sh -s -- dev <owner/repo>` (or any supplied command except `business`), a later bare `rer` in a new terminal whose PATH lacks `~/.local/bin` failed with `rer: command not found`, and the installer only offered an "Optional" step inside the app. When `~/.local/bin` is not on the PATH the installer saw, its closing lines now give one required step: the `export PATH="$HOME/.local/bin:$PATH"` line to run and keep in the shell startup file, and `~/.local/bin/rer cli path` (the absolute launcher) for other shells, in place of the app's optional sentence (the installer sets `RER_INSTALLER_PATH_STEP`, which makes `rer dev` skip that sentence). The installer stays silent when `~/.local/bin` is already on PATH, edits no shell file, keeps the command's exit code, and leaves `business` commands free of shell advice.
|
|
8
|
+
- The one-line installer is served from the release asset (`install.sh` in the release), so a user gets this only once this release is published; runs of the installer from an older release are unchanged.
|
|
9
|
+
- The seed README template (`foundation/template` README.md and OPERATIONS.md, and the default seed's README.md and RUN-LOCALLY.md, with the exported RUN-LOCALLY.md) shows the same line beside its first bare `rer dev`. A seed gets that wording only by adopting it.
|
|
10
|
+
- Code and docs only: no migration is added. Nothing here is live in any deployed seed until that seed adopts and deploys it.
|
|
11
|
+
|
|
12
|
+
## 0.2.107
|
|
13
|
+
|
|
14
|
+
### Deploy mail notice and secret names
|
|
15
|
+
|
|
16
|
+
- `rer deploy` no longer says "Outbound email is off (MAIL_PROVIDER=none): no mail credential is bound" when mail secrets are bound. A seed lists its mail credential secrets in the new optional `mail.credentialSecretNames` (beside `mail.providers` in its deployment-spec declaration; a non-empty list, each name a secret the deployment declares, no duplicates, no values; `rer deploy` refuses a name the deployment does not declare). When any listed name is bound on the Worker, the deploy prints one line naming the bound secret names (never values) and saying outbound email is configured by them; when none is, the off line is unchanged, and a dry run says it did not read the bound secrets. rer does not guess mail secrets from name patterns, and a seed without the key is unchanged.
|
|
17
|
+
- rer's confirmation lines no longer redact secret names. `rer deploy --set-secret EMAIL_PROVIDER,...` printed `[REDACTED]_DOMAIN` when a secret's value (`mailgun`) or another name (`MAILGUN_SENDING_KEY`) matched part of a name. The lines that list names (set, unset, rotate, generated, reused, supplied, optional-unset, the mail notice) keep each name whole; values are still redacted everywhere, including in the text around the names.
|
|
18
|
+
|
|
19
|
+
### Business roster erasure
|
|
20
|
+
|
|
21
|
+
- Erasing an operator now also retires them from the Business-signed roster. In the same erasure transaction, `agentErasureStatements` deletes the person's `bs_team` row, removes their entry from the stored `bs_settings.document` (the verified payload; no signature is stored or re-signed), and redacts an editor identity in `bs_overrides`/`bs_audit` to the erasure marker; before, their name, email and operator id stayed there. A seed gets this only by declaring it: its erasure map must declare `agent_door_state` with `retire: { refs }`, and the erasure subject must carry `operatorPolicyRefs`. A seed whose map does not declare it keeps the old behaviour (the roster entry stays), so this release does not close the leak for a seed until that seed has adopted 0.2.107 and added the declaration. A seed without the agent door appends `rosterRetirementStatements(db, refs, { erasure_id })` to its own erasure transaction instead.
|
|
22
|
+
- Value-free digests in the new `bs_retired` table make the Business's next signed revision that still lists an erased person apply as retired: everyone else applies, they get no account, row or invitation, and the ack carries `retired: [email]`, until the Business sends a larger member `invite`.
|
|
23
|
+
- A person erased by an older release, whose roster row and stored document entry an old erasure left behind, is retired at runtime, not by a migration. A team adapter may return `gone` (the `operatorId`s of stored rows whose native identity no longer exists, by the adapter's own check); on the Business's next revision the Business-settings module writes the digests and invite number to `bs_retired`, purges the row and drops the document entry in that apply's batch, so a revision still listing them applies as retired instead of inviting them again. `auth.businessTeam` reports a stored operator it can no longer find (it answered `conflict` for that row before). An adapter that never returns `gone`, such as one bound to another accounts table, changes no stored row.
|
|
24
|
+
- This release is not code only: it adds migration `0044_business_retired.sql` (source `modules/business-settings/schema/0003_business_retired.sql`). It creates the table `bs_retired` and nothing else: no purge, no data rewrite, no row read or changed. Every seed with a Business roster must copy it into its own forward migration sequence and land it; without it person erasure refuses with `business_roster_missing_table:bs_retired` and a revision that lists team members refuses. Seeds get all of this by adopting 0.2.107, landing the migration and declaring the erasure refs; none of it is live in any deployed seed until that seed adopts and deploys it.
|
|
25
|
+
|
|
3
26
|
## 0.2.106
|
|
4
27
|
|
|
5
28
|
### `rer deploy --dry-run`
|
package/global/README.md
CHANGED
|
@@ -43,8 +43,10 @@ The installer needs no Node: without Node 22 or later on PATH it installs a
|
|
|
43
43
|
private one for `rer` (see below). It edits no shell profile. The second step
|
|
44
44
|
uses the installed launcher directly, so it works in the same shell without
|
|
45
45
|
changing PATH: a child installer cannot change its parent shell’s PATH, and bare
|
|
46
|
-
`rer` needs `~/.local/bin` on PATH.
|
|
47
|
-
|
|
46
|
+
`rer` needs `~/.local/bin` on PATH. When the PATH the installer saw lacks
|
|
47
|
+
`~/.local/bin`, its closing lines give one required step: the
|
|
48
|
+
`export PATH="$HOME/.local/bin:$PATH"` line to run now and add to your shell
|
|
49
|
+
startup file, or `rer cli path` (by its absolute launcher) for other shells.
|
|
48
50
|
The same start also fits on one line:
|
|
49
51
|
|
|
50
52
|
```sh
|
|
@@ -84,9 +86,10 @@ With no Node 22 or later on PATH, the script installs Node 22.20.0 from
|
|
|
84
86
|
verifies the tarball against that release's published `SHASUMS256.txt`, and
|
|
85
87
|
prints its location. The launcher uses this private runtime on later runs.
|
|
86
88
|
System Node is left alone. With no arguments, the installer prints an app-start
|
|
87
|
-
command using its absolute launcher.
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
command using its absolute launcher. With a supplied command and no
|
|
90
|
+
`~/.local/bin` on PATH, it ends with the PATH line to run and keep, and
|
|
91
|
+
`rer cli path` shows the shell-specific line to make `rer` available in future
|
|
92
|
+
terminals. Only running that line changes a shell startup file; `rer` never edits one.
|
|
90
93
|
A re-run with the same build changes nothing; a different build keeps the
|
|
91
94
|
previous version and removes older ones. It refuses to replace a launcher it
|
|
92
95
|
did not write.
|
package/global/launch/dev.mjs
CHANGED
|
@@ -48,10 +48,11 @@ export async function launchDev(target) {
|
|
|
48
48
|
catch (failure) { if (!(failure instanceof LaunchFailure)) throw failure; process.stderr.write(failure.message + '\n'); return failure.exitCode; }
|
|
49
49
|
}
|
|
50
50
|
showBudget(devArgs);
|
|
51
|
-
// The launch never asks for shell edits. Offer the optional step only at ready
|
|
51
|
+
// The launch never asks for shell edits. Offer the optional step only at ready,
|
|
52
|
+
// and not when install.sh closes with its own required PATH step.
|
|
52
53
|
delete process.env.RER_LAUNCH_PATH_STEP;
|
|
53
54
|
const paths = layout();
|
|
54
|
-
if (await access(paths.launcher).then(() => true, () => false) && await pathAdvice(paths)) process.env.RER_LAUNCH_PATH_STEP = `Optional, after opening your app: make rer available in future terminals. Run ${shellQuote(paths.launcher)} cli path to see the shell step; it changes no shell file itself.`;
|
|
55
|
+
if (!process.env.RER_INSTALLER_PATH_STEP && await access(paths.launcher).then(() => true, () => false) && await pathAdvice(paths)) process.env.RER_LAUNCH_PATH_STEP = `Optional, after opening your app: make rer available in future terminals. Run ${shellQuote(paths.launcher)} cli path to see the shell step; it changes no shell file itself.`;
|
|
55
56
|
const here = await realpath(process.cwd()).catch(() => undefined);
|
|
56
57
|
const out = printer({ root: checkout, json: devArgs.includes('--json'), stopHint: `rer dev --stop${here === checkout ? '' : ` --cwd ${JSON.stringify(checkout)}`}`, keyless: doorStart });
|
|
57
58
|
const detach = args.includes('--detach') || (!args.includes('--foreground') && !process.stdout.isTTY);
|
package/install.sh
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
# package's own `rer cli install`: the same layout as
|
|
13
13
|
# `npx -y @runeditrun/rer cli install`. A failure leaves any previous install
|
|
14
14
|
# selected and working. It never edits shell profiles: when ~/.local/bin is not
|
|
15
|
-
# on PATH, the absolute launcher works now
|
|
15
|
+
# on PATH, the absolute launcher works now, and a run that supplied a command ends
|
|
16
|
+
# with the one PATH line to run and keep.
|
|
16
17
|
#
|
|
17
18
|
# Needs curl and tar. If Node 22 or later is absent, installs the pinned official
|
|
18
19
|
# Node release in rer's own data directory. macOS/Linux x64/arm64; Windows: WSL2.
|
|
@@ -150,8 +151,8 @@ NODE
|
|
|
150
151
|
export RER_TRANSFER_RER_BYTES
|
|
151
152
|
mkdir "$work/stage"
|
|
152
153
|
tar -xzf "$work/rer.tgz" -C "$work/stage" || fail "could not unpack rer $version; nothing was installed."
|
|
153
|
-
# A supplied command replaces the app next step.
|
|
154
|
-
#
|
|
154
|
+
# A supplied command replaces the app next step. When ~/.local/bin is not on
|
|
155
|
+
# the caller's PATH, the closing lines below give the shell step.
|
|
155
156
|
no_next=
|
|
156
157
|
if [ "$#" -gt 0 ]; then no_next=1; fi
|
|
157
158
|
RER_INSTALL_CHANNEL=script RER_INSTALL_NO_NEXT=$no_next "$node_binary" "$work/stage/package/global/rer.mjs" cli install </dev/null \
|
|
@@ -164,9 +165,23 @@ NODE
|
|
|
164
165
|
# where ~/.local/bin may not be on PATH yet.
|
|
165
166
|
RER_INVOKED_AS="$HOME/.local/bin/rer"
|
|
166
167
|
if [ "$(command -v rer 2>/dev/null || true)" = "$RER_INVOKED_AS" ]; then RER_INVOKED_AS=rer; fi
|
|
168
|
+
# The caller's own PATH decides whether a later bare `rer` works. Read it before
|
|
169
|
+
# it is extended for the command below. Business connect stays free of shell advice.
|
|
170
|
+
path_step=
|
|
171
|
+
case ":$PATH:" in
|
|
172
|
+
*":$HOME/.local/bin:"* | *":$HOME/.local/bin/:"*) ;;
|
|
173
|
+
*) if [ "$1" != business ]; then path_step=1; fi ;;
|
|
174
|
+
esac
|
|
167
175
|
PATH="$PATH:$HOME/.local/bin"
|
|
168
176
|
export PATH RER_INVOKED_AS
|
|
169
|
-
|
|
177
|
+
# The closing lines replace the app's own optional PATH sentence, never repeat it.
|
|
178
|
+
if [ -n "$path_step" ]; then RER_INSTALLER_PATH_STEP=1; export RER_INSTALLER_PATH_STEP; fi
|
|
179
|
+
status=0
|
|
180
|
+
"$HOME/.local/bin/rer" "$@" || status=$?
|
|
181
|
+
if [ -n "$path_step" ]; then
|
|
182
|
+
printf '\nRequired next step: %s/.local/bin is not on your PATH, so a bare `rer` in a new terminal says "rer: command not found". Run this in the terminal you will use, and add the same line to your shell startup file (~/.zshrc for zsh, ~/.bashrc for bash):\n export PATH="$HOME/.local/bin:$PATH"\nOther shells, such as fish: run %s/.local/bin/rer cli path to see the line for yours. Until then, start rer with %s/.local/bin/rer. This installer changes no shell file.\n' "$HOME" "$HOME" "$HOME"
|
|
183
|
+
fi
|
|
184
|
+
return "$status"
|
|
170
185
|
}
|
|
171
186
|
|
|
172
187
|
install_node() {
|
|
@@ -11,8 +11,21 @@ const status = (value, label) => {
|
|
|
11
11
|
if (!Number.isInteger(value) || value < 100 || value > 599) throw Error(`Invalid ${label}`);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* The secret names a seed declares as its outbound mail credentials, `mail.credentialSecretNames`:
|
|
16
|
+
* optional, a non-empty list of binding names, no duplicates, never values. Whether each is a secret
|
|
17
|
+
* the deployment declares is checked where the deployment's secrets are known (`rer deploy`).
|
|
18
|
+
*/
|
|
19
|
+
export function mailCredentialSecretNames(mail) {
|
|
20
|
+
if (mail?.credentialSecretNames === undefined) return [];
|
|
21
|
+
const names = strings(mail.credentialSecretNames, 'mail credentialSecretNames', bindingPattern);
|
|
22
|
+
if (!names.length) throw Error('Invalid mail credentialSecretNames: name at least one secret or remove the list');
|
|
23
|
+
return names;
|
|
24
|
+
}
|
|
25
|
+
|
|
14
26
|
/** Preserve source-owned preview and setup declarations, without authorizing effects. */
|
|
15
27
|
export function validateDeclarations(spec) {
|
|
28
|
+
mailCredentialSecretNames(spec.mail);
|
|
16
29
|
if (spec.providerEffects !== undefined) {
|
|
17
30
|
if (strings(spec.providerEffects, 'providerEffects', /^[a-z][a-z0-9-]{0,63}$/).length > 32) throw Error('Too many provider effects');
|
|
18
31
|
}
|
|
@@ -25,7 +25,7 @@ export function publicMailSender(spec) {
|
|
|
25
25
|
/** Managed mail is an explicit capability, independent of direct provider adapters. */
|
|
26
26
|
export function usesManagedMail(mail) {
|
|
27
27
|
if (mail === undefined) return false;
|
|
28
|
-
keys(mail, ['providers'], 'mail');
|
|
28
|
+
keys(mail, ['providers', 'credentialSecretNames'], 'mail');
|
|
29
29
|
const providers = strings(mail.providers, 'mail providers', /^(rer|resend|sendgrid|cloudflare)$/);
|
|
30
30
|
if (!providers.length) throw Error('Mail requires at least one provider');
|
|
31
31
|
return providers.includes('rer');
|
|
@@ -24,7 +24,7 @@ export function businessTeam(context) {
|
|
|
24
24
|
WHERE o.role='owner' AND o.status='active' ORDER BY b.claim_id IS NULL,o.created_at,o.id LIMIT 1))`,
|
|
25
25
|
args: [...guard.args, operator.id, operator.email, operator.version] }));
|
|
26
26
|
const fence = store.actorFence(actor, clock());
|
|
27
|
-
const pending = [], rows = [];
|
|
27
|
+
const pending = [], rows = [], gone = [];
|
|
28
28
|
// Abort the whole caller transaction if ownership changed, even when this
|
|
29
29
|
// document contains only conflicts or unchanged members.
|
|
30
30
|
const statements = [[`INSERT INTO oa_auth_audit(id,actor_id,action,value,created_at)
|
|
@@ -54,7 +54,10 @@ export function businessTeam(context) {
|
|
|
54
54
|
// current sign-in address. Self-service email changes keep this ID.
|
|
55
55
|
let target = prior ? await store.operator(prior.operatorId) : await store.byEmail(email);
|
|
56
56
|
const oldRole = target?.role;
|
|
57
|
-
|
|
57
|
+
// The native operator is gone (an erasure removed it): the module retires the stored row and its listing,
|
|
58
|
+
// so no conflict row is kept and the Business's next listing of them stays retired.
|
|
59
|
+
if (prior && !target) { gone.push(prior.operatorId); continue; }
|
|
60
|
+
if (target?.role === 'owner' || !prior && (email === owner.email || target)) {
|
|
58
61
|
// Never adopt an unrelated account, or discard a recorded identity
|
|
59
62
|
// because its old address now belongs to another account.
|
|
60
63
|
if (member || prior) rows.push({ email, operatorId: prior?.operatorId ?? null, invite: member?.invite ?? prior.invite, state: 'conflict' });
|
|
@@ -84,7 +87,7 @@ export function businessTeam(context) {
|
|
|
84
87
|
} else if (target.displayName !== name) target = await update(target, { ...target, displayName: name }, 'operators:role');
|
|
85
88
|
rows.push({ email, operatorId: target.id, invite: member.invite, state: target.status });
|
|
86
89
|
}
|
|
87
|
-
return { statements: statements.map(([sql, args]) => store.statement(sql, args)), rows,
|
|
90
|
+
return { statements: statements.map(([sql, args]) => store.statement(sql, args)), rows, gone,
|
|
88
91
|
async afterCommit() { for (const send of pending) await send(); } };
|
|
89
92
|
},
|
|
90
93
|
});
|
package/onboarding/commands.mjs
CHANGED
|
@@ -46,7 +46,17 @@ export async function createCommands(directory,state,{terminal=text=>writeSync(1
|
|
|
46
46
|
if(!closed)log.write(text);
|
|
47
47
|
writeTerminal(text);
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
// A line that lists secret NAMES keeps each name whole: a name is not a secret, even when a value
|
|
50
|
+
// equals it or one of its parts. The text around the names is redacted exactly as any other line.
|
|
51
|
+
const redactBesideNames=(text,names)=>{
|
|
52
|
+
const listed=[...new Set((names??[]).filter(name=>typeof name==='string'&&name))].sort((a,b)=>b.length-a.length);
|
|
53
|
+
if(!listed.length)return redaction.redact(text);
|
|
54
|
+
const pattern=new RegExp(`(?<![A-Za-z0-9_])(?:${listed.map(name=>name.replace(/[.*+?^${}()|[\]\\]/g,'\\$&')).join('|')})(?![A-Za-z0-9_])`,'g');
|
|
55
|
+
let result='',from=0;
|
|
56
|
+
for(const match of text.matchAll(pattern)){result+=redaction.redact(text.slice(from,match.index))+match[0];from=match.index+match[0].length;}
|
|
57
|
+
return result+redaction.redact(text.slice(from));
|
|
58
|
+
};
|
|
59
|
+
const report=(text,{names}={})=>emit(redactBesideNames(String(text),names)+'\n');
|
|
50
60
|
const failure=(label,detail={},capture)=>{
|
|
51
61
|
const outcome=`exit ${detail.code??'none'}, signal ${detail.signal??'none'}`;
|
|
52
62
|
const status=detail.reason==='cancel'?`cancelled (${outcome})`:detail.reason==='deadline'?`readiness deadline exceeded (${outcome})`:detail.error?`could not start${detail.errorCode?` (${detail.errorCode})`:''} (${outcome})`:outcome;
|