@runeditrun/rer 0.2.6 → 0.2.7

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/cli/README.md CHANGED
@@ -282,9 +282,11 @@ sign-in address; a hook that reports no deployment, or whose app never names
282
282
  the commit, fails with what happened and claims nothing. When the hook deployed
283
283
  through the kit's standard deployment record, rer also records successful
284
284
  ownership separately from retired secrets and removes the setup token before
285
- returning success; a hook that keeps its own record keeps its token, and returns
286
- that kit state file as `state` so `rer deploy --remove --yes` removes what it
287
- deployed (`cli/deploy-hook-record.mjs` keeps the pointer). An owner
285
+ returning success. A hook that deploys with the kit under its own state file
286
+ returns that file as `state` (`cli/deploy-hook-record.mjs` keeps the pointer):
287
+ every later step (inspect, setup token, owner record, `--set-secret`,
288
+ `--unset-secret`, `--remove --yes`) reads that record, so rer claims and retires
289
+ the token the same way; a hook that keeps an unnamed record keeps its token. An owner
288
290
  already claimed by the hook is kept without another bootstrap. An existing owner
289
291
  is explicitly reported as kept. Function owner hooks run their complete
290
292
  bootstrap flow; setup manifest paths do not replace it. A missing or ambiguous
@@ -8,7 +8,7 @@ import { mutationReadinessFailure } from './deploy-readiness.mjs';
8
8
  import { observeOwner } from './deploy-observation.mjs';
9
9
  import { committedSource } from './deploy-source.mjs';
10
10
  import { hookOrigin, waitForSource } from './deploy-hook.mjs';
11
- import { rememberHookState } from './deploy-hook-record.mjs';
11
+ import { rememberHookState, hookState } from './deploy-hook-record.mjs';
12
12
  import { main as owner } from '../modules/deploy-kit/owner-cli.mjs';
13
13
  import { localOnlyBinding, ownerWorkerName } from '../modules/deploy-kit/owner.mjs';
14
14
  import { refuseLocalModels } from '../modules/deploy-kit/local-only.mjs';
@@ -55,9 +55,13 @@ export async function deployCommand(context) {
55
55
  const redaction = createRedaction();
56
56
  const addSecret = value => { redaction.addSecrets([value]); store.addSecrets?.([value]); };
57
57
  for (const value of [...credentialValues(env), env.CLOUDFLARE_ACCOUNT_ID, ...(declaration.secrets ?? []).map(item => env[item.environment])].filter(Boolean)) addSecret(value);
58
- const command = (verb, extra = [], values = env) => owner([verb, '--declaration', path, '--environment', options.environment ?? 'production', ...extra], values, { cwd: root, localOnlyKeys });
58
+ const environment = options.environment ?? 'production';
59
+ // A hook keeping the kit's record in its own state file named it; every kit
60
+ // step after the hook (inspect, secret, record-owner) reads that record.
61
+ let hookRecord = await hookState(root, environment);
62
+ const command = (verb, extra = [], values = env) => owner([verb, '--declaration', path, '--environment', environment, ...(hookRecord ? ['--state', hookRecord] : []), ...extra], values, { cwd: root, localOnlyKeys });
59
63
  // A hook that deployed through the kit's standard record lets rer issue and
60
- // retire the setup token; a hook keeping its own record keeps its token.
64
+ // retire the setup token; a hook keeping an unnamed record of its own keeps its token.
61
65
  let recorded;
62
66
  const inspect = async () => {
63
67
  try { return recorded = await command('inspect'); }
@@ -78,7 +82,8 @@ export async function deployCommand(context) {
78
82
  Object.assign(process.env, saved);
79
83
  }
80
84
  if (options.dryRun) return deployed;
81
- await rememberHookState(root, options.environment ?? 'production', deployed?.state);
85
+ await rememberHookState(root, environment, deployed?.state);
86
+ hookRecord = await hookState(root, environment);
82
87
  const origin = hookOrigin(deployed, deployAgain(options));
83
88
  step = 'wait for the deployed source';
84
89
  await waitForSource({ origin, sourceSha, again: deployAgain(options) });
package/cli/deploy.mjs CHANGED
@@ -57,10 +57,10 @@ export function ownerDeploy(declarationPath, lifecycle) {
57
57
  const created = [];
58
58
  let step = 'deploy', deployed;
59
59
  try {
60
+ // A custom hook's own state file, when its deploy named one.
61
+ const state = await hookState(root, environment);
60
62
  if (options.remove) {
61
63
  step = 'remove';
62
- // A custom hook's own state file, when its deploy named one.
63
- const state = await hookState(root, environment);
64
64
  const result = await owner('remove', state ? ['--state', state] : []);
65
65
  await forgetHookState(root, environment);
66
66
  store.report(`Removed ${result.removed.join(', ') || 'nothing (already gone)'}; read back: none of them remains.`);
@@ -69,7 +69,7 @@ export function ownerDeploy(declarationPath, lifecycle) {
69
69
  if (change.length) {
70
70
  step = 'secrets';
71
71
  const binding = options.setSecret ?? options.unsetSecret;
72
- await owner('secret', [options.setSecret ? '--set' : '--unset', binding]);
72
+ await owner('secret', [options.setSecret ? '--set' : '--unset', binding, ...(state ? ['--state', state] : [])]);
73
73
  store.report(`${options.setSecret ? `Set ${binding}` : `Removed ${binding}`} on this environment's Worker, recorded its new version and verified hosted readiness.`);
74
74
  return { binding, present: Boolean(options.setSecret), deployed: false };
75
75
  }
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.7
4
+
5
+ - `rer deploy` after a custom deploy hook that returned its own kit state file as `state` reads that record for every finalization step (inspect, the setup token, the owner record), so it issues a setup token, claims the hosted owner, retires the token and exits 0, instead of failing with `HTTP 403 (invalid_setup_token)` because it looked only at `.rer/deploy/<environment>.json`. `--set-secret` and `--unset-secret` read the same record. An untouched repeat still writes nothing.
6
+
7
+ ### Upgrade notes
8
+
9
+ - None: a hook that already returns `state` (0.2.6 upgrade note) gets its owner claimed on its next `rer deploy`.
10
+
3
11
  ## 0.2.6
4
12
 
5
13
  - A job-queue client no longer crashes with an unhandled `write EPIPE` when a process probing its identity or policy socket closes before the answer is written (a probe that timed out under load); the prober reports its own timeout or reset. This stopped Orbit's release producer twice.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runeditrun/rer",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "The rer command: install, set up, run and launch Run Edit Run checkouts.",
5
5
  "license": "MIT",
6
6
  "type": "module",