shapeup-sdlc 3.7.8 → 3.7.9

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,7 +1,7 @@
1
1
  {
2
2
  "name": "shapeup-sdlc-plugin",
3
3
  "displayName": "ShapeUp SDLC Plugin",
4
- "version": "3.7.8",
4
+ "version": "3.7.9",
5
5
  "description": "Shape Up SDLC harness for Claude Code: shaping, intake, orient, scope-mapping, building (T0-verified, sandboxed, scope-contracted), evaluation and QA skills orchestrated by a tech-lead.",
6
6
  "author": {
7
7
  "name": "Liberty Nguyen",
package/README.md CHANGED
@@ -48,10 +48,12 @@ Two limits, stated here because the point of this section is that a claim withou
48
48
  behind it is the thing this harness exists to prevent: the **seesaw** regression arm is declared
49
49
  and not yet wired (no run writes its registry — wiring it is an open Betting Table decision), and
50
50
  the citation **re-hash** the kernel performs proves self-consistency, not provenance — the digest
51
- and the cited verdict are checked, the scope, round and run the artifact belongs to are not. A T0
52
- artifact is also evidence about the machine that produced it: it records the tree and nothing
53
- about the toolchain or caches the commands resolved through. All three are open items in
54
- `shapeup/knowledge-base/harness-defects.md`, not shipped guarantees.
51
+ and the cited verdict are checked, the scope, round and run the artifact belongs to are not. Both are
52
+ open items in `shapeup/knowledge-base/harness-defects.md`, not shipped guarantees. A T0 artifact is
53
+ also evidence about the machine that produced it, and now says so: each verdict carries where it
54
+ ran — the absolute path, the git tree, the resolved toolchain, lockfile digests, declared cache
55
+ directories and a digest over an allowlist of environment values — so a disagreeing re-run can be
56
+ told from a regression. That block measures and judges nothing.
55
57
  → *Prevents: "done" asserted with nothing behind it.*
56
58
 
57
59
  **3. Parallel work can't corrupt shared state.** Each scope gets a write-whitelist of files
@@ -65,6 +65,7 @@ import { parseBoard } from "../reduce/board.mjs";
65
65
  import { intake, harnessRun, wiringMap, projectProfile, scopesDir, resultsDir, ordersDir, orientDir, activeOrder, activeScope, usecasesDir, breadboard, receipt, readReceipt, requirements, exportRunDir, lastRun, readRunId, tasksDir, gates, verdictsDir, roundBuildDir } from "../lib/paths.mjs";
66
66
  import { evalVerdict } from "./eval.mjs";
67
67
  import { deriveRounds } from "./rounds.mjs";
68
+ import { stagedWorkflowDrift, driftWarning } from "./staged.mjs";
68
69
  import { collectRun, writeRun } from "../report/export.mjs";
69
70
 
70
71
  /** The run-state values `references/protocol.md` (Part 4 — State) defines. A typo'd status is a rejection,
@@ -445,9 +446,11 @@ export function nextPhase(f) {
445
446
  *
446
447
  * @param {string} cwd - Project root.
447
448
  * @param {string} slug - Feature slug.
449
+ * @param {object} [opts] - `pluginRoot`, when the caller knows where the plugin it is running from
450
+ * lives: the state then also reports whether the staged orchestrator is the installed one.
448
451
  * @returns {object} The ResumeState record (domain.schema.json $defs/ResumeState).
449
452
  */
450
- export function deriveResumeState(cwd, slug) {
453
+ export function deriveResumeState(cwd, slug, { pluginRoot = null } = {}) {
451
454
  const hrPath = harnessRun(cwd, slug);
452
455
  const hr = existsSync(hrPath) ? parseFrontmatter(readFileSync(hrPath, "utf8")) : {};
453
456
 
@@ -517,7 +520,22 @@ export function deriveResumeState(cwd, slug) {
517
520
  .map((f) => Number(f.match(/\d+/)[0]))
518
521
  .filter((n) => evalVerdict(cwd, slug, n).found),
519
522
  };
520
- return { ...facts, next_phase: nextPhase(facts) };
523
+ // WHICH ORCHESTRATOR THIS LAUNCH WILL RUN. A run keeps the workflow copy it opened with — right,
524
+ // and invisible: a relaunch after an upgrade executes the old one and reports normally, so every
525
+ // observation is of the previous release. Reported, never enforced (see probe/staged.mjs).
526
+ const staged = stagedWorkflowDrift(cwd, pluginRoot, slug);
527
+ const warning = driftWarning(staged);
528
+ return {
529
+ ...facts,
530
+ staged_workflow: {
531
+ checked: staged.checked,
532
+ drift: staged.drift.map((d) => d.file),
533
+ installed_version: staged.installed_version,
534
+ run_version: staged.run_version,
535
+ ...(warning ? { warning } : {}),
536
+ },
537
+ next_phase: nextPhase(facts),
538
+ };
521
539
  }
522
540
 
523
541
  /**
@@ -933,6 +951,9 @@ export const ARGV_SPEC = {
933
951
  // Not `--close`: the caller (shapeup-run.js's closeIfTerminal) hands over a RunReturn arm, never
934
952
  // a status it decided was terminal itself — RUN_RETURN_CLOSE/closeArm above make that call.
935
953
  "close-arm": { type: "str" },
954
+ // The launch hands its own plugin root so the state probe can say whether the orchestrator about
955
+ // to run is the installed one. Optional: a caller that does not know it gets `checked: false`.
956
+ "plugin-root": { type: "path" },
936
957
  cause: { type: "str" },
937
958
  };
938
959
 
@@ -1001,7 +1022,7 @@ export function cli(rawArgv) {
1001
1022
  process.exit(r.ok ? 0 : 3);
1002
1023
  }
1003
1024
 
1004
- console.log(JSON.stringify(deriveResumeState(cwd, args.slug)));
1025
+ console.log(JSON.stringify(deriveResumeState(cwd, args.slug, { pluginRoot: args.pluginRoot ?? null })));
1005
1026
  process.exit(0);
1006
1027
  }
1007
1028
 
@@ -0,0 +1,83 @@
1
+ // staged — is the orchestrator this launch will execute the one that is installed?
2
+ //
3
+ // A run stages its own copy of the workflow scripts into the local tier when it is OPENED, and
4
+ // keeps that copy for the run's life. That is deliberate and right: an upgrade must not swap the
5
+ // orchestrator under a run in flight. The consequence is not obvious from anywhere a person about
6
+ // to soak an upgrade would look — relaunching an existing run after installing a new version
7
+ // executes the OLD orchestrator, reports normally, closes normally, and every observation made of
8
+ // it is an observation of the previous release. That is worse than a failed soak: it is confident
9
+ // evidence about the wrong artifact.
10
+ //
11
+ // So the launch compares, and says so. A warning, never a block — the run keeping its copy is the
12
+ // correct behaviour, and the operator is the one who decides whether this run is the one they
13
+ // meant to measure.
14
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
15
+ import { join } from "node:path";
16
+ import { createHash } from "node:crypto";
17
+ import { workflowsStage, receipt, readReceipt } from "../lib/paths.mjs";
18
+
19
+ const sha256 = (buf) => createHash("sha256").update(buf).digest("hex");
20
+
21
+ /** A file's digest, or null when it cannot be read. */
22
+ function digestOf(path) {
23
+ try { return sha256(readFileSync(path)); } catch { return null; }
24
+ }
25
+
26
+ /** The version the plugin at `pluginRoot` declares, or null. */
27
+ export function installedPluginVersion(pluginRoot) {
28
+ if (!pluginRoot) return null;
29
+ try { return JSON.parse(readFileSync(join(pluginRoot, ".claude-plugin", "plugin.json"), "utf8")).version ?? null; }
30
+ catch { return null; }
31
+ }
32
+
33
+ /**
34
+ * How the orchestrator this launch will run compares with the one installed.
35
+ *
36
+ * @param {string} cwd - Project root.
37
+ * @param {(string|null)} pluginRoot - The installed plugin's root, as the launch knows it.
38
+ * @param {(string|null)} [slug] - The run, when the caller knows it — for the version the run opened under.
39
+ * @returns {object} `{checked, drift, staged_dir, plugin_root, installed_version, run_version}`.
40
+ * `drift` lists each script whose staged copy differs from the installed one; `checked: false`
41
+ * means the comparison could not be made (no plugin root, or nothing staged), which is not the
42
+ * same fact as "they agree" and is reported as itself.
43
+ */
44
+ export function stagedWorkflowDrift(cwd, pluginRoot, slug = null) {
45
+ const stagedDir = workflowsStage(cwd);
46
+ const srcDir = pluginRoot ? join(pluginRoot, "skills", "tech-lead", "workflows") : null;
47
+ const out = {
48
+ checked: false,
49
+ drift: [],
50
+ staged_dir: stagedDir,
51
+ plugin_root: pluginRoot ?? null,
52
+ installed_version: installedPluginVersion(pluginRoot),
53
+ run_version: slug ? (readReceipt(receipt(cwd, slug))?.plugin?.version ?? null) : null,
54
+ };
55
+ if (!srcDir || !existsSync(srcDir) || !existsSync(stagedDir)) return out;
56
+ let names;
57
+ try { names = readdirSync(stagedDir).filter((f) => f.endsWith(".js")).sort(); } catch { return out; }
58
+ if (!names.length) return out;
59
+ out.checked = true;
60
+ for (const f of names) {
61
+ const staged = digestOf(join(stagedDir, f));
62
+ const installed = digestOf(join(srcDir, f));
63
+ // A script the installed plugin no longer carries is drift too — the staged copy is running
64
+ // something that has no counterpart in what is installed.
65
+ if (staged !== installed) out.drift.push({ file: f, staged_sha256: staged, installed_sha256: installed });
66
+ }
67
+ return out;
68
+ }
69
+
70
+ /**
71
+ * The one-line warning a launch prints, or null when there is nothing to say.
72
+ * @param {object} d - A {@link stagedWorkflowDrift} result.
73
+ * @returns {(string|null)} Operator-facing text naming both versions.
74
+ */
75
+ export function driftWarning(d) {
76
+ if (!d?.checked || !d.drift.length) return null;
77
+ const versions = d.run_version && d.installed_version && d.run_version !== d.installed_version
78
+ ? ` The run opened under plugin ${d.run_version}; ${d.installed_version} is installed.`
79
+ : d.installed_version ? ` Installed plugin: ${d.installed_version}.` : "";
80
+ return `the orchestrator this launch runs is NOT the installed one — ${d.drift.length} staged script(s) differ `
81
+ + `(${d.drift.map((x) => x.file).join(", ")}).${versions} A run keeps the copy it opened with, by design, so this `
82
+ + `launch measures the release the run was opened under. Open a NEW run to soak an upgrade.`;
83
+ }
@@ -130,6 +130,11 @@ function t0Row(a, runId) {
130
130
  fixtures_green: a?.fixtures_green ?? null,
131
131
  db_probe_green: a?.db_probe_green ?? null,
132
132
  seesaw_green: a?.seesaw_green ?? null,
133
+ // One field a reader compares, and the block itself stays in the artifact for a human to diff:
134
+ // two rows with the same tree and different env digests are two machines, not a regression.
135
+ env_sha256: a?.env?.env_sha256 ?? null,
136
+ tree_head: a?.env?.tree?.head ?? null,
137
+ tree_dirty: a?.env?.tree?.dirty ?? null,
133
138
  fixtures_total: fixtures.length,
134
139
  fixtures_passed: fixtures.filter((f) => f?.pass === true).length,
135
140
  seesaw_ran: a?.seesaw?.ran ?? null,
@@ -1354,6 +1354,21 @@
1354
1354
  "$ref": "#/$defs/AegisTriple"
1355
1355
  },
1356
1356
  "description": "Populated only on red; feeds the next order."
1357
+ },
1358
+ "env": {
1359
+ "type": "object",
1360
+ "description": "Where the fixtures ran — host, cwd, git tree, resolved toolchain paths, lockfile digests, profile-declared cache dirs, and a digest over an allowlist of environment variable VALUES (names in the clear, values never stored). `env_sha256` digests the whole block, so a reader compares one field and a human diffs the rest: two verdicts with the same tree and different digests were measured on different machines, which is a fact about portability rather than a regression. Written by kernel/verify/env.mjs, which judges nothing — no field here makes a verdict green or red.",
1361
+ "properties": {
1362
+ "schema_version": { "const": 1 },
1363
+ "env_sha256": { "type": "string" },
1364
+ "host": { "type": "object", "description": "platform, arch, os_release, node, hostname_sha256 (hashed — equality is all a reader needs)." },
1365
+ "cwd": { "type": "string", "description": "Absolute: a path-keyed toolchain cache is identified by this." },
1366
+ "tree": { "type": "object", "description": "git head, branch, and a dirty flag — which says something differs, never what." },
1367
+ "toolchain": { "type": "array", "description": "Each invoked binary as written, and where it resolved on this machine (null when nothing resolved it)." },
1368
+ "lockfiles": { "type": "array", "description": "Digest per lockfile present at the root. Says what was declared, never what is installed." },
1369
+ "caches": { "type": ["array", "null"], "description": "Cache dirs the project profile declares, resolved. null means the profile declared none — NOT that there are none." },
1370
+ "env": { "type": "object", "description": "The allowlist of variable names, and one digest over their values." }
1371
+ }
1357
1372
  }
1358
1373
  }
1359
1374
  },
@@ -2652,6 +2667,17 @@
2652
2667
  "description": "ANALYZE finished: the spec folder's usecases/ carries at least one use case that is not _index.md. WIRE reads these — one wiring-map entry per use case — which is why ANALYZE precedes WIRE in the phase chain: dispatched against an empty spec folder, WIRE escalates on every launch."
2653
2668
  },
2654
2669
  "has_board": { "type": "boolean", "description": "The per-machine board (tasks/TASK-*.md) holds at least one task. ANALYZE is complete only with both the committed spec tree and this; a committed tree with no board resumes at analyze, where the board-only operation regenerates it." },
2670
+ "staged_workflow": {
2671
+ "type": "object",
2672
+ "description": "Whether the orchestrator this launch will execute is the installed one. A run stages its own copy of the workflow scripts when it is OPENED and keeps them for its life — right for a run in flight, and silent: relaunching after an upgrade executes the OLD orchestrator, reports normally, and every observation is of the previous release. `checked: false` means the comparison could not be made (no plugin root, nothing staged), which is not the same fact as agreement. A warning, never a block: opening a new run is how an upgrade is soaked.",
2673
+ "properties": {
2674
+ "checked": { "type": "boolean" },
2675
+ "drift": { "type": "array", "items": { "type": "string" }, "description": "Staged scripts whose bytes differ from the installed plugin's." },
2676
+ "installed_version": { "type": ["string", "null"] },
2677
+ "run_version": { "type": ["string", "null"], "description": "The plugin version the run's receipt records — what this run actually opened under." },
2678
+ "warning": { "type": "string" }
2679
+ }
2680
+ },
2655
2681
  "has_requirements": {
2656
2682
  "type": "boolean",
2657
2683
  "description": "The requirements registry is on disk: shapeup/<slug>/requirements.md exists. A PLAIN FACT, not a phase — the orchestrator guards its single `coverage` dispatch on this boolean, and it is deliberately absent from kernel/probe/resume.mjs's PHASE_ARTIFACT map, which doubles as nextPhase()'s ordered list: an entry there would fast-forward every run recorded before the registry existed to the registry instead of to build."
@@ -0,0 +1,180 @@
1
+ // env — the machine a T0 verdict was measured on.
2
+ //
3
+ // A T0 artifact records `exit 0`, `pass: true` and a captured tail, and the harness treats that as
4
+ // the fact a generator cannot fabricate. What it did not record is that the command's outcome
5
+ // depended on state outside the tree. Measured on a consumer whose toolchain resolves its build
6
+ // plugins through a cache keyed by the project's ABSOLUTE PATH: the working tree built green; a
7
+ // clone of the same commit at a different path failed on a registry 404; a clone with a
8
+ // hand-seeded cache compiled a different plugin set and produced two errors the original never
9
+ // saw. Three environments, three outcomes, one tree — and three byte-identical verdicts apart from
10
+ // their captured output.
11
+ //
12
+ // The consequence is not that such a project is badly configured; that is its own problem. It is
13
+ // that a green verdict is portable evidence in appearance only, and nothing in it said so. This
14
+ // module records enough about where a command ran that two machines disagreeing can be told from a
15
+ // regression. It measures and never judges: no field here makes a verdict green or red.
16
+ //
17
+ // WHAT IS DELIBERATELY NOT HERE. No wall clock — a duration is not an environment fact and invites
18
+ // comparing speeds across machines. No dependency-tree manifest — the lockfile digest plus the
19
+ // cache paths answer the decision this record exists for, and a manifest is unbounded. No raw
20
+ // environment values: variables are hashed, never stored, and only from a declared allowlist.
21
+ import { existsSync, readFileSync, statSync } from "node:fs";
22
+ import { join, resolve } from "node:path";
23
+ import { createHash } from "node:crypto";
24
+ import { spawnSync } from "node:child_process";
25
+ import { platform, arch, release, hostname } from "node:os";
26
+ import { splitFrontmatter } from "../lib/contract.mjs";
27
+
28
+ const sha256 = (t) => createHash("sha256").update(t).digest("hex");
29
+
30
+ /** Lockfiles worth digesting, by ecosystem. Bounded on purpose — a glob would walk the tree. */
31
+ export const LOCKFILES = [
32
+ "package-lock.json", "npm-shrinkwrap.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb",
33
+ "oh-package-lock.json5", "Podfile.lock", "Gemfile.lock", "Cargo.lock", "go.sum",
34
+ "poetry.lock", "Pipfile.lock", "composer.lock", "gradle.lockfile", "pubspec.lock",
35
+ ];
36
+
37
+ /**
38
+ * Environment variables whose VALUES are hashed into the fingerprint. Names are recorded in the
39
+ * clear; values never are. Kept short and reviewed — a wide allowlist is how a token ends up
40
+ * hashed into a record somebody later publishes.
41
+ */
42
+ export const ENV_ALLOWLIST = ["PATH", "NODE_ENV", "CI", "LANG", "TZ"];
43
+
44
+ /** What an unset variable hashes as — distinct from a variable set to the empty string. */
45
+ const UNSET = "<unset>";
46
+
47
+ /**
48
+ * The tokens a shell command actually invokes — one per `&&`/`;`/`||` segment, with `cd`, `env` and
49
+ * `VAR=value` prefixes stripped. Returns the token AS WRITTEN (`./scripts/t0-assemble.sh`,
50
+ * `/Applications/…/hvigorw`), because the resolved path is the signal a basename loses.
51
+ *
52
+ * @param {string} cmd - A shell command line.
53
+ * @returns {string[]} Invoked tokens, in order, without duplicates.
54
+ */
55
+ export function invokedTokens(cmd) {
56
+ const out = [];
57
+ for (const seg of String(cmd || "").split(/&&|;|\|\|/).map((s) => s.trim()).filter(Boolean)) {
58
+ if (seg.startsWith("cd ")) continue;
59
+ const tokens = seg.split(/\s+/).filter((t) => t && !/^[A-Za-z_][A-Za-z0-9_]*=/.test(t) && t !== "env" && t !== "cd");
60
+ if (tokens.length && !out.includes(tokens[0])) out.push(tokens[0]);
61
+ }
62
+ return out;
63
+ }
64
+
65
+ /** Where a token resolves on this machine, or null when nothing resolves it. */
66
+ function resolveBin(token, cwd) {
67
+ try {
68
+ const r = spawnSync(`command -v ${JSON.stringify(token)}`, { shell: true, cwd, encoding: "utf8", timeout: 10_000 });
69
+ const p = (r.stdout || "").trim().split("\n")[0];
70
+ return p || null;
71
+ } catch { return null; }
72
+ }
73
+
74
+ /** `git rev-parse HEAD` plus whether the tree is dirty. All null outside a repository. */
75
+ function treeState(cwd) {
76
+ const git = (args) => {
77
+ try {
78
+ const r = spawnSync("git", args, { cwd, encoding: "utf8", timeout: 20_000 });
79
+ return r.status === 0 ? (r.stdout || "").trim() : null;
80
+ } catch { return null; }
81
+ };
82
+ const head = git(["rev-parse", "HEAD"]);
83
+ if (head === null) return { head: null, dirty: null, branch: null };
84
+ const porcelain = git(["status", "--porcelain"]);
85
+ return {
86
+ head,
87
+ // A dirty flag says "something differs", never what — the honest limit of one boolean, and the
88
+ // reason `head` alone cannot call two measurements the same measurement.
89
+ dirty: porcelain === null ? null : porcelain.length > 0,
90
+ branch: git(["rev-parse", "--abbrev-ref", "HEAD"]),
91
+ };
92
+ }
93
+
94
+ /**
95
+ * Cache directories the project profile declares, resolved. A path-keyed cache is identified by its
96
+ * path, which is exactly the mechanism that made one tree build three ways.
97
+ *
98
+ * `null` means the profile declared nothing — NOT that there are none. "Not asked" and "none" are
99
+ * different facts, and collapsing them is the mistake the seesaw arm already makes elsewhere.
100
+ *
101
+ * @param {(string|null)} profilePath - `shapeup/<slug>/project-profile.md`, when the caller knows it.
102
+ * @returns {(object[]|null)} One entry per declared cache, or null when none is declared.
103
+ */
104
+ export function declaredCaches(profilePath) {
105
+ if (!profilePath || !existsSync(profilePath)) return null;
106
+ let meta;
107
+ try { meta = splitFrontmatter(readFileSync(profilePath, "utf8")).meta || {}; } catch { return null; }
108
+ const raw = meta.cache_dirs ?? meta.caches ?? null;
109
+ const list = Array.isArray(raw)
110
+ ? raw
111
+ : typeof raw === "string" && raw.trim() && raw.trim() !== "~"
112
+ ? raw.replace(/^\[|\]$/g, "").split(",").map((s) => s.trim().replace(/^["']|["']$/g, "")).filter(Boolean)
113
+ : null;
114
+ if (!list || !list.length) return null;
115
+ return list.map((p) => {
116
+ const path = p.startsWith("~") ? join(process.env.HOME || "", p.slice(1)) : p;
117
+ let mtime = null;
118
+ try { mtime = statSync(path).mtime.toISOString(); } catch { /* absent is a fact, not an error */ }
119
+ return { declared: p, path, exists: existsSync(path), mtime };
120
+ });
121
+ }
122
+
123
+ /**
124
+ * Stable JSON: object keys sorted at every depth, so a digest does not depend on insertion order.
125
+ * @param {*} value - Anything JSON-representable.
126
+ * @returns {string} The canonical form.
127
+ */
128
+ export function canonical(value) {
129
+ if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
130
+ if (value && typeof value === "object") {
131
+ return `{${Object.keys(value).sort().map((k) => `${JSON.stringify(k)}:${canonical(value[k])}`).join(",")}}`;
132
+ }
133
+ return JSON.stringify(value ?? null);
134
+ }
135
+
136
+ /**
137
+ * The environment block a T0 verdict carries.
138
+ *
139
+ * @param {string} rawCwd - The directory the fixtures ran in; resolved to an absolute path here.
140
+ * @param {object} [opts] - `commands` (the fixture command lines) and `profilePath`.
141
+ * @returns {object} `{schema_version, host, cwd, tree, toolchain, lockfiles, caches, env, env_sha256}`.
142
+ * `env_sha256` digests the block itself, so a reader compares one field and a human diffs the
143
+ * rest. Without the digest every consumer re-implements the comparison and they disagree, which
144
+ * is three key spaces for one id waiting to happen on a new record.
145
+ */
146
+ export function environmentFingerprint(rawCwd, { commands = [], profilePath = null } = {}) {
147
+ // ABSOLUTE, always. A caller that ran with `--cwd .` would otherwise record "." as the place —
148
+ // and the place is the whole point: the cache that made one tree build three ways is keyed by
149
+ // the project's absolute path.
150
+ const cwd = resolve(rawCwd || process.cwd());
151
+ const tokens = [...new Set(commands.flatMap((c) => invokedTokens(c)))];
152
+ const block = {
153
+ schema_version: 1,
154
+ host: {
155
+ platform: platform(),
156
+ arch: arch(),
157
+ os_release: release(),
158
+ node: process.version,
159
+ // Hashed: equality is all a reader needs, and a hostname names a person's laptop.
160
+ hostname_sha256: sha256(hostname()),
161
+ },
162
+ cwd,
163
+ tree: treeState(cwd),
164
+ toolchain: tokens.map((bin) => ({ bin, path: resolveBin(bin, cwd) })),
165
+ lockfiles: LOCKFILES
166
+ .filter((f) => existsSync(join(cwd, f)))
167
+ .map((f) => {
168
+ try { return { file: f, sha256: sha256(readFileSync(join(cwd, f))) }; }
169
+ catch { return { file: f, sha256: null }; }
170
+ }),
171
+ caches: declaredCaches(profilePath),
172
+ env: {
173
+ allowlist: ENV_ALLOWLIST,
174
+ // One digest over the allowlisted names AND values: a PATH that changed shows up, and no
175
+ // value is stored.
176
+ sha256: sha256(ENV_ALLOWLIST.map((k) => `${k}=${process.env[k] ?? UNSET}`).join("\n")),
177
+ },
178
+ };
179
+ return { ...block, env_sha256: sha256(canonical(block)) };
180
+ }
@@ -40,10 +40,11 @@ import { join, dirname } from "node:path";
40
40
  import { spawnSync } from "node:child_process";
41
41
  import { createHash } from "node:crypto";
42
42
  import { digest } from "../probe/digest.mjs";
43
+ import { environmentFingerprint } from "./env.mjs";
43
44
  import { runArgs } from "../lib/argv.mjs";
44
45
  import { snapshot, restore, keptRef } from "./ratchet-tree.mjs";
45
46
  import { readContract, SCOPE_CONTRACT } from "../lib/contract.mjs";
46
- import { runIdFromRoot, localRoot, SHARED } from "../lib/paths.mjs";
47
+ import { runIdFromRoot, localRoot, SHARED, projectProfile } from "../lib/paths.mjs";
47
48
 
48
49
  /**
49
50
  * The feature slug a scope contract belongs to, from its path.
@@ -576,6 +577,14 @@ export async function cli(rawArgv) {
576
577
  const { path, sha256: hash, trial } = writeArtifact(outDir, round, attempt, {
577
578
  ...(runId ? { run_id: runId } : {}),
578
579
  scope_id: contract.scope_id,
580
+ // WHERE IT RAN, beside what it measured. A verdict that records only the tree is portable
581
+ // evidence in appearance only: the same commit built three ways on three machines because the
582
+ // toolchain resolved through a path-keyed cache. This block does not judge — it is what lets a
583
+ // disagreeing re-run be told from a regression (see verify/env.mjs).
584
+ env: environmentFingerprint(cwd, {
585
+ commands: [...fixtures.results.map((r) => r.cmd), ...(dbProbe?.cmd ? [dbProbe.cmd] : [])],
586
+ profilePath: projectProfile(cwd, slugFromContractPath(contractPath)),
587
+ }),
579
588
  // The evidence, not just the score — see `commandEvidence` for what the three-field record
580
589
  // could not tell apart, and why `exit` still reads the way it always did.
581
590
  fixtures: fixtures.results.map((r) => commandEvidence(r)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shapeup-sdlc",
3
- "version": "3.7.8",
3
+ "version": "3.7.9",
4
4
  "description": "Shape Up for coding agents \u2014 with gates the agent can't talk its way past. Harness for Claude Code.",
5
5
  "bin": {
6
6
  "shapeup-sdlc": "bin/init.mjs"
@@ -414,6 +414,16 @@ const RESUME = {
414
414
  has_orient_artifacts: { type: "boolean" },
415
415
  has_spec_tree: { type: "boolean" },
416
416
  has_board: { type: "boolean" },
417
+ staged_workflow: {
418
+ type: "object",
419
+ properties: {
420
+ checked: { type: "boolean" },
421
+ drift: { type: "array", items: { type: "string" } },
422
+ installed_version: nullable("string"),
423
+ run_version: nullable("string"),
424
+ warning: { type: "string" },
425
+ },
426
+ },
417
427
  // The requirements registry — a fact, not a phase. See the COVERAGE block below for why it is
418
428
  // guarded on this bare boolean and never asked about through `probe resume --require`.
419
429
  has_requirements: { type: "boolean" },
@@ -1232,7 +1242,14 @@ if (launchRecordAbort) return await withWarnings(launchRecordAbort);
1232
1242
 
1233
1243
  phase("Orient");
1234
1244
 
1235
- const rs = await query(`probe resume --slug ${slug}`, RESUME, "Orient", "resume-state");
1245
+ const rs = await query(`probe resume --slug ${slug} --plugin-root "${args.pluginRoot}"`, RESUME, "Orient", "resume-state");
1246
+ // WHICH ORCHESTRATOR IS RUNNING. A run keeps the workflow copy it opened with — correct for a run
1247
+ // in flight, and silent: a relaunch after an upgrade executes the old script, reports normally and
1248
+ // closes normally, so every observation is of the previous release. Said out loud, never enforced.
1249
+ if (rs.staged_workflow?.warning) {
1250
+ log(`RUN STATE — ${rs.staged_workflow.warning}`);
1251
+ stateWarnings.push(rs.staged_workflow.warning);
1252
+ }
1236
1253
  // A probe that produced nothing is not an EMPTY run — it is an unknown one. Treating it as empty
1237
1254
  // would re-dispatch every phase from the top, over a run that may be in progress.
1238
1255
  if (!rs) {