@tokenoftrust/cli 1.3.4-rc.0 → 1.3.4-rc.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/cli",
3
- "version": "1.3.4-rc.0",
3
+ "version": "1.3.4-rc.1",
4
4
  "description": "Token of Trust developer CLI — check out a tenant store, run it locally with save→reload, and submit it for preview. Installs the `tot` command.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Token of Trust",
@@ -425,12 +425,15 @@ export async function resolveRendererSource(args, { client } = {}) {
425
425
  * is keyed by version, upgrading the CLI busts the stale-runner cache automatically
426
426
  * (the 2026-07-14 "cached runner (prior tot dev)" staleness).
427
427
  *
428
- * GRACEFUL + SEQUENCING-SAFE: an explicit pin (`--renderer-version` / TOT_RUNNER_VERSION)
429
- * always wins. Otherwise we prefer the CLI-minor match, and FALL BACK to the `latest`
430
- * dist-tag when no aligned version is published yet so this is safe to ship BEFORE
431
- * the runner is republished at CLI-aligned versions (today runner=0.1.x, cli=1.2.x →
432
- * no 1.2 match falls back to latest). Once the coupled publish lands, the pin
433
- * activates on its own with no further code change.
428
+ * EXACT-FIRST (the CLI requests its OWN version): with lockstep publishing the runner
429
+ * is published at the SAME version as the CLI, so the exact match (step 2) is the normal
430
+ * path. An explicit pin (`--renderer-version` / TOT_RUNNER_VERSION) always wins. When no
431
+ * exact match exists we degrade ONLY DOWNWARD a runner at or below the CLI's major.minor
432
+ * (never ahead) and NEVER to a floating dist-tag like `latest` (a channel can point at a
433
+ * version this CLI doesn't expect; that floating-tag drift is the exact bug this avoids).
434
+ * The caller emits a LOUD skew warning whenever the resolved version isn't the exact CLI
435
+ * version, so a mismatch is visible, not silent. If nothing exact/minor/≤-ceiling is
436
+ * published, we THROW — a release gap to fix by publishing the aligned runner, not paper over.
434
437
  *
435
438
  * Pure (no I/O) for testability.
436
439
  * @param {any} meta npm packument (`dist-tags` + `versions`)
@@ -493,10 +496,12 @@ export function pickRunnerVersion(meta, { cliVersion, explicitPin }) {
493
496
  const version = capped[capped.length - 1];
494
497
  return { version, reason: `highest ≤ CLI major.minor ${cliMM ? `${cliMM.major}.${cliMM.minor}` : "?"}` };
495
498
  }
496
- // Last resort: `latest`, but ONLY if it doesn't breach the ceiling.
497
- if (distTags.latest && withinCeiling(distTags.latest)) {
498
- return { version: distTags.latest, reason: "fell back to latest (within CLI ceiling)" };
499
- }
499
+ // NO floating-tag last resort. We deliberately do NOT fall back to the `latest`
500
+ // dist-tag: a channel can drift behind/ahead of what THIS CLI expects (the exact
501
+ // failure mode that shipped stale CLIs see the copy-paste pin in the storefront
502
+ // cockpit). If nothing exact/minor/≤-ceiling is published, that's a release gap to
503
+ // fix by publishing the runner at the CLI's version — not something to paper over
504
+ // with whatever `latest` happens to point at.
500
505
  throw new Error(
501
506
  `no runner version at or below the CLI's major.minor (${cliMM ? `${cliMM.major}.${cliMM.minor}` : cliVersion})`,
502
507
  );
@@ -536,7 +541,17 @@ export async function resolvePublicRendererSource(args, env = process.env) {
536
541
  throw new Error(`npm metadata for ${pkg} failed: HTTP ${res.status} ${res.statusText}`);
537
542
  }
538
543
  const meta = await res.json();
539
- const { version } = pickRunnerVersion(meta, { cliVersion: CLI_VERSION, explicitPin });
544
+ const { version, reason } = pickRunnerVersion(meta, { cliVersion: CLI_VERSION, explicitPin });
545
+ // Exact is the goal (lockstep publish → runner@CLI_VERSION always present). If we
546
+ // resolved something ELSE, the versions are skewed — surface it LOUDLY instead of
547
+ // silently running a mismatched runner (the class of bug this whole change targets).
548
+ if (!explicitPin && version !== CLI_VERSION) {
549
+ console.warn(
550
+ ` ⚠ runner ${version} — no exact @${CLI_VERSION} published (${reason}). ` +
551
+ `CLI/runner versions are SKEWED; publish the runner at ${CLI_VERSION} to align ` +
552
+ `(or pin with --renderer-version to silence).`,
553
+ );
554
+ }
540
555
  const tarball = meta?.versions?.[version]?.dist?.tarball;
541
556
  if (!tarball) throw new Error(`no published ${pkg}@${version} on npm`);
542
557
  return { kind: "public", version, url: tarball, strip: 1, cacheKey: `public-${version}` };