@kungfu-tech/buildchain 2.12.7-alpha.20 → 2.12.7-alpha.22

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.
@@ -4,7 +4,7 @@
4
4
  "product": {
5
5
  "name": "Buildchain",
6
6
  "package": "@kungfu-tech/buildchain",
7
- "version": "2.12.7-alpha.20",
7
+ "version": "2.12.7-alpha.22",
8
8
  "repository": "https://github.com/kungfu-systems/buildchain"
9
9
  },
10
10
  "majorLine": "v2",
@@ -2679,5 +2679,5 @@
2679
2679
  }
2680
2680
  ],
2681
2681
  "compatibilityDigest": "sha256:af162b86ab4506e9b5f1d3c59b41f3fd57fbad79ff4d749a7f12ff16460517f8",
2682
- "contractDigest": "sha256:4d9fa59bd60cb59e2b2a0158a603316251320123dec0d840dc2e678ec181b273"
2682
+ "contractDigest": "sha256:881914b796ebf2deda418a3840791433aa1502aab1e7f2db03da228f938180e6"
2683
2683
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "contract": "kungfu-buildchain-site-bundle",
4
- "generatedAt": "2026-07-15T11:14:41.049Z",
5
- "publishedAt": "2026-07-15T11:14:41.049Z",
4
+ "generatedAt": "2026-07-15T13:10:00.779Z",
5
+ "publishedAt": "2026-07-15T13:10:00.779Z",
6
6
  "reproducible": true,
7
7
  "timestampPolicy": "ci-injected",
8
8
  "deterministicInputs": [
@@ -19,7 +19,7 @@
19
19
  "declared Buildchain surface manifest contract"
20
20
  ],
21
21
  "sourceDateEpoch": "0",
22
- "sourceRevision": "ff6924b387efca463b7312eb7198416bfe39654d",
22
+ "sourceRevision": "57c59542464de6d6fa053d83117cf74d018707e9",
23
23
  "timestampPolicyDetails": {
24
24
  "contract": "kungfu-buildchain-surface-timestamp-policy",
25
25
  "timestampFields": [
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "package": {
39
39
  "name": "@kungfu-tech/buildchain",
40
- "version": "2.12.7-alpha.20",
40
+ "version": "2.12.7-alpha.22",
41
41
  "versionSource": "package.json#version"
42
42
  },
43
43
  "source": {
@@ -4,7 +4,7 @@
4
4
  "product": {
5
5
  "id": "kungfu-tech-buildchain",
6
6
  "name": "@kungfu-tech/buildchain",
7
- "version": "2.12.7-alpha.20",
7
+ "version": "2.12.7-alpha.22",
8
8
  "repository": "https://github.com/kungfu-systems/buildchain"
9
9
  },
10
10
  "source": {
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "contract": "kungfu-buildchain-publication-release-registry",
4
- "generatedAt": "2026-07-15T11:14:41.049Z",
5
- "publishedAt": "2026-07-15T11:14:41.049Z",
4
+ "generatedAt": "2026-07-15T13:10:00.779Z",
5
+ "publishedAt": "2026-07-15T13:10:00.779Z",
6
6
  "reproducible": true,
7
7
  "timestampPolicy": "ci-injected",
8
8
  "deterministicInputs": [
@@ -19,7 +19,7 @@
19
19
  "declared Buildchain surface manifest contract"
20
20
  ],
21
21
  "sourceDateEpoch": "0",
22
- "sourceRevision": "ff6924b387efca463b7312eb7198416bfe39654d",
22
+ "sourceRevision": "57c59542464de6d6fa053d83117cf74d018707e9",
23
23
  "timestampPolicyDetails": {
24
24
  "contract": "kungfu-buildchain-surface-timestamp-policy",
25
25
  "timestampFields": [
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "package": {
34
34
  "name": "@kungfu-tech/buildchain",
35
- "version": "2.12.7-alpha.20",
35
+ "version": "2.12.7-alpha.22",
36
36
  "versionSource": "package.json#version"
37
37
  },
38
38
  "sourceKind": "package-site-bundle",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "contract": "kungfu-buildchain-site-manifest",
4
- "generatedAt": "2026-07-15T11:14:41.049Z",
5
- "publishedAt": "2026-07-15T11:14:41.049Z",
4
+ "generatedAt": "2026-07-15T13:10:00.779Z",
5
+ "publishedAt": "2026-07-15T13:10:00.779Z",
6
6
  "reproducible": true,
7
7
  "timestampPolicy": "ci-injected",
8
8
  "deterministicInputs": [
@@ -19,7 +19,7 @@
19
19
  "declared Buildchain surface manifest contract"
20
20
  ],
21
21
  "sourceDateEpoch": "0",
22
- "sourceRevision": "ff6924b387efca463b7312eb7198416bfe39654d",
22
+ "sourceRevision": "57c59542464de6d6fa053d83117cf74d018707e9",
23
23
  "timestampPolicyDetails": {
24
24
  "contract": "kungfu-buildchain-surface-timestamp-policy",
25
25
  "timestampFields": [
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "package": {
39
39
  "name": "@kungfu-tech/buildchain",
40
- "version": "2.12.7-alpha.20",
40
+ "version": "2.12.7-alpha.22",
41
41
  "versionSource": "package.json#version"
42
42
  },
43
43
  "entrypoint": "buildchain-site.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungfu-tech/buildchain",
3
- "version": "2.12.7-alpha.20",
3
+ "version": "2.12.7-alpha.22",
4
4
  "private": false,
5
5
  "description": "Buildchain Release Passport, release governance, CLI toolkit, and site facts.",
6
6
  "repository": "https://github.com/kungfu-systems/buildchain",
@@ -6,6 +6,7 @@ import path from "node:path";
6
6
  import { pathToFileURL } from "node:url";
7
7
 
8
8
  export const LOCKED_SOURCE_CHECKOUT_CONTRACT = "kungfu-buildchain-locked-source-checkout-cache";
9
+ export const ISOLATED_GIT_GLOBAL_CONFIG = process.platform === "win32" ? "NUL" : "/dev/null";
9
10
 
10
11
  const GIT_SHA_PATTERN = /^[0-9a-f]{40}$/i;
11
12
 
@@ -133,6 +134,24 @@ function githubAuthEnv(token = "") {
133
134
  };
134
135
  }
135
136
 
137
+ function isolatedGitFetchEnv(env = {}, targetPath) {
138
+ const configuredCount = Number.parseInt(env.GIT_CONFIG_COUNT || "0", 10);
139
+ const safeDirectoryIndex = Number.isInteger(configuredCount) && configuredCount >= 0
140
+ ? configuredCount
141
+ : 0;
142
+ return {
143
+ ...env,
144
+ // Runner-global URL rewrites are shared mutable state. A concurrent job
145
+ // may point the same repository URL at a different single-SHA bundle, so
146
+ // network fetches must not consult the account-level Git config.
147
+ GIT_CONFIG_GLOBAL: ISOLATED_GIT_GLOBAL_CONFIG,
148
+ GIT_CONFIG_NOSYSTEM: "1",
149
+ GIT_CONFIG_COUNT: String(safeDirectoryIndex + 1),
150
+ [`GIT_CONFIG_KEY_${safeDirectoryIndex}`]: "safe.directory",
151
+ [`GIT_CONFIG_VALUE_${safeDirectoryIndex}`]: path.resolve(targetPath),
152
+ };
153
+ }
154
+
136
155
  function markSafeDirectory(targetPath, timeoutMs) {
137
156
  try {
138
157
  git(["config", "--global", "--add", "safe.directory", path.resolve(targetPath)], {
@@ -203,9 +222,32 @@ export function fetchSourceCommit({
203
222
  sourceTreeSha = "",
204
223
  timeoutMs,
205
224
  env = {},
225
+ allowFullFetchRetry = false,
206
226
  runGit = git,
207
227
  containsCommit = hasCommit,
208
228
  }) {
229
+ const fetchEnv = isolatedGitFetchEnv(env, targetPath);
230
+ const fetch = (refspec) => {
231
+ const options = { cwd: targetPath, timeoutMs, env: fetchEnv };
232
+ try {
233
+ runGit(["fetch", "--no-tags", "--depth=1", remoteName, refspec], options);
234
+ return "shallow";
235
+ } catch (error) {
236
+ if (
237
+ !allowFullFetchRetry
238
+ || !/dumb http transport does not support shallow capabilities/i.test(
239
+ String(error?.message || error || ""),
240
+ )
241
+ ) {
242
+ throw error;
243
+ }
244
+ // Dumb HTTP mirrors are intentionally simple static cache endpoints.
245
+ // Retry only that explicit capability mismatch without --depth; all
246
+ // network fallbacks remain shallow and bounded by their own policy.
247
+ runGit(["fetch", "--no-tags", remoteName, refspec], options);
248
+ return "full";
249
+ }
250
+ };
209
251
  try {
210
252
  runGit(["remote", "remove", remoteName], { cwd: targetPath, timeoutMs, stdio: "ignore" });
211
253
  } catch {
@@ -219,13 +261,9 @@ export function fetchSourceCommit({
219
261
 
220
262
  if (fetchRef) {
221
263
  try {
222
- runGit(["fetch", "--no-tags", "--depth=1", remoteName, `+${fetchRef}:refs/buildchain/source-ref`], {
223
- cwd: targetPath,
224
- timeoutMs,
225
- env,
226
- });
264
+ const fetchMode = fetch(`+${fetchRef}:refs/buildchain/source-ref`);
227
265
  if (containsCommit(targetPath, sha, timeoutMs)) {
228
- return { selector: "ref", checkoutSha: sha };
266
+ return { selector: "ref", checkoutSha: sha, fetchMode };
229
267
  }
230
268
  if (/^refs\/pull\/\d+\/merge$/.test(fetchRef) && sourceTreeSha) {
231
269
  const fetchedSha = runGit(["rev-parse", "refs/buildchain/source-ref^{commit}"], {
@@ -237,7 +275,7 @@ export function fetchSourceCommit({
237
275
  timeoutMs,
238
276
  });
239
277
  if (fetchedTree === sourceTreeSha) {
240
- return { selector: "ref-tree", checkoutSha: fetchedSha };
278
+ return { selector: "ref-tree", checkoutSha: fetchedSha, fetchMode };
241
279
  }
242
280
  }
243
281
  } catch (error) {
@@ -249,15 +287,11 @@ export function fetchSourceCommit({
249
287
  }
250
288
  }
251
289
 
252
- runGit(["fetch", "--no-tags", "--depth=1", remoteName, `+${sha}:refs/buildchain/source`], {
253
- cwd: targetPath,
254
- timeoutMs,
255
- env,
256
- });
290
+ const fetchMode = fetch(`+${sha}:refs/buildchain/source`);
257
291
  if (!containsCommit(targetPath, sha, timeoutMs)) {
258
292
  throw new Error(`fetched ${fetchRef || sha}, but ${sha} is not available`);
259
293
  }
260
- return { selector: "sha", checkoutSha: sha };
294
+ return { selector: "sha", checkoutSha: sha, fetchMode };
261
295
  }
262
296
 
263
297
  export function runBoundedFetch({ attempts = 1, fetch, onAttempt = () => {}, onRetry = () => {}, shouldRetry = () => true }) {
@@ -413,7 +447,9 @@ export function lockedSourceCheckout({
413
447
  fetchRef,
414
448
  sourceTreeSha: treeSha,
415
449
  timeoutMs,
450
+ allowFullFetchRetry: true,
416
451
  });
452
+ evidence.cache.fetchMode = fetchResult.fetchMode;
417
453
  checkoutSha = fetchResult.checkoutSha || sha;
418
454
  checkoutFetchedCommit(targetPath, checkoutSha, timeoutMs);
419
455
  } else {
@@ -458,6 +494,7 @@ export function lockedSourceCheckout({
458
494
  shouldRetry: retryableGitFetchError,
459
495
  });
460
496
  evidence.cache.githubFetchAttempts = fetchResult.attempts;
497
+ evidence.cache.fetchMode = fetchResult.value.fetchMode;
461
498
  checkoutSha = fetchResult.value.checkoutSha || sha;
462
499
  } catch (error) {
463
500
  evidence.durationMs = Date.now() - startedAt;