@rightkit/release 0.2.64 → 0.2.65

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/build-release.mjs CHANGED
@@ -26,6 +26,7 @@ import { assertPrimaryReleaseCheckout, dirtyBuildInputs, resolveReleaseBuildInpu
26
26
  import { commandOutputPortable, releaseEnvironment, resolveReleaseLayout, runBuildStateMachine, verifySealedRelease, watchProgress } from "./release-state.mjs";
27
27
  import { acquireCacheLease, acquireSuiteBuildSlot, applyCachePrune, assertWriteVolumeFloors, inspectCache, inspectWriteVolumes, markCacheEntrySuccessful, planCachePrune, readCachePolicy, resolveCacheLayout, resolveSharedCacheIdentity, resolveSharedCacheRoot } from "./cache-policy.mjs";
28
28
  import { createTargetBridge } from "./target-bridge.mjs";
29
+ import { managedCargoShimOnPath } from "./cargo-contract.mjs";
29
30
  import { assertNsisInPlaceUpgradeContract } from "./nsis-upgrade-contract.mjs";
30
31
  import { buildPathPrefix, collectPreflight, formatPreflight, preflightFailures } from "./preflight.mjs";
31
32
  import { assertCleanSource } from "./source-gate.mjs";
@@ -167,7 +168,13 @@ try {
167
168
  if (signingIdentity) inputHashes[".right-release/signing-identity.json"] = hashFileText(JSON.stringify(signingIdentity));
168
169
  const cargoLock = requiredInputs.find((file) => /Cargo\.lock$/i.test(file));
169
170
  const cargoToml = requiredInputs.find((file) => /Cargo\.toml$/i.test(file));
170
- const managedCargoTarget = process.env.RIGHTKIT_BUILD_BROKER_SOCKET
171
+ // A broker-managed host is not identified by RIGHTKIT_BUILD_BROKER_SOCKET alone:
172
+ // that variable is exported by login shells only, while the managed cargo shim is
173
+ // on PATH for every shell. Detecting on the variable alone made agent (non-login)
174
+ // shells take the Cache V2 branch, bridge src-tauri/target into the release cache,
175
+ // and then lose CARGO_TARGET_DIR to the broker's unconditional override — so the
176
+ // app bundle landed in the broker workspace and packaging failed on an empty cache.
177
+ const managedCargoTarget = (process.env.RIGHTKIT_BUILD_BROKER_SOCKET || managedCargoShimOnPath(process.env))
171
178
  ? resolveManagedCargoTarget(cargoToml)
172
179
  : null;
173
180
  const cacheIdentity = resolveSharedCacheIdentity({ cargoLockPath: cargoLock, cargoTomlPath: cargoToml, rustcVerbose: toolVersions.rustc, targetTriple: target.cargoTarget ?? target.targetTriple ?? target.rustTarget ?? toolVersions.rustHost, profile: target.profile ?? "release" });
@@ -6,6 +6,7 @@ import { execFileSync, spawnSync } from "node:child_process";
6
6
  import test from "node:test";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { parseCpuSeconds, processGroupCpuSeconds } from "./process-liveness.mjs";
9
+ import { managedCargoShimOnPath } from "./cargo-contract.mjs";
9
10
 
10
11
  const source = readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), "build-release.mjs"), "utf8");
11
12
  const build = path.join(path.dirname(fileURLToPath(import.meta.url)), "build-release.mjs");
@@ -114,3 +115,56 @@ test("CPU sampling degrades to the old behaviour rather than inventing a verdict
114
115
  assert.equal(processGroupCpuSeconds(123, { platform: "darwin", run: () => ({ status: 1, stdout: "" }) }), null);
115
116
  assert.equal(processGroupCpuSeconds(123, { platform: "darwin", run: ok("") }), null);
116
117
  });
118
+
119
+ // Regression: the managed-host gate must not depend on RIGHTKIT_BUILD_BROKER_SOCKET
120
+ // alone. That variable is exported by login shells only, while the managed cargo
121
+ // shim is on PATH in every shell — so an agent shell took the Cache V2 branch,
122
+ // bridged src-tauri/target into the release cache, and then lost CARGO_TARGET_DIR
123
+ // to the broker's unconditional override. The app built into the broker workspace
124
+ // and packaging failed on an empty cache before notarize/staple.
125
+ const managedHostDetected = (env, platform, exists) =>
126
+ Boolean(env.RIGHTKIT_BUILD_BROKER_SOCKET || managedCargoShimOnPath(env, platform, exists));
127
+
128
+ test("managed-host gate fires from the managed shim on PATH when no broker socket is exported", () => {
129
+ // The build gate is exactly the dual detection cargo-contract.mjs already uses.
130
+ assert.match(
131
+ source,
132
+ /const managedCargoTarget = \(process\.env\.RIGHTKIT_BUILD_BROKER_SOCKET \|\| managedCargoShimOnPath\(process\.env\)\)\n\s*\? resolveManagedCargoTarget\(cargoToml\)\n\s*: null;/,
133
+ );
134
+ assert.match(source, /import \{ managedCargoShimOnPath \} from "\.\/cargo-contract\.mjs";/);
135
+
136
+ const shim = "/Volumes/D/.rightkit-managed/agent-bin/cargo";
137
+ const exists = (candidate) => candidate === shim;
138
+
139
+ // Agent (non-login) shell: no socket variable, managed shim first on PATH.
140
+ assert.equal(managedHostDetected({ PATH: `${path.dirname(shim)}:/usr/bin` }, "darwin", exists), true);
141
+ // Login shell: unchanged behaviour, with or without the shim resolvable.
142
+ assert.equal(
143
+ managedHostDetected({ PATH: `${path.dirname(shim)}:/usr/bin`, RIGHTKIT_BUILD_BROKER_SOCKET: "/managed/broker.sock" }, "darwin", exists),
144
+ true,
145
+ );
146
+ assert.equal(managedHostDetected({ PATH: "/usr/bin", RIGHTKIT_BUILD_BROKER_SOCKET: "/managed/broker.sock" }, "darwin", () => false), true);
147
+ // Unmanaged host: neither signal, so the Cache V2 branch still owns the build.
148
+ assert.equal(managedHostDetected({ PATH: "/usr/bin:/usr/local/bin" }, "darwin", () => false), false);
149
+ // PATH precedence still decides: an unmanaged toolchain ahead of the shim is unmanaged.
150
+ const both = new Set(["/usr/local/bin/cargo", shim]);
151
+ assert.equal(managedHostDetected({ PATH: `/usr/local/bin:${path.dirname(shim)}` }, "darwin", (c) => both.has(c)), false);
152
+ });
153
+
154
+ test("the managed branch hands the Rust target directory to the broker while the unmanaged branch keeps Cache V2", () => {
155
+ // Managed: CARGO_TARGET_DIR (and the rest of the Cache V2 environment) is deleted
156
+ // from the child environment, so the broker's own override is the only one.
157
+ assert.match(
158
+ source,
159
+ /if \(managedCargoTarget\) \{\n\s*for \(const name of \["CARGO_HOME", "CARGO_TARGET_DIR", "RUSTC_WRAPPER", "SCCACHE_DIR", "SCCACHE_BASEDIRS", "SCCACHE_CACHE_SIZE", "RUSTFLAGS"\]\) \{\n\s*delete env\[name\];/,
160
+ );
161
+ // Managed: no vault build root, and the bridge points at the metadata-reported target.
162
+ assert.match(source, /const buildRoot = managedCargoTarget \? null :/);
163
+ assert.match(source, /target: managedCargoTarget \?\? env\.CARGO_TARGET_DIR,/);
164
+ assert.match(source, /ownedRoot: path\.dirname\(managedCargoTarget \?\? env\.CARGO_TARGET_DIR\),/);
165
+ // The managed target is read from crate metadata through the shim, which is what
166
+ // makes the bridge target equal to the directory the broker actually builds into.
167
+ assert.match(source, /function resolveManagedCargoTarget\(manifestPath\)[\s\S]*?JSON\.parse\(output\)\.target_directory/);
168
+ // Unmanaged (managedCargoTarget === null): Cache V2 still supplies CARGO_TARGET_DIR.
169
+ assert.match(source, /\.\.\.releaseEnvironment\(\{ root: vaultRoot, cacheRoot: sharedCacheRoot,/);
170
+ });
package/deps.mjs CHANGED
File without changes
package/lsclean.sh CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.2.64",
3
+ "version": "0.2.65",
4
4
  "description": "Portable Right Suite release CLI/SDK: native-host signed installers, updater artifacts, hardening, immutable GitHub Release upload, and add-on adoption.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "type": "module",
@@ -15,11 +15,6 @@
15
15
  "*.py"
16
16
  ],
17
17
  "sideEffects": false,
18
- "scripts": {
19
- "test": "node --test *.test.mjs",
20
- "doctor:all": "node --test right-suite-contract.test.mjs",
21
- "verify:standalone": "node standalone-clone-verify.mjs"
22
- },
23
18
  "publishConfig": {
24
19
  "registry": "https://registry.npmjs.org/",
25
20
  "access": "public"
@@ -29,5 +24,9 @@
29
24
  "url": "git+https://github.com/bogusyogi/claude.git",
30
25
  "directory": "tools/rightkit/packages/release"
31
26
  },
32
- "packageManager": "pnpm@11.18.0"
33
- }
27
+ "scripts": {
28
+ "test": "node --test *.test.mjs",
29
+ "doctor:all": "node --test right-suite-contract.test.mjs",
30
+ "verify:standalone": "node standalone-clone-verify.mjs"
31
+ }
32
+ }
package/release.mjs CHANGED
File without changes
@@ -468,12 +468,12 @@ test("RightKit exposes one current version manifest", () => {
468
468
  "@rightkit/legal": "0.3.0",
469
469
  "@rightkit/legal-ui": "0.1.1",
470
470
  "@rightkit/license": "0.1.6",
471
- "@rightkit/release": "0.2.64",
471
+ "@rightkit/release": "0.2.65",
472
472
  "@rightkit/qa": "0.2.0",
473
473
  });
474
474
  assert.deepEqual(versions.legacyNpm, {
475
475
  "@rightkit/legal-ui": ["0.1.0"],
476
- "@rightkit/release": ["0.2.22", "0.2.29", "0.2.30", "0.2.31", "0.2.41", "0.2.42", "0.2.43", "0.2.44", "0.2.45", "0.2.46", "0.2.49", "0.2.50", "0.2.51", "0.2.53", "0.2.54", "0.2.55", "0.2.56", "0.2.61", "0.2.62", "0.2.63"],
476
+ "@rightkit/release": ["0.2.22", "0.2.29", "0.2.30", "0.2.31", "0.2.41", "0.2.42", "0.2.43", "0.2.44", "0.2.45", "0.2.46", "0.2.49", "0.2.50", "0.2.51", "0.2.53", "0.2.54", "0.2.55", "0.2.56", "0.2.61", "0.2.62", "0.2.63", "0.2.64"],
477
477
  "@rightkit/qa": ["0.1.0"],
478
478
  });
479
479
  assert.ok(
@@ -19,7 +19,7 @@
19
19
  "@rightkit/legal": "0.3.0",
20
20
  "@rightkit/legal-ui": "0.1.1",
21
21
  "@rightkit/license": "0.1.6",
22
- "@rightkit/release": "0.2.64",
22
+ "@rightkit/release": "0.2.65",
23
23
  "@rightkit/qa": "0.2.0"
24
24
  },
25
25
  "legacyNpm": {
@@ -46,7 +46,8 @@
46
46
  "0.2.56",
47
47
  "0.2.61",
48
48
  "0.2.62",
49
- "0.2.63"
49
+ "0.2.63",
50
+ "0.2.64"
50
51
  ],
51
52
  "@rightkit/qa": [
52
53
  "0.1.0"
package/upload-large.mjs CHANGED
File without changes