@christang/keel 5.178.0 → 5.179.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.178.0",
3
+ "version": "5.179.0",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.178.0 -->
1
+ <!-- keel:start version=5.179.0 -->
2
2
  ## Keel Bootstrap
3
3
 
4
4
  - Start every session with `keel context`; OpenSpec artifacts and Git are the durable authority, and memory or transcripts may only inform.
package/bin/keel.js CHANGED
@@ -1050,7 +1050,28 @@ function versionChange(before, after) {
1050
1050
  return before && after && before !== after ? `updated ${before} -> ${after}` : `current ${after || before || "unknown"}`;
1051
1051
  }
1052
1052
 
1053
- function updateClaudePlugin(options) {
1053
+ // Right after a release the Claude marketplace, read from Git, names a version
1054
+ // the npm registry this machine reaches does not serve yet, and the plugin
1055
+ // update exits with npm's E404; a rerun minutes later succeeds (#421). That is
1056
+ // read as lag only when the registry's own latest is older than the version
1057
+ // asked for; an E404 the registry cannot explain stays a failure.
1058
+ function registryLag(result, npm) {
1059
+ const said = `${result.stdout || ""}\n${result.stderr || ""}`;
1060
+ const match = /E404 No match found for version (\d+\.\d+\.\d+[^\s'"]*)/.exec(said);
1061
+ if (!match) return null;
1062
+ const limit = Number(process.env.KEEL_UPDATE_QUERY_TIMEOUT_MS) || 30 * 1000;
1063
+ const view = spawnSync(npm, ["view", PACKAGE_JSON.name, "version", "--prefer-online"], {
1064
+ encoding: "utf8",
1065
+ shell: process.platform === "win32",
1066
+ timeout: limit,
1067
+ });
1068
+ if (view.error || view.status !== 0) return null;
1069
+ const latest = String(view.stdout || "").trim();
1070
+ if (!/^\d+\.\d+\.\d+/.test(latest) || compareVersions(match[1], latest) <= 0) return null;
1071
+ return { wanted: match[1], latest };
1072
+ }
1073
+
1074
+ function updateClaudePlugin(options, npm) {
1054
1075
  const component = "claude plugin";
1055
1076
  const executable = process.env.KEEL_UPDATE_CLAUDE || "claude";
1056
1077
  const queried = claudeKeel(executable);
@@ -1078,7 +1099,21 @@ function updateClaudePlugin(options) {
1078
1099
  updateLine(component, "failed", `\`claude ${steps[0].join(" ")}\` failed twice; ${hostFailure(refreshed)}`);
1079
1100
  return false;
1080
1101
  }
1081
- if (!runHostSteps(component, "claude", executable, [steps[1]])) return false;
1102
+ const updated = hostRun(executable, steps[1]);
1103
+ if (updated.error || updated.status !== 0) {
1104
+ const lag = registryLag(updated, npm);
1105
+ if (lag) {
1106
+ updateLine(
1107
+ component,
1108
+ "pending",
1109
+ `the npm registry here does not serve ${lag.wanted} yet (its latest is ${lag.latest}); `
1110
+ + "rerun keel --update in a few minutes"
1111
+ );
1112
+ return true;
1113
+ }
1114
+ updateLine(component, "failed", `\`claude ${steps[1].join(" ")}\` ${hostFailure(updated)}`);
1115
+ return false;
1116
+ }
1082
1117
  const after = claudeKeel(executable);
1083
1118
  if (after && after.failed) {
1084
1119
  updateLine(component, "failed", `${after.failed} after the update, so its result is unverified`);
@@ -1303,7 +1338,17 @@ function updateGlobalCli(options, npm, source) {
1303
1338
  return false;
1304
1339
  }
1305
1340
  const packed = /-(\d+\.\d+\.\d+[^/]*?)\.tgz$/.exec(path.basename(tarball));
1306
- updateLine("cli", versionChange(PACKAGE_JSON.version, packed ? packed[1] : null), "applies to the next command that runs keel");
1341
+ // From the default source the packed version is the registry's latest as
1342
+ // this machine sees it, which is what `current` means right after a
1343
+ // release whose version has not reached that registry yet (#421).
1344
+ const latest = packed && source === DEFAULT_UPDATE_SOURCE
1345
+ ? `the npm registry's latest here is ${packed[1]}; `
1346
+ : "";
1347
+ updateLine(
1348
+ "cli",
1349
+ versionChange(PACKAGE_JSON.version, packed ? packed[1] : null),
1350
+ `${latest}applies to the next command that runs keel`
1351
+ );
1307
1352
  return true;
1308
1353
  } catch (error) {
1309
1354
  updateLine("cli", "failed", error.message);
@@ -1332,7 +1377,7 @@ function runGlobalUpdate(options) {
1332
1377
  // leaves the others to report, and any failure fails the command.
1333
1378
  const results = [
1334
1379
  updateGlobalCli(options, npm, source),
1335
- updateClaudePlugin(options),
1380
+ updateClaudePlugin(options, npm),
1336
1381
  updateCodexPlugin(options),
1337
1382
  ];
1338
1383
  return results.every(Boolean) ? 0 : 1;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.178.0",
3
+ "version": "5.179.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.178.0",
9
+ "version": "5.179.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@fission-ai/openspec": "^1.4.1"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@christang/keel",
3
3
  "displayName": "Keel",
4
4
  "description": "Keel OpenSpec execution discipline CLI for Claude Code, Codex, and OpenCode.",
5
- "version": "5.178.0",
5
+ "version": "5.179.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.178.0",
3
+ "version": "5.179.0",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.178.0",
3
+ "version": "5.179.0",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // Waits until the npm registry serves a published version (#421).
5
+ //
6
+ // `npm publish` returning is the write side saying the version exists; the
7
+ // read side that `npm install` and `claude plugin update` resolve against has
8
+ // lagged it by minutes (#153, #421). The publish job runs this between the
9
+ // publish and the release, so a release announces a version the registry
10
+ // already serves. A nonzero `npm view` is npm's E404 for a version it cannot
11
+ // see yet, and counts as not served. Mirrors and proxies may lag further;
12
+ // `keel --update` reports that case as `pending`.
13
+ //
14
+ // Usage:
15
+ // node scripts/await_registry.js <package> <version> [--interval-seconds N] [--timeout-seconds N]
16
+ //
17
+ // KEEL_AWAIT_NPM names the npm executable (default `npm`).
18
+
19
+ const { spawnSync } = require("child_process");
20
+
21
+ function fail(message) {
22
+ process.stderr.write(`await_registry: ${message}\n`);
23
+ process.exit(1);
24
+ }
25
+
26
+ function option(args, name, fallback) {
27
+ const index = args.indexOf(name);
28
+ if (index < 0) return fallback;
29
+ const value = Number(args[index + 1]);
30
+ if (!Number.isFinite(value) || value < 0) fail(`${name} needs a number of seconds`);
31
+ args.splice(index, 2);
32
+ return value;
33
+ }
34
+
35
+ function served(npm, spec, version) {
36
+ const result = spawnSync(npm, ["view", spec, "version", "--prefer-online"], {
37
+ encoding: "utf8",
38
+ shell: process.platform === "win32",
39
+ timeout: 60 * 1000,
40
+ });
41
+ return !result.error && result.status === 0 && String(result.stdout || "").trim() === version;
42
+ }
43
+
44
+ function sleep(seconds) {
45
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, seconds * 1000);
46
+ }
47
+
48
+ function main() {
49
+ const args = process.argv.slice(2);
50
+ const interval = option(args, "--interval-seconds", 15);
51
+ const limit = option(args, "--timeout-seconds", 15 * 60);
52
+ if (args.length !== 2) {
53
+ fail("usage: node scripts/await_registry.js <package> <version> [--interval-seconds N] [--timeout-seconds N]");
54
+ }
55
+ const [name, version] = args;
56
+ const spec = `${name}@${version}`;
57
+ const npm = process.env.KEEL_AWAIT_NPM || "npm";
58
+ const started = Date.now();
59
+ for (let polls = 1; ; polls += 1) {
60
+ if (served(npm, spec, version)) {
61
+ const seconds = Math.round((Date.now() - started) / 1000);
62
+ process.stdout.write(`await_registry: the registry serves ${spec} after ${seconds} s and ${polls} poll(s)\n`);
63
+ return;
64
+ }
65
+ if ((Date.now() - started) / 1000 + interval > limit) {
66
+ fail(`the registry did not serve ${spec} within ${limit} s (${polls} poll(s)); re-run the job to wait again`);
67
+ }
68
+ sleep(interval);
69
+ }
70
+ }
71
+
72
+ main();
@@ -51,8 +51,8 @@ REQUIRED_SCRIPTS = [
51
51
  "scripts/validate_plugin.py",
52
52
  ]
53
53
 
54
- PACKAGE_VERSION = "5.178.0"
55
- PROTOCOL_VERSION = "5.178.0"
54
+ PACKAGE_VERSION = "5.179.0"
55
+ PROTOCOL_VERSION = "5.179.0"
56
56
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
57
57
  OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
58
58
  # Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
@@ -25267,7 +25267,10 @@ if (failOn && args.join(" ").includes(failOn)) {
25267
25267
  if (failed < failTimes) {
25268
25268
  state.failed = { ...(state.failed || {}), [host]: failed + 1 };
25269
25269
  save();
25270
- process.stderr.write(`fake ${host}: warming up\nfake ${host}: refused ${args.join(" ")}\n`);
25270
+ // FAKE_FAIL_STDERR_<HOST> replaces the refusal's last line, as a host's own
25271
+ // error text would read (#421).
25272
+ const said = process.env[`FAKE_FAIL_STDERR_${host.toUpperCase()}`] || `fake ${host}: refused ${args.join(" ")}`;
25273
+ process.stderr.write(`fake ${host}: warming up\n${said}\n`);
25271
25274
  process.exit(1);
25272
25275
  }
25273
25276
  }
@@ -25277,6 +25280,15 @@ if (host === "npm") {
25277
25280
  fs.writeFileSync(path.join(dest, "christang-keel-5.1.0.tgz"), "");
25278
25281
  process.stdout.write(JSON.stringify([{ filename: "christang-keel-5.1.0.tgz" }]));
25279
25282
  }
25283
+ // FAKE_NPM_LATEST is what `npm view <package> version` prints, and
25284
+ // FAKE_NPM_VIEW_EXIT makes it exit with that status instead (#421).
25285
+ if (args[0] === "view") {
25286
+ if (process.env.FAKE_NPM_VIEW_EXIT) {
25287
+ process.stderr.write("npm error code E404\n");
25288
+ process.exit(Number(process.env.FAKE_NPM_VIEW_EXIT));
25289
+ }
25290
+ process.stdout.write(`${process.env.FAKE_NPM_LATEST || "5.1.0"}\n`);
25291
+ }
25280
25292
  process.exit(0);
25281
25293
  }
25282
25294
  const joined = args.join(" ");
@@ -25455,6 +25467,101 @@ def validate_update_covers_installed_hosts_scenario() -> int:
25455
25467
  return 0
25456
25468
 
25457
25469
 
25470
+ def validate_update_registry_lag_scenario() -> int:
25471
+ """Issue #421: a version the registry does not serve yet is `pending`.
25472
+
25473
+ Right after a release, the Claude marketplace names the new version while
25474
+ the npm registry the machine reaches still serves the old one, and
25475
+ `claude plugin update` exits 1 with `E404 No match found for version`.
25476
+ A rerun minutes later succeeds, so that is not a failure; any E404 the
25477
+ registry's own answer does not explain still is.
25478
+ """
25479
+ label = "update-registry-lag:"
25480
+ e404 = ('✘ Failed to update plugin "keel@keel-marketplace": Could not resolve @christang/keel@5.2.0 '
25481
+ "from the npm registry: E404 No match found for version 5.2.0")
25482
+ with tempfile.TemporaryDirectory(prefix="keel-update-421-", ignore_cleanup_errors=True) as raw:
25483
+ tmp = Path(raw)
25484
+ fake = tmp / "fake.js"
25485
+ write_text(fake, UPDATE_FAKE)
25486
+ launchers = {}
25487
+ for host in ("npm", "claude", "codex"):
25488
+ launcher = tmp / f"fake-{host}"
25489
+ write_text(launcher, f'#!/bin/sh\nFAKE_HOST={host} exec node "{fake}" "$@"\n')
25490
+ launcher.chmod(0o755)
25491
+ launchers[host] = launcher
25492
+ source = tmp / "codex-source"
25493
+ write_text(source / "hooks/codex.json", "{}\n")
25494
+
25495
+ def update(env_extra: dict[str, str]):
25496
+ log = tmp / "log.jsonl"
25497
+ state = tmp / "state.json"
25498
+ for stale in (log, state):
25499
+ if stale.exists():
25500
+ stale.unlink()
25501
+ log.write_text("")
25502
+ env = dict(os.environ)
25503
+ env.update({
25504
+ "KEEL_UPDATE_NPM": str(launchers["npm"]),
25505
+ "KEEL_UPDATE_CLAUDE": str(launchers["claude"]),
25506
+ "KEEL_UPDATE_CODEX": str(launchers["codex"]),
25507
+ "CODEX_HOME": str(tmp / "codex-home"),
25508
+ "FAKE_LOG": str(log), "FAKE_STATE": str(state),
25509
+ "FAKE_CODEX_SOURCE": str(source),
25510
+ "FAKE_FAIL_CLAUDE": "plugin update keel", "FAKE_FAIL_STDERR_CLAUDE": e404,
25511
+ })
25512
+ env.pop("KEEL_UPDATE_SOURCE", None)
25513
+ env.update(env_extra)
25514
+ result = subprocess.run(["node", str(ROOT / "bin/keel.js"), "--update"], cwd=tmp, env=env,
25515
+ text=True, capture_output=True, check=False, timeout=60)
25516
+ lines = {}
25517
+ for component in ("cli", "claude plugin", "codex plugin"):
25518
+ found = [l for l in result.stdout.splitlines() if l.startswith(f"keel update: {component}:")]
25519
+ lines[component] = found[0] if len(found) == 1 else ""
25520
+ return result, lines
25521
+
25522
+ result, lines = update({"FAKE_NPM_LATEST": "5.1.0"})
25523
+ claude = lines["claude plugin"]
25524
+ if not claude.startswith("keel update: claude plugin: pending"):
25525
+ report(f"{label} a version the registry does not serve yet was not reported pending: {claude!r}")
25526
+ return 1
25527
+ for needle in ("5.2.0", "5.1.0", "rerun keel --update", "few minutes"):
25528
+ if needle not in claude:
25529
+ report(f"{label} the pending Claude line does not name {needle!r}: {claude!r}")
25530
+ return 1
25531
+ if "failed" in claude:
25532
+ report(f"{label} the pending Claude line still reads failed: {claude!r}")
25533
+ return 1
25534
+ if "registry's latest here is 5.1.0" not in lines["cli"]:
25535
+ report(f"{label} the CLI line does not name 5.1.0 as the registry's latest: {lines['cli']!r}")
25536
+ return 1
25537
+ if "5.0.0 -> 5.1.0" not in lines["codex plugin"]:
25538
+ report(f"{label} the Codex line did not still update: {lines['codex plugin']!r}")
25539
+ return 1
25540
+ if result.returncode != 0:
25541
+ report(f"{label} a pending Claude plugin failed the update: exit={result.returncode} {result.stdout!r}")
25542
+ return 1
25543
+
25544
+ for case, env_extra in (("the registry serves 5.2.0", {"FAKE_NPM_LATEST": "5.2.0"}),
25545
+ ("npm view exits 1", {"FAKE_NPM_VIEW_EXIT": "1"})):
25546
+ result, lines = update(env_extra)
25547
+ claude = lines["claude plugin"]
25548
+ if not claude.startswith("keel update: claude plugin: failed"):
25549
+ report(f"{label} when {case}, the Claude line does not read failed: {claude!r}")
25550
+ return 1
25551
+ if "E404 No match found" not in claude:
25552
+ report(f"{label} when {case}, the failed Claude line does not carry the host's E404: {claude!r}")
25553
+ return 1
25554
+ if result.returncode == 0:
25555
+ report(f"{label} when {case}, the update exited 0: {result.stdout!r}")
25556
+ return 1
25557
+
25558
+ if "update-registry-lag" not in {name for name, _ in SCENARIOS}:
25559
+ report(f"{label} scenario is not registered.")
25560
+ return 1
25561
+ report("update-registry-lag scenario passed.")
25562
+ return 0
25563
+
25564
+
25458
25565
  OVERLAY_START_RE = re.compile(r"<!--\s*keel:openspec-surface-overlay version=([^ ]+) -->")
25459
25566
  OVERLAY_BLOCK_RE = re.compile(
25460
25567
  r"<!--\s*keel:openspec-surface-overlay(?:\s+[^>]*)?\s*-->[\s\S]*?"
@@ -40505,6 +40612,121 @@ def workflow_job_block(workflow: str, job: str) -> str:
40505
40612
  return match.group(1) if match else ""
40506
40613
 
40507
40614
 
40615
+ def registry_wait_problem(workflow: str) -> str | None:
40616
+ """Return why `publish.yml` would release before the registry serves it, or None.
40617
+
40618
+ Takes text so a planted copy can prove the rule fires (#421).
40619
+ """
40620
+ publish = workflow_job_block(workflow, "publish")
40621
+ steps = re.split(r"\n(?= - name: )", publish)
40622
+ names = [re.match(r"\s*- name: ([^\n]*)", step).group(1).strip() if re.match(r"\s*- name: ", step) else ""
40623
+ for step in steps]
40624
+ waits = [i for i, step in enumerate(steps) if "scripts/await_registry.js" in step]
40625
+ if not waits:
40626
+ return f"releases before the registry serves the version — {PUBLISH_WORKFLOW} never runs scripts/await_registry.js."
40627
+ if "Publish" not in names or "Tag and release the landed version" not in names:
40628
+ return f"{PUBLISH_WORKFLOW} has no `Publish` or no `Tag and release the landed version` step to order the wait between."
40629
+ wait = waits[0]
40630
+ if not names.index("Publish") < wait < names.index("Tag and release the landed version"):
40631
+ return ("releases before the registry serves the version — the scripts/await_registry.js step is not "
40632
+ "between `Publish` and `Tag and release the landed version`.")
40633
+ condition = re.search(r"^\s*if: ([^\n]*)", steps[names.index("Publish")], re.M)
40634
+ if not condition or f"if: {condition.group(1)}" not in steps[wait]:
40635
+ return "the registry wait does not share the `Publish` step's skip condition."
40636
+ if "steps.plan.outputs.version" not in steps[wait]:
40637
+ return "the registry wait does not wait for the planned version."
40638
+ return None
40639
+
40640
+
40641
+ AWAIT_NPM_FAKE = r"""const fs = require("fs");
40642
+ const count = process.env.FAKE_COUNT;
40643
+ const calls = (fs.existsSync(count) ? Number(fs.readFileSync(count, "utf8")) : 0) + 1;
40644
+ fs.writeFileSync(count, String(calls));
40645
+ fs.appendFileSync(process.env.FAKE_LOG, JSON.stringify(process.argv.slice(2)) + "\n");
40646
+ const after = process.env.FAKE_SERVE_AFTER;
40647
+ if (after === "never" || calls <= Number(after)) {
40648
+ process.stderr.write("npm error code E404\nnpm error 404 No match found for version 5.2.0\n");
40649
+ process.exit(1);
40650
+ }
40651
+ process.stdout.write("5.2.0\n");
40652
+ """
40653
+
40654
+
40655
+ def validate_publish_awaits_registry_scenario() -> int:
40656
+ """Issue #421: a release is created only once the registry serves it.
40657
+
40658
+ The release used to announce a version the registry's read side would not
40659
+ serve for minutes, and the first `keel --update` after it failed.
40660
+ """
40661
+ label = "publish-awaits-registry:"
40662
+ script = ROOT / "scripts/await_registry.js"
40663
+ if not script.is_file():
40664
+ report(f"{label} scripts/await_registry.js is missing.")
40665
+ return 1
40666
+ with tempfile.TemporaryDirectory(prefix="keel-await-421-", ignore_cleanup_errors=True) as raw:
40667
+ tmp = Path(raw)
40668
+ fake = tmp / "fake-npm.js"
40669
+ write_text(fake, AWAIT_NPM_FAKE)
40670
+ launcher = tmp / "fake-npm"
40671
+ write_text(launcher, f'#!/bin/sh\nexec node "{fake}" "$@"\n')
40672
+ launcher.chmod(0o755)
40673
+
40674
+ def wait(serve_after: str, *extra: str):
40675
+ count, log = tmp / "count", tmp / "log.jsonl"
40676
+ for stale in (count, log):
40677
+ if stale.exists():
40678
+ stale.unlink()
40679
+ log.write_text("")
40680
+ env = dict(os.environ)
40681
+ env.update({"KEEL_AWAIT_NPM": str(launcher), "FAKE_COUNT": str(count), "FAKE_LOG": str(log),
40682
+ "FAKE_SERVE_AFTER": serve_after})
40683
+ result = subprocess.run(["node", str(script), "@christang/keel", "5.2.0", "--interval-seconds", "0", *extra],
40684
+ cwd=tmp, env=env, text=True, capture_output=True, check=False, timeout=60)
40685
+ calls = [json.loads(line) for line in log.read_text().splitlines() if line.strip()]
40686
+ return result, calls
40687
+
40688
+ result, calls = wait("2")
40689
+ if result.returncode != 0 or len(calls) != 3:
40690
+ report(f"{label} a version served on the third poll did not end the wait after 3 polls with exit 0: "
40691
+ f"exit={result.returncode} polls={len(calls)} {result.stdout!r} {result.stderr!r}")
40692
+ return 1
40693
+ if calls[0][:3] != ["view", "@christang/keel@5.2.0", "version"]:
40694
+ report(f"{label} the wait did not ask npm for the exact version: {calls[0]!r}")
40695
+ return 1
40696
+
40697
+ result, calls = wait("never", "--timeout-seconds", "1")
40698
+ said = result.stdout + result.stderr
40699
+ if result.returncode == 0:
40700
+ report(f"{label} a version never served ended the wait with exit 0: {said!r}")
40701
+ return 1
40702
+ for needle in ("5.2.0", "1 s"):
40703
+ if needle not in said:
40704
+ report(f"{label} the timed-out wait does not name {needle!r}: {said!r}")
40705
+ return 1
40706
+
40707
+ workflow = (ROOT / PUBLISH_WORKFLOW).read_text(encoding="utf-8")
40708
+ problem = registry_wait_problem(workflow)
40709
+ if problem:
40710
+ report(f"{label} {problem}")
40711
+ return 1
40712
+ tag_step = workflow.find(" - name: Tag and release the landed version")
40713
+ wait_start = workflow.rfind(" - name: ", 0, workflow.find("scripts/await_registry.js"))
40714
+ wait_end = workflow.find("\n - name: ", wait_start + 1) + 1
40715
+ moved = workflow[:wait_start] + workflow[wait_end:] + workflow[wait_start:wait_end]
40716
+ if tag_step < 0:
40717
+ report(f"{label} {PUBLISH_WORKFLOW} has no `Tag and release the landed version` step to plant a copy against.")
40718
+ return 1
40719
+ if not registry_wait_problem(moved):
40720
+ report(f"{label} a planted copy with the wait moved after the tag step was not refused.")
40721
+ return 1
40722
+
40723
+ if "publish-awaits-registry" not in {name for name, _ in SCENARIOS}:
40724
+ report(f"{label} scenario is not registered.")
40725
+ return 1
40726
+ report("publish-awaits-registry scenario passed.")
40727
+ return 0
40728
+
40729
+
40508
40730
  def landing_problem(workflow: str) -> str | None:
40509
40731
  """Return the problem the landing path in `publish.yml` has, or None.
40510
40732
 
@@ -41550,9 +41772,11 @@ SCENARIOS: tuple = (
41550
41772
  ("update-claude-refresh-retry", validate_update_claude_refresh_retry_scenario),
41551
41773
  ("update-host-query-timeout", validate_update_host_query_timeout_scenario),
41552
41774
  ("update-codex-from-disk", validate_update_codex_from_disk_scenario),
41775
+ ("update-registry-lag", validate_update_registry_lag_scenario),
41553
41776
  ("refresh-covers-every-target", validate_refresh_covers_every_target_scenario),
41554
41777
  ("directory-branch-advances", validate_directory_branch_advances_scenario),
41555
41778
  ("release-notes-name-the-directory-branch", validate_release_notes_name_the_directory_branch_scenario),
41779
+ ("publish-awaits-registry", validate_publish_awaits_registry_scenario),
41556
41780
  ("directory-tree-is-the-package-renamed", validate_directory_tree_is_the_package_renamed_scenario),
41557
41781
  ("init-declares-plugin-auto-update", validate_init_declares_plugin_auto_update_scenario),
41558
41782
  ("context-names-the-protocol-refresh", validate_context_names_the_protocol_refresh_scenario),