@specific.dev/spectest 0.76.0 → 0.76.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.
package/dist/daemon.js CHANGED
@@ -459,6 +459,16 @@ const BUILDKITD_UP_PATH = "/usr/local/bin/spectest-buildkitd-up";
459
459
  async function imageCachePaths() {
460
460
  return imageCachePathsSync(IMAGE_CACHE_MANIFEST);
461
461
  }
462
+ /**
463
+ * The bring-up, once. A promise and not a flag: every build of a
464
+ * bootstrap calls this at the same time now that builds go in together,
465
+ * and a flag set to "not yet" while the first caller waits for buildkitd
466
+ * sent every other build to dockerd's own builder — which cannot build
467
+ * on the erofs store at all (`lease does not exist`), so Specific's
468
+ * first three cold builds on SDK 0.76.0 failed inside ten seconds
469
+ * (2026-09-07). Sharing the promise makes every caller wait for the one
470
+ * bring-up and read its one answer.
471
+ */
462
472
  let _localBuilder;
463
473
  /**
464
474
  * Start buildkitd inside this VM with its state on the cache disk, and
@@ -469,10 +479,11 @@ let _localBuilder;
469
479
  * best-effort: a daemon that will not start falls back to the shared host
470
480
  * one, which is a slower build and not a failed one.
471
481
  */
472
- async function ensureLocalBuildkitd() {
473
- if (_localBuilder !== undefined)
474
- return _localBuilder;
475
- _localBuilder = false;
482
+ function ensureLocalBuildkitd() {
483
+ _localBuilder ??= bringUpLocalBuildkitd();
484
+ return _localBuilder;
485
+ }
486
+ async function bringUpLocalBuildkitd() {
476
487
  const paths = await imageCachePaths();
477
488
  if (!paths)
478
489
  return false;
@@ -515,7 +526,6 @@ async function ensureLocalBuildkitd() {
515
526
  // hit is a snapshot that already exists — no tar blob to unpack
516
527
  // before the first uncached step, no export pass after a miss.
517
528
  await ensureBuildkitCacheUnion(paths);
518
- _localBuilder = true;
519
529
  return true;
520
530
  }
521
531
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specific.dev/spectest",
3
- "version": "0.76.0",
3
+ "version": "0.76.1",
4
4
  "description": "Spectest SDK for defining test environments in TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/daemon.ts CHANGED
@@ -736,7 +736,17 @@ async function imageCachePaths(): Promise<ImageCachePaths | null> {
736
736
  return imageCachePathsSync(IMAGE_CACHE_MANIFEST);
737
737
  }
738
738
 
739
- let _localBuilder: boolean | undefined;
739
+ /**
740
+ * The bring-up, once. A promise and not a flag: every build of a
741
+ * bootstrap calls this at the same time now that builds go in together,
742
+ * and a flag set to "not yet" while the first caller waits for buildkitd
743
+ * sent every other build to dockerd's own builder — which cannot build
744
+ * on the erofs store at all (`lease does not exist`), so Specific's
745
+ * first three cold builds on SDK 0.76.0 failed inside ten seconds
746
+ * (2026-09-07). Sharing the promise makes every caller wait for the one
747
+ * bring-up and read its one answer.
748
+ */
749
+ let _localBuilder: Promise<boolean> | undefined;
740
750
  /**
741
751
  * Start buildkitd inside this VM with its state on the cache disk, and
742
752
  * register it as a buildx `remote` builder.
@@ -746,9 +756,12 @@ let _localBuilder: boolean | undefined;
746
756
  * best-effort: a daemon that will not start falls back to the shared host
747
757
  * one, which is a slower build and not a failed one.
748
758
  */
749
- async function ensureLocalBuildkitd(): Promise<boolean> {
750
- if (_localBuilder !== undefined) return _localBuilder;
751
- _localBuilder = false;
759
+ function ensureLocalBuildkitd(): Promise<boolean> {
760
+ _localBuilder ??= bringUpLocalBuildkitd();
761
+ return _localBuilder;
762
+ }
763
+
764
+ async function bringUpLocalBuildkitd(): Promise<boolean> {
752
765
  const paths = await imageCachePaths();
753
766
  if (!paths) return false;
754
767
  const state = paths.root;
@@ -795,7 +808,6 @@ async function ensureLocalBuildkitd(): Promise<boolean> {
795
808
  // hit is a snapshot that already exists — no tar blob to unpack
796
809
  // before the first uncached step, no export pass after a miss.
797
810
  await ensureBuildkitCacheUnion(paths);
798
- _localBuilder = true;
799
811
  return true;
800
812
  }
801
813