@superblocksteam/sdk 2.0.123 → 2.0.124-next.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.
Files changed (115) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/cli-replacement/automatic-upgrades.d.ts +37 -1
  3. package/dist/cli-replacement/automatic-upgrades.d.ts.map +1 -1
  4. package/dist/cli-replacement/automatic-upgrades.js +162 -10
  5. package/dist/cli-replacement/automatic-upgrades.js.map +1 -1
  6. package/dist/cli-replacement/automatic-upgrades.test.js +377 -8
  7. package/dist/cli-replacement/automatic-upgrades.test.js.map +1 -1
  8. package/dist/cli-replacement/dependency-install-classifier.d.mts +21 -0
  9. package/dist/cli-replacement/dependency-install-classifier.d.mts.map +1 -0
  10. package/dist/cli-replacement/dependency-install-classifier.mjs +83 -0
  11. package/dist/cli-replacement/dependency-install-classifier.mjs.map +1 -0
  12. package/dist/cli-replacement/dependency-install-classifier.test.d.mts +2 -0
  13. package/dist/cli-replacement/dependency-install-classifier.test.d.mts.map +1 -0
  14. package/dist/cli-replacement/dependency-install-classifier.test.mjs +51 -0
  15. package/dist/cli-replacement/dependency-install-classifier.test.mjs.map +1 -0
  16. package/dist/cli-replacement/dev-s3-restore.test.mjs +170 -14
  17. package/dist/cli-replacement/dev-s3-restore.test.mjs.map +1 -1
  18. package/dist/cli-replacement/dev-startup-git-before-dbfs-order.test.mjs +33 -2
  19. package/dist/cli-replacement/dev-startup-git-before-dbfs-order.test.mjs.map +1 -1
  20. package/dist/cli-replacement/dev-token-priming.test.d.mts +31 -0
  21. package/dist/cli-replacement/dev-token-priming.test.d.mts.map +1 -0
  22. package/dist/cli-replacement/dev-token-priming.test.mjs +87 -0
  23. package/dist/cli-replacement/dev-token-priming.test.mjs.map +1 -0
  24. package/dist/cli-replacement/dev.d.mts +36 -0
  25. package/dist/cli-replacement/dev.d.mts.map +1 -1
  26. package/dist/cli-replacement/dev.interception.test.d.mts +2 -0
  27. package/dist/cli-replacement/dev.interception.test.d.mts.map +1 -0
  28. package/dist/cli-replacement/dev.interception.test.mjs +68 -0
  29. package/dist/cli-replacement/dev.interception.test.mjs.map +1 -0
  30. package/dist/cli-replacement/dev.mjs +396 -62
  31. package/dist/cli-replacement/dev.mjs.map +1 -1
  32. package/dist/cli-replacement/home-npmrc.d.mts +180 -0
  33. package/dist/cli-replacement/home-npmrc.d.mts.map +1 -0
  34. package/dist/cli-replacement/home-npmrc.mjs +283 -0
  35. package/dist/cli-replacement/home-npmrc.mjs.map +1 -0
  36. package/dist/cli-replacement/home-npmrc.test.d.mts +10 -0
  37. package/dist/cli-replacement/home-npmrc.test.d.mts.map +1 -0
  38. package/dist/cli-replacement/home-npmrc.test.mjs +582 -0
  39. package/dist/cli-replacement/home-npmrc.test.mjs.map +1 -0
  40. package/dist/cli-replacement/install-packages.classify.test.d.mts +2 -0
  41. package/dist/cli-replacement/install-packages.classify.test.d.mts.map +1 -0
  42. package/dist/cli-replacement/install-packages.classify.test.mjs +125 -0
  43. package/dist/cli-replacement/install-packages.classify.test.mjs.map +1 -0
  44. package/dist/cli-replacement/install-packages.npm-registry.test.d.mts +2 -0
  45. package/dist/cli-replacement/install-packages.npm-registry.test.d.mts.map +1 -0
  46. package/dist/cli-replacement/install-packages.npm-registry.test.mjs +260 -0
  47. package/dist/cli-replacement/install-packages.npm-registry.test.mjs.map +1 -0
  48. package/dist/cli-replacement/post-upgrade-lockfile-strip.d.mts +58 -0
  49. package/dist/cli-replacement/post-upgrade-lockfile-strip.d.mts.map +1 -0
  50. package/dist/cli-replacement/post-upgrade-lockfile-strip.mjs +224 -0
  51. package/dist/cli-replacement/post-upgrade-lockfile-strip.mjs.map +1 -0
  52. package/dist/cli-replacement/post-upgrade-lockfile-strip.test.d.mts +11 -0
  53. package/dist/cli-replacement/post-upgrade-lockfile-strip.test.d.mts.map +1 -0
  54. package/dist/cli-replacement/post-upgrade-lockfile-strip.test.mjs +317 -0
  55. package/dist/cli-replacement/post-upgrade-lockfile-strip.test.mjs.map +1 -0
  56. package/dist/cli-replacement/userconfig-env.integration.test.d.mts +26 -0
  57. package/dist/cli-replacement/userconfig-env.integration.test.d.mts.map +1 -0
  58. package/dist/cli-replacement/userconfig-env.integration.test.mjs +148 -0
  59. package/dist/cli-replacement/userconfig-env.integration.test.mjs.map +1 -0
  60. package/dist/dev-utils/dev-server-metrics.d.mts +25 -0
  61. package/dist/dev-utils/dev-server-metrics.d.mts.map +1 -1
  62. package/dist/dev-utils/dev-server-metrics.mjs +84 -0
  63. package/dist/dev-utils/dev-server-metrics.mjs.map +1 -1
  64. package/dist/dev-utils/dev-server-metrics.test.d.mts +2 -0
  65. package/dist/dev-utils/dev-server-metrics.test.d.mts.map +1 -0
  66. package/dist/dev-utils/dev-server-metrics.test.mjs +26 -0
  67. package/dist/dev-utils/dev-server-metrics.test.mjs.map +1 -0
  68. package/dist/dev-utils/dev-server.d.mts +23 -1
  69. package/dist/dev-utils/dev-server.d.mts.map +1 -1
  70. package/dist/dev-utils/dev-server.mjs +21 -9
  71. package/dist/dev-utils/dev-server.mjs.map +1 -1
  72. package/dist/dev-utils/dev-server.status.test.d.mts +2 -0
  73. package/dist/dev-utils/dev-server.status.test.d.mts.map +1 -0
  74. package/dist/dev-utils/dev-server.status.test.mjs +41 -0
  75. package/dist/dev-utils/dev-server.status.test.mjs.map +1 -0
  76. package/dist/dev-utils/token-manager.d.ts +31 -0
  77. package/dist/dev-utils/token-manager.d.ts.map +1 -1
  78. package/dist/dev-utils/token-manager.js +34 -0
  79. package/dist/dev-utils/token-manager.js.map +1 -1
  80. package/dist/telemetry/local-obs.js +1 -1
  81. package/dist/telemetry/local-obs.js.map +1 -1
  82. package/dist/telemetry/util.js +1 -1
  83. package/dist/types/scoped-jwt-token-payload.d.ts +1 -0
  84. package/dist/types/scoped-jwt-token-payload.d.ts.map +1 -1
  85. package/dist/version-control.d.mts.map +1 -1
  86. package/dist/version-control.mjs +6 -7
  87. package/dist/version-control.mjs.map +1 -1
  88. package/package.json +12 -12
  89. package/src/cli-replacement/automatic-upgrades.test.ts +530 -8
  90. package/src/cli-replacement/automatic-upgrades.ts +179 -7
  91. package/src/cli-replacement/dependency-install-classifier.mts +118 -0
  92. package/src/cli-replacement/dependency-install-classifier.test.mts +72 -0
  93. package/src/cli-replacement/dev-s3-restore.test.mts +210 -14
  94. package/src/cli-replacement/dev-startup-git-before-dbfs-order.test.mts +35 -2
  95. package/src/cli-replacement/dev-token-priming.test.mts +103 -0
  96. package/src/cli-replacement/dev.interception.test.mts +80 -0
  97. package/src/cli-replacement/dev.mts +495 -92
  98. package/src/cli-replacement/home-npmrc.mts +409 -0
  99. package/src/cli-replacement/home-npmrc.test.mts +757 -0
  100. package/src/cli-replacement/install-packages.classify.test.mts +168 -0
  101. package/src/cli-replacement/install-packages.npm-registry.test.mts +345 -0
  102. package/src/cli-replacement/post-upgrade-lockfile-strip.mts +296 -0
  103. package/src/cli-replacement/post-upgrade-lockfile-strip.test.mts +482 -0
  104. package/src/cli-replacement/userconfig-env.integration.test.mts +189 -0
  105. package/src/dev-utils/dev-server-metrics.mts +96 -0
  106. package/src/dev-utils/dev-server-metrics.test.mts +38 -0
  107. package/src/dev-utils/dev-server.mts +48 -8
  108. package/src/dev-utils/dev-server.status.test.mts +58 -0
  109. package/src/dev-utils/token-manager.ts +36 -0
  110. package/src/telemetry/local-obs.ts +1 -1
  111. package/src/telemetry/util.ts +1 -1
  112. package/src/types/scoped-jwt-token-payload.ts +1 -0
  113. package/src/version-control.mts +8 -6
  114. package/tsconfig.tsbuildinfo +1 -1
  115. package/.turbo/turbo-publish-package.log +0 -0
@@ -0,0 +1,224 @@
1
+ /**
2
+ * Post-CLI-upgrade lockfile normalization for the dev-server pod's globally
3
+ * installed Superblocks CLI.
4
+ *
5
+ * npm honors `resolved` URLs verbatim, so a tarball whose bundled lockfile
6
+ * entries point at `registry.npmjs.org` keeps fetching from public npm even
7
+ * after we've written a private `.npmrc`. This module strips those URLs
8
+ * post-upgrade so subsequent installs re-resolve through the active registry.
9
+ *
10
+ * The walk from the resolved `superblocks` binary up to the CLI package root
11
+ * is bounded so a misconfigured layout can never mutate arbitrary lockfiles
12
+ * on the filesystem.
13
+ *
14
+ * All failures are logged and swallowed — a failed post-strip must not crash
15
+ * the pod after a working upgrade. The next dev startup repeats the strip
16
+ * idempotently.
17
+ */
18
+ import * as child_process from "node:child_process";
19
+ import fs from "node:fs/promises";
20
+ import * as path from "node:path";
21
+ import { promisify } from "node:util";
22
+ import { stripResolvedFromLockfile, stripResolvedFromLockfilePath, } from "@superblocksteam/vite-plugin-file-sync/npm-registry";
23
+ import { getErrorMeta } from "../telemetry/logging.js";
24
+ const exec = promisify(child_process.exec);
25
+ const LOG_PREFIX = "[post-upgrade-lockfile-strip]";
26
+ /**
27
+ * Upper bound on the post-upgrade strip. The I/O is local and small, but the
28
+ * CLI install can live on a network-mounted prefix (custom `npm prefix`,
29
+ * Volta cache, etc.) where a hung `fs.realpath` or `fs.readFile` would
30
+ * otherwise extend `cliUpgradePromise` and block dev-server startup. A
31
+ * timeout keeps the boot path bounded; the underlying I/O is left to settle
32
+ * in the background since every step is idempotent and individually error-
33
+ * swallowing.
34
+ */
35
+ const STRIP_TIMEOUT_MS = 5_000;
36
+ /**
37
+ * Upper bound on `package.json` lookups when walking up from the resolved
38
+ * `superblocks` binary. The expected path depth is 3 levels
39
+ * (`<prefix>/lib/node_modules/@superblocksteam/cli/bin/run.js` ->
40
+ * `<prefix>/lib/node_modules/@superblocksteam/cli`); 8 leaves headroom for
41
+ * non-standard layouts (Volta, nvm, custom prefixes) without ever climbing
42
+ * out of the install tree.
43
+ */
44
+ const MAX_PACKAGE_ROOT_WALK_DEPTH = 8;
45
+ // Both names are valid CLI install roots: `cli-ephemeral` is the alias used
46
+ // for snapshot builds (see the alias detection in `version-detection.ts`),
47
+ // and either may appear in the global install depending on which channel the
48
+ // pod was provisioned against.
49
+ const CLI_PACKAGE_NAMES = new Set([
50
+ "@superblocksteam/cli",
51
+ "@superblocksteam/cli-ephemeral",
52
+ ]);
53
+ const defaultWhichRunner = async (binary) => {
54
+ const cmd = process.platform === "win32" ? "where" : "which";
55
+ const { stdout } = await exec(`${cmd} ${binary}`);
56
+ return stdout;
57
+ };
58
+ /**
59
+ * Discovers the absolute path of the `@superblocksteam/cli` install root
60
+ * (the directory containing the CLI's `package.json`), or returns `undefined`
61
+ * if discovery fails. Discovery failures are non-fatal — the caller logs and
62
+ * skips the strip rather than aborting.
63
+ */
64
+ export async function findGlobalCliInstallDir(logger, whichRunner = defaultWhichRunner) {
65
+ let binStdout;
66
+ try {
67
+ binStdout = await whichRunner("superblocks");
68
+ }
69
+ catch (error) {
70
+ logger.warn(`${LOG_PREFIX} which/where superblocks failed; skipping strip`, {
71
+ ...getErrorMeta(error),
72
+ });
73
+ return undefined;
74
+ }
75
+ // `which`/`where` may emit multiple lines (e.g. shim + real path on
76
+ // Windows). The first line wins; matches the existing pattern in
77
+ // `version-detection.ts`.
78
+ const binPath = binStdout.trim().split(/\r?\n/)[0]?.trim();
79
+ if (!binPath) {
80
+ logger.warn(`${LOG_PREFIX} superblocks binary not found in PATH; skipping strip`);
81
+ return undefined;
82
+ }
83
+ let realBinPath;
84
+ try {
85
+ realBinPath = await fs.realpath(binPath);
86
+ }
87
+ catch (error) {
88
+ logger.warn(`${LOG_PREFIX} realpath failed for superblocks binary; skipping strip`, {
89
+ binPath,
90
+ ...getErrorMeta(error),
91
+ });
92
+ return undefined;
93
+ }
94
+ let dir = path.dirname(realBinPath);
95
+ for (let i = 0; i < MAX_PACKAGE_ROOT_WALK_DEPTH; i++) {
96
+ const candidate = path.join(dir, "package.json");
97
+ let raw;
98
+ try {
99
+ raw = await fs.readFile(candidate, "utf-8");
100
+ }
101
+ catch (error) {
102
+ const code = error?.code;
103
+ if (code === "ENOENT") {
104
+ const parent = path.dirname(dir);
105
+ if (parent === dir) {
106
+ break;
107
+ }
108
+ dir = parent;
109
+ continue;
110
+ }
111
+ logger.warn(`${LOG_PREFIX} failed to read candidate package.json; skipping strip`, {
112
+ candidate,
113
+ code,
114
+ ...getErrorMeta(error),
115
+ });
116
+ return undefined;
117
+ }
118
+ let parsed;
119
+ try {
120
+ parsed = JSON.parse(raw);
121
+ }
122
+ catch (error) {
123
+ logger.warn(`${LOG_PREFIX} candidate package.json is not valid JSON; skipping strip`, {
124
+ candidate,
125
+ ...getErrorMeta(error),
126
+ });
127
+ return undefined;
128
+ }
129
+ if (typeof parsed.name === "string" && CLI_PACKAGE_NAMES.has(parsed.name)) {
130
+ return dir;
131
+ }
132
+ // Found a `package.json` that isn't the CLI's — keep walking up. Some
133
+ // layouts (oclif's update channel) nest the binary under a wrapper
134
+ // package; we don't want to bail on the first unrelated manifest.
135
+ const parent = path.dirname(dir);
136
+ if (parent === dir) {
137
+ break;
138
+ }
139
+ dir = parent;
140
+ }
141
+ logger.warn(`${LOG_PREFIX} could not locate @superblocksteam/cli install root; skipping strip`, {
142
+ startedAt: realBinPath,
143
+ });
144
+ return undefined;
145
+ }
146
+ /**
147
+ * Strips public-host `resolved` URLs from every lockfile under the global
148
+ * CLI install that the auto-upgrade could have refreshed. Returns the
149
+ * resolved install root on success, or `undefined` when discovery failed.
150
+ *
151
+ * Non-fatal: every individual strip already swallows lockfile-level errors
152
+ * (logged in `stripResolvedFromLockfilePath`); this wrapper additionally
153
+ * swallows discovery failures and any unexpected throw from the inner
154
+ * helpers so a successful upgrade is never demoted to a crash by a post-step
155
+ * problem.
156
+ */
157
+ export async function stripUpgradedCliLockfiles(logger, options = {}) {
158
+ const installDir = options.installDir ??
159
+ (await findGlobalCliInstallDir(logger, options.whichRunner));
160
+ if (!installDir) {
161
+ return {};
162
+ }
163
+ const timeoutMs = options.timeoutMs ?? STRIP_TIMEOUT_MS;
164
+ const start = Date.now();
165
+ // The hidden lockfile listing the CLI itself lives two levels up from
166
+ // installDir under the npm-global layout
167
+ // (<prefix>/lib/node_modules/.package-lock.json).
168
+ const globalHiddenLockfile = path.join(path.dirname(path.dirname(installDir)), ".package-lock.json");
169
+ const STRIP_TIMED_OUT = Symbol("STRIP_TIMED_OUT");
170
+ let timeoutHandle;
171
+ const timeoutPromise = new Promise((resolve) => {
172
+ timeoutHandle = setTimeout(() => resolve(STRIP_TIMED_OUT), timeoutMs);
173
+ });
174
+ try {
175
+ const stripWork = Promise.all([
176
+ stripResolvedFromLockfile(installDir),
177
+ stripResolvedFromLockfilePath(globalHiddenLockfile),
178
+ ]);
179
+ const outcome = await Promise.race([stripWork, timeoutPromise]);
180
+ if (outcome === STRIP_TIMED_OUT) {
181
+ logger.warn(`${LOG_PREFIX} strip exceeded timeout; continuing without waiting`, {
182
+ installDir,
183
+ timeoutMs,
184
+ elapsedMs: Date.now() - start,
185
+ });
186
+ // We're abandoning `stripWork` after the timeout won the race. The
187
+ // inner helpers swallow per-file errors, but their atomic `writeFile`
188
+ // / `rename` calls can still throw (EACCES, EXDEV, ENOSPC, …) — and
189
+ // with no subscriber left on `stripWork`, a late rejection would
190
+ // surface as an unhandled rejection and crash the pod under Node's
191
+ // default policy. Attach a tail handler to keep the post-step
192
+ // non-fatal even when the timeout path is taken.
193
+ stripWork.catch((error) => {
194
+ logger.warn(`${LOG_PREFIX} background strip rejected after timeout; ignoring`, {
195
+ ...getErrorMeta(error),
196
+ installDir,
197
+ });
198
+ });
199
+ }
200
+ else {
201
+ logger.info(`${LOG_PREFIX} stripped resolved URLs from upgraded CLI lockfiles`, {
202
+ installDir,
203
+ elapsedMs: Date.now() - start,
204
+ });
205
+ }
206
+ }
207
+ catch (error) {
208
+ // The lower-level helpers already swallow per-file errors; this catches
209
+ // any unexpected throw so a post-step problem never surfaces as a failed
210
+ // upgrade.
211
+ logger.warn(`${LOG_PREFIX} unexpected error during strip; continuing`, {
212
+ ...getErrorMeta(error),
213
+ installDir,
214
+ elapsedMs: Date.now() - start,
215
+ });
216
+ }
217
+ finally {
218
+ if (timeoutHandle) {
219
+ clearTimeout(timeoutHandle);
220
+ }
221
+ }
222
+ return { installDir };
223
+ }
224
+ //# sourceMappingURL=post-upgrade-lockfile-strip.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-upgrade-lockfile-strip.mjs","sourceRoot":"","sources":["../../src/cli-replacement/post-upgrade-lockfile-strip.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,qDAAqD,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAe,MAAM,yBAAyB,CAAC;AAEpE,MAAM,IAAI,GAAG,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAE3C,MAAM,UAAU,GAAG,+BAA+B,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAEtC,4EAA4E;AAC5E,2EAA2E;AAC3E,6EAA6E;AAC7E,+BAA+B;AAC/B,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS;IACxC,sBAAsB;IACtB,gCAAgC;CACjC,CAAC,CAAC;AAQH,MAAM,kBAAkB,GAAgB,KAAK,EAAE,MAAM,EAAE,EAAE;IACvD,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,uBAA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e,EAAE,CAAC;YAChC,MAAM,CAAC,IAAI,CACT,GAAG,UAAU,qDAAqD,EAClE;gBACE,UAAU;gBACV,SAAS;gBACT,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;aAC9B,CACF,CAAC;YACF,mEAAmE;YACnE,sEAAsE;YACtE,oEAAoE;YACpE,iEAAiE;YACjE,mEAAmE;YACnE,8DAA8D;YAC9D,iDAAiD;YACjD,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACxB,MAAM,CAAC,IAAI,CACT,GAAG,UAAU,oDAAoD,EACjE;oBACE,GAAG,YAAY,CAAC,KAAK,CAAC;oBACtB,UAAU;iBACX,CACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CACT,GAAG,UAAU,qDAAqD,EAClE;gBACE,UAAU;gBACV,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;aAC9B,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,wEAAwE;QACxE,yEAAyE;QACzE,WAAW;QACX,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,4CAA4C,EAAE;YACrE,GAAG,YAAY,CAAC,KAAK,CAAC;YACtB,UAAU;YACV,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;SAC9B,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,IAAI,aAAa,EAAE,CAAC;YAClB,YAAY,CAAC,aAAa,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Tests for post-upgrade-lockfile-strip.
3
+ *
4
+ * Strategy: stand up a real on-disk fixture mimicking the dev-server pod
5
+ * layout (`<prefix>/lib/node_modules/@superblocksteam/cli/...`), then assert
6
+ * the strip mutates the right files and is idempotent / non-fatal on edge
7
+ * cases. Avoids mocking the strip helpers because the disk-shape they expect
8
+ * is the actual contract under test.
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=post-upgrade-lockfile-strip.test.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-upgrade-lockfile-strip.test.d.mts","sourceRoot":"","sources":["../../src/cli-replacement/post-upgrade-lockfile-strip.test.mts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,317 @@
1
+ /**
2
+ * Tests for post-upgrade-lockfile-strip.
3
+ *
4
+ * Strategy: stand up a real on-disk fixture mimicking the dev-server pod
5
+ * layout (`<prefix>/lib/node_modules/@superblocksteam/cli/...`), then assert
6
+ * the strip mutates the right files and is idempotent / non-fatal on edge
7
+ * cases. Avoids mocking the strip helpers because the disk-shape they expect
8
+ * is the actual contract under test.
9
+ */
10
+ import { mkdir, mkdtemp, readFile, realpath, rm, symlink, writeFile, } from "node:fs/promises";
11
+ import * as os from "node:os";
12
+ import * as path from "node:path";
13
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
14
+ import { findGlobalCliInstallDir, stripUpgradedCliLockfiles, } from "./post-upgrade-lockfile-strip.mjs";
15
+ function makeLogger() {
16
+ return {
17
+ info: vi.fn(),
18
+ warn: vi.fn(),
19
+ error: vi.fn(),
20
+ debug: vi.fn(),
21
+ };
22
+ }
23
+ function asLogger(mock) {
24
+ return mock;
25
+ }
26
+ /**
27
+ * Lockfile fixture with mixed registries — only public-host `resolved` URLs
28
+ * should be stripped; `integrity` must survive.
29
+ */
30
+ function lockfile(version) {
31
+ return {
32
+ name: "@superblocksteam/cli",
33
+ version,
34
+ lockfileVersion: 3,
35
+ requires: true,
36
+ packages: {
37
+ "": {
38
+ name: "@superblocksteam/cli",
39
+ version,
40
+ },
41
+ "node_modules/some-dep": {
42
+ version: "1.0.0",
43
+ resolved: "https://registry.npmjs.org/some-dep/-/some-dep-1.0.0.tgz",
44
+ integrity: "sha512-abc",
45
+ },
46
+ "node_modules/already-stripped": {
47
+ version: "2.0.0",
48
+ integrity: "sha512-def",
49
+ },
50
+ },
51
+ };
52
+ }
53
+ async function makeCliInstallTree(root) {
54
+ const prefix = path.join(root, ".npm-global");
55
+ const cliDir = path.join(prefix, "lib", "node_modules", "@superblocksteam", "cli");
56
+ await mkdir(cliDir, { recursive: true });
57
+ await mkdir(path.join(cliDir, "node_modules"), { recursive: true });
58
+ await mkdir(path.join(cliDir, "bin"), { recursive: true });
59
+ await mkdir(path.join(prefix, "bin"), { recursive: true });
60
+ // package.json identifying this as @superblocksteam/cli
61
+ await writeFile(path.join(cliDir, "package.json"), JSON.stringify({ name: "@superblocksteam/cli", version: "2.1.0" }, null, 2));
62
+ // CLI's own lockfile, with stale public-host resolved URLs
63
+ const cliLockfile = path.join(cliDir, "package-lock.json");
64
+ await writeFile(cliLockfile, JSON.stringify(lockfile("2.1.0"), null, 2) + "\n");
65
+ // CLI's bundled hidden lockfile
66
+ const cliHiddenLockfile = path.join(cliDir, "node_modules", ".package-lock.json");
67
+ await writeFile(cliHiddenLockfile, JSON.stringify(lockfile("2.1.0"), null, 2) + "\n");
68
+ // npm-global hidden lockfile (lists @superblocksteam/cli itself)
69
+ const globalHiddenLockfile = path.join(prefix, "lib", "node_modules", ".package-lock.json");
70
+ await writeFile(globalHiddenLockfile, JSON.stringify({
71
+ name: "global-prefix",
72
+ lockfileVersion: 3,
73
+ packages: {
74
+ "node_modules/@superblocksteam/cli": {
75
+ version: "2.1.0",
76
+ resolved: "https://registry.npmjs.org/@superblocksteam/cli/-/cli-2.1.0.tgz",
77
+ integrity: "sha512-cli",
78
+ },
79
+ },
80
+ }, null, 2) + "\n");
81
+ // Real binary the shim points at
82
+ const realBin = path.join(cliDir, "bin", "run.js");
83
+ await writeFile(realBin, "#!/usr/bin/env node\n");
84
+ // The PATH-resolved shim is a symlink under <prefix>/bin
85
+ const binShim = path.join(prefix, "bin", "superblocks");
86
+ await symlink(realBin, binShim);
87
+ return {
88
+ prefix,
89
+ cliDir,
90
+ cliLockfile,
91
+ cliHiddenLockfile,
92
+ globalHiddenLockfile,
93
+ binShim,
94
+ realBin,
95
+ };
96
+ }
97
+ describe("post-upgrade-lockfile-strip", () => {
98
+ let tmpRoot;
99
+ let logger;
100
+ beforeEach(async () => {
101
+ // Realpath up front so test expectations match `fs.realpath` output on
102
+ // macOS, where `/var` is a symlink to `/private/var` and any subsequent
103
+ // realpath() resolves through it. Without this every "expect dir" line
104
+ // would have to manually realpath() each comparison.
105
+ tmpRoot = await realpath(await mkdtemp(path.join(os.tmpdir(), "apps-4196-")));
106
+ logger = makeLogger();
107
+ });
108
+ afterEach(async () => {
109
+ await rm(tmpRoot, { recursive: true, force: true });
110
+ });
111
+ describe("findGlobalCliInstallDir", () => {
112
+ it("resolves the CLI install root via which + realpath + walkup", async () => {
113
+ const tree = await makeCliInstallTree(tmpRoot);
114
+ const which = vi.fn(async () => `${tree.binShim}\n`);
115
+ const result = await findGlobalCliInstallDir(asLogger(logger), which);
116
+ expect(result).toBe(tree.cliDir);
117
+ expect(which).toHaveBeenCalledWith("superblocks");
118
+ });
119
+ it("returns undefined when which/where fails (binary not in PATH)", async () => {
120
+ const which = vi.fn(async () => {
121
+ throw new Error("not found");
122
+ });
123
+ const result = await findGlobalCliInstallDir(asLogger(logger), which);
124
+ expect(result).toBeUndefined();
125
+ expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining("which/where superblocks failed"), expect.any(Object));
126
+ });
127
+ it("returns undefined when which stdout is empty", async () => {
128
+ const which = vi.fn(async () => "\n");
129
+ const result = await findGlobalCliInstallDir(asLogger(logger), which);
130
+ expect(result).toBeUndefined();
131
+ expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining("superblocks binary not found in PATH"));
132
+ });
133
+ it("uses only the first line when which returns multiple paths", async () => {
134
+ const tree = await makeCliInstallTree(tmpRoot);
135
+ const which = vi.fn(async () => `${tree.binShim}\n/another/path/superblocks\n`);
136
+ const result = await findGlobalCliInstallDir(asLogger(logger), which);
137
+ expect(result).toBe(tree.cliDir);
138
+ });
139
+ it("accepts @superblocksteam/cli-ephemeral as the CLI package name", async () => {
140
+ const tree = await makeCliInstallTree(tmpRoot);
141
+ // Rewrite the manifest as the ephemeral alias
142
+ await writeFile(path.join(tree.cliDir, "package.json"), JSON.stringify({ name: "@superblocksteam/cli-ephemeral", version: "2.1.0" }, null, 2));
143
+ const which = vi.fn(async () => `${tree.binShim}\n`);
144
+ const result = await findGlobalCliInstallDir(asLogger(logger), which);
145
+ expect(result).toBe(tree.cliDir);
146
+ });
147
+ it("returns undefined when no CLI manifest is found within the walk bound", async () => {
148
+ // Symlink targets a path whose ancestors carry no @superblocksteam/cli manifest.
149
+ const wrongRoot = path.join(tmpRoot, "wrong");
150
+ await mkdir(wrongRoot, { recursive: true });
151
+ const realBin = path.join(wrongRoot, "bin");
152
+ await writeFile(realBin, "#!/usr/bin/env node\n");
153
+ const shim = path.join(tmpRoot, "shim");
154
+ await symlink(realBin, shim);
155
+ const which = vi.fn(async () => `${shim}\n`);
156
+ const result = await findGlobalCliInstallDir(asLogger(logger), which);
157
+ expect(result).toBeUndefined();
158
+ });
159
+ });
160
+ describe("stripUpgradedCliLockfiles", () => {
161
+ it("strips resolved from all three lockfile locations", async () => {
162
+ const tree = await makeCliInstallTree(tmpRoot);
163
+ const result = await stripUpgradedCliLockfiles(asLogger(logger), {
164
+ installDir: tree.cliDir,
165
+ });
166
+ expect(result.installDir).toBe(tree.cliDir);
167
+ // The success info log is the operator-facing signal that the strip
168
+ // ran; assert it fires exactly once on the happy path.
169
+ expect(logger.info).toHaveBeenCalledTimes(1);
170
+ expect(logger.warn).not.toHaveBeenCalled();
171
+ // CLI's own lockfile: public-host resolved gone, integrity preserved
172
+ const cli = JSON.parse(await readFile(tree.cliLockfile, "utf-8"));
173
+ expect(cli.packages["node_modules/some-dep"].resolved).toBeUndefined();
174
+ expect(cli.packages["node_modules/some-dep"].integrity).toBe("sha512-abc");
175
+ // CLI's hidden lockfile
176
+ const hidden = JSON.parse(await readFile(tree.cliHiddenLockfile, "utf-8"));
177
+ expect(hidden.packages["node_modules/some-dep"].resolved).toBeUndefined();
178
+ // Global hidden lockfile (the @superblocksteam/cli listing itself)
179
+ const global = JSON.parse(await readFile(tree.globalHiddenLockfile, "utf-8"));
180
+ expect(global.packages["node_modules/@superblocksteam/cli"].resolved).toBeUndefined();
181
+ expect(global.packages["node_modules/@superblocksteam/cli"].integrity).toBe("sha512-cli");
182
+ });
183
+ it("is idempotent — second call produces no further changes", async () => {
184
+ const tree = await makeCliInstallTree(tmpRoot);
185
+ await stripUpgradedCliLockfiles(asLogger(logger), {
186
+ installDir: tree.cliDir,
187
+ });
188
+ const after1 = await readFile(tree.cliLockfile, "utf-8");
189
+ await stripUpgradedCliLockfiles(asLogger(logger), {
190
+ installDir: tree.cliDir,
191
+ });
192
+ const after2 = await readFile(tree.cliLockfile, "utf-8");
193
+ expect(after2).toBe(after1);
194
+ });
195
+ it("returns no installDir and does not throw when discovery fails", async () => {
196
+ const which = vi.fn(async () => {
197
+ throw new Error("not found");
198
+ });
199
+ const result = await stripUpgradedCliLockfiles(asLogger(logger), {
200
+ whichRunner: which,
201
+ });
202
+ expect(result).toEqual({});
203
+ // No success log should fire when there was no work to do.
204
+ expect(logger.info).not.toHaveBeenCalled();
205
+ });
206
+ it("does not throw when global hidden lockfile is absent (npm v6 layout)", async () => {
207
+ const tree = await makeCliInstallTree(tmpRoot);
208
+ await rm(tree.globalHiddenLockfile);
209
+ await expect(stripUpgradedCliLockfiles(asLogger(logger), {
210
+ installDir: tree.cliDir,
211
+ })).resolves.toEqual({ installDir: tree.cliDir });
212
+ // The other two were still stripped
213
+ const cli = JSON.parse(await readFile(tree.cliLockfile, "utf-8"));
214
+ expect(cli.packages["node_modules/some-dep"].resolved).toBeUndefined();
215
+ });
216
+ it("returns and warns when the inner strip exceeds the timeout", async () => {
217
+ // Simulate a hung strip (e.g. wedged I/O on a network-mounted prefix).
218
+ // Without the timeout, this would extend `cliUpgradePromise` and block
219
+ // dev-server startup; the timeout converts that into a bounded warn.
220
+ const tree = await makeCliInstallTree(tmpRoot);
221
+ const stripModule = await import("@superblocksteam/vite-plugin-file-sync/npm-registry");
222
+ const stripSpy = vi
223
+ .spyOn(stripModule, "stripResolvedFromLockfile")
224
+ .mockImplementation(() => new Promise(() => { }));
225
+ try {
226
+ const result = await stripUpgradedCliLockfiles(asLogger(logger), {
227
+ installDir: tree.cliDir,
228
+ timeoutMs: 10,
229
+ });
230
+ expect(result).toEqual({ installDir: tree.cliDir });
231
+ expect(logger.warn).toHaveBeenCalledTimes(1);
232
+ expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining("strip exceeded timeout"), expect.objectContaining({
233
+ installDir: tree.cliDir,
234
+ timeoutMs: 10,
235
+ }));
236
+ expect(logger.info).not.toHaveBeenCalled();
237
+ }
238
+ finally {
239
+ stripSpy.mockRestore();
240
+ }
241
+ });
242
+ it("suppresses a post-timeout rejection so the abandoned strip cannot crash the pod", async () => {
243
+ // After the timeout wins the race we abandon `stripWork`. If a later
244
+ // rejection from the inner helpers (e.g. EACCES on the atomic rename)
245
+ // had no subscriber, Node would surface it as an unhandled rejection
246
+ // and exit the dev-server process. This test wires up a strip that
247
+ // rejects strictly after the timeout fires, then asserts the wrapper
248
+ // resolves cleanly AND logs the post-timeout rejection via its tail
249
+ // handler.
250
+ const tree = await makeCliInstallTree(tmpRoot);
251
+ let rejectStrip = () => { };
252
+ const pendingStrip = new Promise((_, reject) => {
253
+ rejectStrip = reject;
254
+ });
255
+ const unhandled = [];
256
+ const onUnhandled = (reason) => {
257
+ unhandled.push(reason);
258
+ };
259
+ process.on("unhandledRejection", onUnhandled);
260
+ const stripModule = await import("@superblocksteam/vite-plugin-file-sync/npm-registry");
261
+ const stripSpy = vi
262
+ .spyOn(stripModule, "stripResolvedFromLockfile")
263
+ .mockImplementation(() => pendingStrip);
264
+ try {
265
+ const result = await stripUpgradedCliLockfiles(asLogger(logger), {
266
+ installDir: tree.cliDir,
267
+ timeoutMs: 10,
268
+ });
269
+ expect(result).toEqual({ installDir: tree.cliDir });
270
+ expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining("strip exceeded timeout"), expect.objectContaining({ installDir: tree.cliDir }));
271
+ rejectStrip(new Error("simulated post-timeout rejection"));
272
+ // Let the rejection propagate and the tail .catch() run.
273
+ await new Promise((resolve) => setImmediate(resolve));
274
+ expect(unhandled).toEqual([]);
275
+ expect(logger.warn).toHaveBeenCalledWith(expect.stringContaining("background strip rejected after timeout"), expect.objectContaining({
276
+ installDir: tree.cliDir,
277
+ error: expect.objectContaining({
278
+ message: "simulated post-timeout rejection",
279
+ }),
280
+ }));
281
+ }
282
+ finally {
283
+ process.off("unhandledRejection", onUnhandled);
284
+ stripSpy.mockRestore();
285
+ }
286
+ });
287
+ it("does not throw or emit the success log when an inner strip rejects unexpectedly", async () => {
288
+ // Replace the CLI's lockfile with a directory at the same path — the
289
+ // inner helper's readFile will see EISDIR. The lower-level helpers
290
+ // documented as swallowing errors should keep the Promise.all from
291
+ // rejecting, but if a future refactor changes that, this test asserts
292
+ // the wrapper's belt-and-suspenders catch still keeps the function
293
+ // non-fatal AND suppresses the success log.
294
+ const tree = await makeCliInstallTree(tmpRoot);
295
+ await rm(tree.cliLockfile);
296
+ await mkdir(tree.cliLockfile);
297
+ const stripModule = await import("@superblocksteam/vite-plugin-file-sync/npm-registry");
298
+ const stripSpy = vi
299
+ .spyOn(stripModule, "stripResolvedFromLockfile")
300
+ .mockRejectedValue(new Error("simulated unexpected throw"));
301
+ try {
302
+ await expect(stripUpgradedCliLockfiles(asLogger(logger), {
303
+ installDir: tree.cliDir,
304
+ })).resolves.toEqual({ installDir: tree.cliDir });
305
+ // Wrapper logged a warn for the unexpected error; the success info
306
+ // log MUST NOT have fired (otherwise pod logs would falsely claim
307
+ // the strip completed).
308
+ expect(logger.warn).toHaveBeenCalledTimes(1);
309
+ expect(logger.info).not.toHaveBeenCalled();
310
+ }
311
+ finally {
312
+ stripSpy.mockRestore();
313
+ }
314
+ });
315
+ });
316
+ });
317
+ //# sourceMappingURL=post-upgrade-lockfile-strip.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-upgrade-lockfile-strip.test.mjs","sourceRoot":"","sources":["../../src/cli-replacement/post-upgrade-lockfile-strip.test.mts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,EAAE,EACF,OAAO,EACP,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAGzE,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,mCAAmC,CAAC;AAgB3C,SAAS,UAAU;IACjB,OAAO;QACL,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE;QACb,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE;QACb,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE;QACd,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE;KACf,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,IAAgB;IAChC,OAAO,IAAyB,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,SAAS,QAAQ,CAAC,OAAe;IAC/B,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,OAAO;QACP,eAAe,EAAE,CAAC;QAClB,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE;YACR,EAAE,EAAE;gBACF,IAAI,EAAE,sBAAsB;gBAC5B,OAAO;aACR;YACD,uBAAuB,EAAE;gBACvB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,0DAA0D;gBACpE,SAAS,EAA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C;gBAC7C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;YAC7C,CAAC;oBAAS,CAAC;gBACT,QAAQ,CAAC,WAAW,EAAE,CAAC;YACzB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Integration test: real `npm` and `pnpm` subprocesses read the
3
+ * Superblocks-owned userconfig when our env overlay is set. Pins the
4
+ * contract that `buildInstallEnv` and the dev-server startup install
5
+ * rely on.
6
+ *
7
+ * Why this exists:
8
+ * - Unit tests assert the spawned `env` includes the userconfig keys,
9
+ * but they cannot tell us whether npm/pnpm actually *honor* them.
10
+ * Earlier iterations of this PR tripped on two real CLI gaps that
11
+ * the unit tests missed:
12
+ * 1. pnpm rejects `--userconfig=` as a CLI flag (pnpm/pnpm#6036)
13
+ * 2. pnpm 11 stopped honouring `NPM_CONFIG_USERCONFIG` (config
14
+ * keys must now be `pnpm_config_*` instead).
15
+ * - This file spawns the real binaries and asserts the registry
16
+ * comes back from our fixture userconfig.
17
+ *
18
+ * Env scrubbing: pnpm/npm inject many `(npm|pnpm)_config_*` env vars
19
+ * into spawned child processes. Those take precedence over userconfig
20
+ * (env > userconfig in the npm config priority chain), which means the
21
+ * fixture would be silently overridden if we forwarded the test
22
+ * runner's env as-is. We strip those vars on the spawn so the assertion
23
+ * exercises the userconfig pathway in isolation.
24
+ */
25
+ export {};
26
+ //# sourceMappingURL=userconfig-env.integration.test.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userconfig-env.integration.test.d.mts","sourceRoot":"","sources":["../../src/cli-replacement/userconfig-env.integration.test.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}