@jr2/cli 0.2.1 → 0.4.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.
@@ -7,7 +7,8 @@
7
7
  // The one Instance verb that reads the Instance without asserting it: a Kit mismatch is a LINE here,
8
8
  // never the ADR-0056 refusal, because this is the verb you reach for when that refusal fires. Every
9
9
  // probe is best-effort and every answer is a report — exit 0 whatever it finds. Nothing here
10
- // computes what `jr2 up` computes: no bundle staging, no local content hash.
10
+ // computes what `jr2 up` computes: no Assembly staging, no local hash. The deployed hash is the
11
+ // current Assembly's, as the Orchestrator reports it on `/healthz` (ADR-0069).
11
12
  //
12
13
  // A REPORT verb, not a result verb: the human table goes to stdout, `--json` swaps in the one object.
13
14
 
@@ -16,7 +17,7 @@ import { parseArgs } from "node:util";
16
17
  import { IMAGES_CONFIGMAP, IMAGES_KEY, INSTANCE_SECRET, loadConfig, type ImageRefs } from "@jr2/orchestrator";
17
18
  import { detectKitCheckout, KIT_IMAGE_HOME } from "../build.ts";
18
19
  import type { InstanceIdentity } from "../client.ts";
19
- import { compareVersions, LABEL_HASH, LABEL_VERSION, OPERATOR_DEPLOYMENT, OPERATOR_NAMESPACE } from "../deploy.ts";
20
+ import { compareVersions, LABEL_VERSION, OPERATOR_DEPLOYMENT, OPERATOR_NAMESPACE } from "../deploy.ts";
20
21
  import { handedOffFrom } from "../handoff.ts";
21
22
  import { TARGET_ARGS, targetOptions, type TargetOptions } from "../instance.ts";
22
23
  import { checkKitVersion, CLI_ROOT, CLI_VERSION } from "../kit-version.ts";
@@ -28,7 +29,7 @@ import { findRoot } from "../root.ts";
28
29
  export type Copy = { version: string; path: string };
29
30
 
30
31
  /** The image map as `jr2 up` wrote it and pods read it (ADR-0038). */
31
- type Images = Partial<ImageRefs & { operator?: string }>;
32
+ type Images = Partial<ImageRefs & { operator?: string; orchestrator?: string }>;
32
33
 
33
34
  /** The comparison between the local kit line and the orchestrator line — the verdict the two
34
35
  * halves exist to produce. `unknown` when either side is missing. */
@@ -72,9 +73,10 @@ export type VersionReport = {
72
73
  skew?: Skew;
73
74
  };
74
75
 
75
- /** What the pod answers on `/healthz`, plus what the Deployment records — two facts, because a
76
- * rollout that has not landed leaves them disagreeing. Or why neither could be read. */
77
- type Orchestrator = { version?: string; hash?: string; deploymentHash?: string; image?: string } | { error: string };
76
+ /** What the pod answers on `/healthz` — its Kit version and the hash of its current Assembly
77
+ * (ADR-0069), absent while it holds none — plus the image the Deployment runs. Or why neither
78
+ * could be read. */
79
+ type Orchestrator = { version?: string; hash?: string; image?: string } | { error: string };
78
80
 
79
81
  export async function version(args: string[], io: Io): Promise<number> {
80
82
  const { values } = parseArgs({
@@ -191,7 +193,7 @@ async function probeCluster(io: Io, opts: TargetOptions, namespace: string): Pro
191
193
  }
192
194
 
193
195
  const orch = await admin.getJson({ kind: "deployment", name: ORCHESTRATOR_SERVICE, namespace, ...ctx });
194
- const recorded = { deploymentHash: orch?.metadata.labels?.[LABEL_HASH], image: firstImage(orch) };
196
+ const recorded = { image: firstImage(orch) };
195
197
  let fwd: { url: string; close: () => void } | undefined;
196
198
  try {
197
199
  fwd = await kube.portForward({ namespace, service: ORCHESTRATOR_SERVICE, port: ORCHESTRATOR_PORT, ...ctx });
@@ -289,10 +291,9 @@ function deployedRows(d: NonNullable<VersionReport["deployed"]>, r: VersionRepor
289
291
  else if ("error" in o) rows.push(["orchestrator", o.error]);
290
292
  else {
291
293
  const parts = [o.version ?? "(no version reported)"];
292
- if (o.hash) parts.push(`hash ${o.hash}`);
293
- if (o.deploymentHash && o.hash && o.deploymentHash !== o.hash) {
294
- parts.push(`(rollout incomplete: deployment records ${o.deploymentHash})`);
295
- }
294
+ // The current Assembly (ADR-0069). None is a state the Orchestrator serves in: volume loss, or
295
+ // a Kit image rolled before its first publish.
296
+ parts.push(o.hash ? `assembly ${o.hash}` : "no Assembly — `jr2 up` publishes");
296
297
  if (o.image) parts.push(o.image);
297
298
  rows.push(["orchestrator", parts.join(" ")]);
298
299
  }
@@ -301,7 +302,7 @@ function deployedRows(d: NonNullable<VersionReport["deployed"]>, r: VersionRepor
301
302
  }
302
303
  if (d.images) {
303
304
  if (d.images.harness) rows.push(["harness", d.images.harness]);
304
- if (d.images.adapter) rows.push(["adapter", d.images.adapter]);
305
+ if (d.images.custodian) rows.push(["custodian", d.images.custodian]);
305
306
  for (const [key, ref] of Object.entries(d.images.sandbox ?? {})) rows.push([`sandbox ${key}`, ref]);
306
307
  }
307
308
  const verdict = skewSentence(r);
@@ -323,7 +324,11 @@ function skewSentence(r: VersionReport): string | undefined {
323
324
  );
324
325
  case "same":
325
326
  return r.instance?.mode === "checkout"
326
- ? "same version; checkout builds are content-addressed — compare the hash against `jr2 up`'s line"
327
+ ? // A kit source edit moves the Kit image's ref and not the Assembly hash: the Assembly
328
+ // strips the Kit closure (ADR-0069). So the image is what shows kit skew here.
329
+ "same version; checkout builds are content-addressed — compare the orchestrator image against " +
330
+ "`jr2 up`'s `orchestrator image:` line for the kit, and the assembly hash against its `assembly:` " +
331
+ "line for the Instance"
327
332
  : undefined;
328
333
  default:
329
334
  return undefined;