@impz/testing 7.9.0 → 7.11.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 (2) hide show
  1. package/dist/index.js +201 -103
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -18837,7 +18837,8 @@ import { join } from "path";
18837
18837
  var UFFD_RUN_FILES = {
18838
18838
  socket: "uffd.sock",
18839
18839
  pidFile: "uffd.pid",
18840
- statsFile: "uffd.stats"
18840
+ statsFile: "uffd.stats",
18841
+ touchedFile: "uffd.touched"
18841
18842
  };
18842
18843
  var DATA_DIRS = ["db", "system", "images", "imps"];
18843
18844
  function createDataDirs(dataDir) {
@@ -18869,6 +18870,7 @@ function buildImpPaths(dataDir, impId) {
18869
18870
  uffdSocket: join(runDir, UFFD_RUN_FILES.socket),
18870
18871
  uffdPidFile: join(runDir, UFFD_RUN_FILES.pidFile),
18871
18872
  uffdStatsFile: join(runDir, UFFD_RUN_FILES.statsFile),
18873
+ uffdTouchedFile: join(runDir, UFFD_RUN_FILES.touchedFile),
18872
18874
  ...buildSnapshotPaths(join(directory, "snapshot")),
18873
18875
  vmIdentity: join(directory, "vm.json"),
18874
18876
  checkpointsDir: join(directory, "checkpoints"),
@@ -18883,6 +18885,7 @@ function buildSnapshotPaths(snapshotDir) {
18883
18885
  snapshotDir,
18884
18886
  vmstate: join(snapshotDir, "vmstate"),
18885
18887
  memFile: join(snapshotDir, "mem"),
18888
+ memTouched: join(snapshotDir, "mem.touched"),
18886
18889
  snapshotMeta: join(snapshotDir, "meta.json")
18887
18890
  };
18888
18891
  }
@@ -18924,7 +18927,7 @@ var BACKUP_TREE = {
18924
18927
  };
18925
18928
 
18926
18929
  // packages/testing/src/stand-in/start-test-impd.ts
18927
- import { copyFileSync as copyFileSync5, mkdirSync as mkdirSync32, mkdtempSync, writeFileSync as writeFileSync18 } from "fs";
18930
+ import { copyFileSync as copyFileSync6, mkdirSync as mkdirSync32, mkdtempSync, writeFileSync as writeFileSync18 } from "fs";
18928
18931
  import { rm as rm2 } from "fs/promises";
18929
18932
  import { tmpdir } from "os";
18930
18933
 
@@ -22158,7 +22161,7 @@ import { join as join49 } from "path";
22158
22161
  // packages/daemon/package.json
22159
22162
  var package_default = {
22160
22163
  name: "@impz/daemon",
22161
- version: "7.9.0",
22164
+ version: "7.11.0",
22162
22165
  private: true,
22163
22166
  description: "impd: the imp host daemon",
22164
22167
  type: "module",
@@ -45164,31 +45167,72 @@ function splitRun(run) {
45164
45167
  }
45165
45168
 
45166
45169
  // packages/daemon/src/vm/vmm/create-memory-warm.ts
45170
+ import { existsSync as existsSync21 } from "fs";
45167
45171
  import invariant12 from "tiny-invariant";
45168
45172
  import { match as match23 } from "ts-pattern";
45169
45173
  import * as z87 from "zod";
45170
45174
  var BLOCK_MIB2 = 2;
45171
45175
  var WARM_CONCURRENCY = 2;
45176
+ var WHOLE_MODES = { count: "--count-data", warm: "--warm" };
45177
+ var RECORDED_MODES = { count: "--count-blocks", warm: "--warm-blocks" };
45172
45178
  var WarmReportSchema = z87.object({ blocks: z87.int().nonnegative() });
45173
45179
  function createMemoryWarm(deps) {
45174
45180
  const running = new Map;
45175
45181
  const lifetime = { isStopped: false };
45176
45182
  const slots = createSemaphore(WARM_CONCURRENCY);
45177
- const readBlocks = async (mode, memFile, signal) => {
45183
+ const budgetBlocks = Math.floor(deps.capMib / BLOCK_MIB2);
45184
+ const readBlocks = async (mode, target, signal) => {
45178
45185
  signal.throwIfAborted();
45179
- const argv = [deps.handlerBin, mode, memFile];
45186
+ const argv = match23(mode).with("--warm-blocks", () => [
45187
+ deps.handlerBin,
45188
+ mode,
45189
+ target.blockList,
45190
+ target.memFile,
45191
+ String(budgetBlocks)
45192
+ ]).with("--count-blocks", () => [deps.handlerBin, mode, target.blockList, target.memFile]).with("--count-data", "--warm", () => [deps.handlerBin, mode, target.memFile]).exhaustive();
45180
45193
  const stdout = await runChecked(argv, { signal }, deps.run);
45181
45194
  return WarmReportSchema.parse(JSON.parse(stdout)).blocks;
45182
45195
  };
45183
- const runWarm = async (memFile, signal) => {
45196
+ const warmRecorded = async (target, signal, startedMs) => {
45197
+ const recorded = await readBlocks(RECORDED_MODES.count, target, signal);
45198
+ if (recorded > 0 && budgetBlocks === 0) {
45199
+ return { kind: "overCap", scope: "recorded", blocks: recorded };
45200
+ }
45201
+ const read = recorded === 0 ? 0 : await readBlocks(RECORDED_MODES.warm, target, signal);
45202
+ return {
45203
+ kind: "warmed",
45204
+ scope: "recorded",
45205
+ blocks: read,
45206
+ scopeBlocks: recorded,
45207
+ warmMs: Math.round(performance.now() - startedMs)
45208
+ };
45209
+ };
45210
+ const warmWhole = async (target, signal, startedMs) => {
45211
+ const counted = await readBlocks(WHOLE_MODES.count, target, signal);
45212
+ if (counted * BLOCK_MIB2 > deps.capMib) {
45213
+ return { kind: "overCap", scope: "whole", blocks: counted };
45214
+ }
45215
+ const read = await readBlocks(WHOLE_MODES.warm, target, signal);
45216
+ return {
45217
+ kind: "warmed",
45218
+ scope: "whole",
45219
+ blocks: read,
45220
+ scopeBlocks: counted,
45221
+ warmMs: Math.round(performance.now() - startedMs)
45222
+ };
45223
+ };
45224
+ const runWarm = async (target, signal) => {
45184
45225
  const startedMs = performance.now();
45185
45226
  try {
45186
- const blocks = await readBlocks("--count-data", memFile, signal);
45187
- if (blocks * BLOCK_MIB2 > deps.capMib) {
45188
- return { kind: "overCap", blocks };
45227
+ if (existsSync21(target.blockList)) {
45228
+ try {
45229
+ return await warmRecorded(target, signal, startedMs);
45230
+ } catch (error) {
45231
+ signal.throwIfAborted();
45232
+ getImpdLogger("imps").with({ imp: target.name }).warning("the recorded blocks of the memory file cannot be read, so the whole file is: {error}", { error: getErrorMessage(error) });
45233
+ }
45189
45234
  }
45190
- const read = await readBlocks("--warm", memFile, signal);
45191
- return { kind: "warmed", blocks: read, warmMs: Math.round(performance.now() - startedMs) };
45235
+ return await warmWhole(target, signal, startedMs);
45192
45236
  } catch (error) {
45193
45237
  return { kind: "failed", error: getErrorMessage(error) };
45194
45238
  }
@@ -45223,7 +45267,7 @@ function createMemoryWarm(deps) {
45223
45267
  return Promise.resolve(null);
45224
45268
  }
45225
45269
  state.phase = "running";
45226
- return runWarm(target.memFile, controller.signal);
45270
+ return runWarm(target, controller.signal);
45227
45271
  };
45228
45272
  const runAndLog = async () => {
45229
45273
  const outcome = await slots.run(runInSlot);
@@ -45248,12 +45292,22 @@ function createMemoryWarm(deps) {
45248
45292
  }
45249
45293
  function logWarm(target, outcome, capMib) {
45250
45294
  const logger = getImpdLogger("imps").with({ imp: target.name });
45251
- match23(outcome).with({ kind: "warmed" }, (warmed) => {
45252
- logger.info("warmed the memory file in {warmMs}ms: {blocks} blocks of 2 MiB", {
45295
+ match23(outcome).with({ kind: "warmed", scope: "recorded" }, (warmed) => {
45296
+ logger.info("warmed {blocks} of {recordedBlocks} recorded blocks ({blocksMib} of {recordedMib} MiB) in {warmMs}ms", {
45297
+ warmMs: String(warmed.warmMs),
45298
+ blocks: String(warmed.blocks),
45299
+ recordedBlocks: String(warmed.scopeBlocks),
45300
+ blocksMib: String(warmed.blocks * BLOCK_MIB2),
45301
+ recordedMib: String(warmed.scopeBlocks * BLOCK_MIB2)
45302
+ });
45303
+ }).with({ kind: "warmed", scope: "whole" }, (warmed) => {
45304
+ logger.info("warmed the whole memory file in {warmMs}ms: {blocks} blocks of 2 MiB", {
45253
45305
  warmMs: String(warmed.warmMs),
45254
45306
  blocks: String(warmed.blocks)
45255
45307
  });
45256
- }).with({ kind: "overCap" }, (over) => {
45308
+ }).with({ kind: "overCap", scope: "recorded" }, (over) => {
45309
+ logger.info("left the memory file cold: not one of its {blocks} recorded blocks of {blockMib} MiB fits the warm cap of {capMib} MiB", { blocks: String(over.blocks), blockMib: String(BLOCK_MIB2), capMib: String(capMib) });
45310
+ }).with({ kind: "overCap", scope: "whole" }, (over) => {
45257
45311
  logger.info("left the memory file cold: its {dataMib} MiB of data pass the warm cap of {capMib} MiB", { dataMib: String(over.blocks * BLOCK_MIB2), capMib: String(capMib) });
45258
45312
  }).with({ kind: "ended" }, (ended) => {
45259
45313
  logger.info("stopped the memory file's warm after {warmMs}ms: {reason}", {
@@ -45481,12 +45535,12 @@ function buildLogKey(impId, generation) {
45481
45535
  import { createActor as createActor3 } from "xstate";
45482
45536
 
45483
45537
  // packages/daemon/src/imps/imps/session-logs/read-session-log-range.ts
45484
- import { existsSync as existsSync22, mkdirSync as mkdirSync20, readdirSync as readdirSync12, rmSync as rmSync23, rmdirSync as rmdirSync2 } from "fs";
45538
+ import { existsSync as existsSync23, mkdirSync as mkdirSync20, readdirSync as readdirSync12, rmSync as rmSync23, rmdirSync as rmdirSync2 } from "fs";
45485
45539
  import { open as open5 } from "fs/promises";
45486
45540
  import { basename as basename5, dirname as dirname13, join as join36, resolve as resolve2 } from "path";
45487
45541
 
45488
45542
  // packages/daemon/src/imps/imps/session-logs/generation-log.ts
45489
- import { existsSync as existsSync21, readFileSync as readFileSync32, readdirSync as readdirSync11, rmSync as rmSync22 } from "fs";
45543
+ import { existsSync as existsSync22, readFileSync as readFileSync32, readdirSync as readdirSync11, rmSync as rmSync22 } from "fs";
45490
45544
  import { mkdir, open as open4, stat, truncate, unlink } from "fs/promises";
45491
45545
  import { join as join35 } from "path";
45492
45546
  import * as z88 from "zod";
@@ -45554,7 +45608,7 @@ function getSegmentPath(directory, start) {
45554
45608
  }
45555
45609
  function readGenerationMeta(directory) {
45556
45610
  const path = join35(directory, META_FILE);
45557
- if (!existsSync21(path)) {
45611
+ if (!existsSync22(path)) {
45558
45612
  return null;
45559
45613
  }
45560
45614
  try {
@@ -45795,7 +45849,7 @@ function getGenerationDir(sessionLogsDir, generation) {
45795
45849
  return directory;
45796
45850
  }
45797
45851
  function readImpMetas(sessionLogsDir, readLive) {
45798
- if (!existsSync22(sessionLogsDir)) {
45852
+ if (!existsSync23(sessionLogsDir)) {
45799
45853
  return [];
45800
45854
  }
45801
45855
  return readdirSync12(sessionLogsDir).filter((entry) => isGenerationName(entry)).flatMap((generation) => {
@@ -45809,11 +45863,11 @@ function writeTombstone(sessionLogsDir, generation) {
45809
45863
  writeFileDurably(path, "");
45810
45864
  }
45811
45865
  function probeTombstone(sessionLogsDir, generation) {
45812
- return isGenerationName(generation) && existsSync22(getTombstonePath(sessionLogsDir, generation));
45866
+ return isGenerationName(generation) && existsSync23(getTombstonePath(sessionLogsDir, generation));
45813
45867
  }
45814
45868
  function listTombstones(sessionLogsDir) {
45815
45869
  const directory = join36(sessionLogsDir, TOMBSTONES);
45816
- return existsSync22(directory) ? readdirSync12(directory).filter((entry) => isGenerationName(entry)) : [];
45870
+ return existsSync23(directory) ? readdirSync12(directory).filter((entry) => isGenerationName(entry)) : [];
45817
45871
  }
45818
45872
  function removeTombstone(sessionLogsDir, generation) {
45819
45873
  rmSync23(getTombstonePath(sessionLogsDir, generation), { force: true });
@@ -47174,10 +47228,12 @@ function removePartialFiles(paths) {
47174
47228
  for (const path of [
47175
47229
  paths.vmstate,
47176
47230
  paths.memFile,
47231
+ paths.memTouched,
47177
47232
  paths.snapshotMeta,
47178
47233
  paths.vmIdentity,
47179
47234
  slot.vmstate,
47180
47235
  slot.memFile,
47236
+ slot.memTouched,
47181
47237
  slot.snapshotMeta
47182
47238
  ]) {
47183
47239
  rmSync24(`${path}.new`, { force: true });
@@ -47844,7 +47900,7 @@ function buildUffdDeviceError() {
47844
47900
  }
47845
47901
 
47846
47902
  // packages/daemon/src/imps/imps/make-sleep-imp-vm.ts
47847
- import { statSync as statSync13 } from "fs";
47903
+ import { statSync as statSync14 } from "fs";
47848
47904
 
47849
47905
  // packages/daemon/src/vm/agent-client/send-services-list.ts
47850
47906
  var STOP_TIMEOUT_MS = 15000;
@@ -47977,6 +48033,35 @@ async function waitForGuestAge(wait) {
47977
48033
  return wanted ? Math.round(now() - started) : null;
47978
48034
  }
47979
48035
 
48036
+ // packages/daemon/src/vm/vmm/keep-touched-blocks.ts
48037
+ import { copyFileSync as copyFileSync4, renameSync as renameSync7, rmSync as rmSync25, statSync as statSync13 } from "fs";
48038
+ function keepTouchedBlocks(paths) {
48039
+ dropTouchedBlocks(paths);
48040
+ if (!probeMarks(paths.uffdTouchedFile)) {
48041
+ return;
48042
+ }
48043
+ const staged = `${paths.memTouched}.new`;
48044
+ try {
48045
+ copyFileSync4(paths.uffdTouchedFile, staged);
48046
+ renameSync7(staged, paths.memTouched);
48047
+ } catch (error) {
48048
+ rmSync25(staged, { force: true });
48049
+ getImpdLogger("imps").with({ imp: paths.impId }).warning("kept no record of the blocks the wake served: {error}", {
48050
+ error: getErrorMessage(error)
48051
+ });
48052
+ }
48053
+ }
48054
+ function dropTouchedBlocks(paths) {
48055
+ rmSync25(paths.memTouched, { force: true });
48056
+ }
48057
+ function probeMarks(path) {
48058
+ try {
48059
+ return statSync13(path).size > 0;
48060
+ } catch {
48061
+ return false;
48062
+ }
48063
+ }
48064
+
47980
48065
  // packages/daemon/src/imps/imps/format-timings.ts
47981
48066
  function formatTimings(timings) {
47982
48067
  return Object.entries(timings).map(([step, durationMs]) => `${step}=${String(durationMs)}ms`).join(" ");
@@ -48042,10 +48127,12 @@ function makeSleepImpVm(deps) {
48042
48127
  isOnHugePages: false
48043
48128
  };
48044
48129
  removeSnapshotMeta(paths);
48130
+ dropTouchedBlocks(paths);
48045
48131
  const hasOomKill = startOomWatch(context.cgroups, imp.id);
48046
48132
  try {
48047
48133
  const cgroup = context.cgroups.setup(imp.id, imp.cpu, imp.memoryMib);
48048
48134
  const timings = await deps.withSleepSlot(() => context.vms.sleepVm(pid, paths, cgroup, paths));
48135
+ keepTouchedBlocks(paths);
48049
48136
  const booted = readVmIdentity(paths);
48050
48137
  slept.isOnHugePages = booted?.hugePages === "2M";
48051
48138
  writeSnapshotMeta(paths, {
@@ -48108,7 +48195,12 @@ function makeSleepImpVm(deps) {
48108
48195
  sleptAt: new Date
48109
48196
  });
48110
48197
  if (slept.isOnHugePages) {
48111
- context.memoryWarm?.start({ impID: imp.id, name: imp.name, memFile: paths.memFile });
48198
+ context.memoryWarm?.start({
48199
+ impID: imp.id,
48200
+ name: imp.name,
48201
+ memFile: paths.memFile,
48202
+ blockList: paths.memTouched
48203
+ });
48112
48204
  }
48113
48205
  return sleeping;
48114
48206
  };
@@ -48144,7 +48236,7 @@ function setDetached(session) {
48144
48236
  }
48145
48237
  function readDiskMib(path) {
48146
48238
  try {
48147
- return Math.round(statSync13(path).blocks * 512 / 1048576);
48239
+ return Math.round(statSync14(path).blocks * 512 / 1048576);
48148
48240
  } catch {
48149
48241
  return 0;
48150
48242
  }
@@ -48363,11 +48455,11 @@ function logTrustFailure(imp, error) {
48363
48455
 
48364
48456
  // packages/daemon/src/imps/imps/start-cold-vm.ts
48365
48457
  import { randomBytes as randomBytes11 } from "crypto";
48366
- import { statSync as statSync15 } from "fs";
48458
+ import { statSync as statSync16 } from "fs";
48367
48459
  import { resolve as resolve3 } from "path";
48368
48460
 
48369
48461
  // packages/daemon/src/vm/vmm/create-template-vm.ts
48370
- import { mkdirSync as mkdirSync22, rmSync as rmSync27 } from "fs";
48462
+ import { mkdirSync as mkdirSync22, rmSync as rmSync28 } from "fs";
48371
48463
 
48372
48464
  // packages/daemon/src/vm/agent-client/wait-for-agent.ts
48373
48465
  import { systemClock as systemClock4 } from "@zgeoff/std";
@@ -48401,14 +48493,14 @@ async function waitForAgent(vsockPath, options) {
48401
48493
  import {
48402
48494
  chmodSync as chmodSync7,
48403
48495
  closeSync as closeSync9,
48404
- existsSync as existsSync23,
48496
+ existsSync as existsSync24,
48405
48497
  lchownSync as lchownSync2,
48406
48498
  lstatSync as lstatSync3,
48407
48499
  mkdirSync as mkdirSync21,
48408
48500
  openSync as openSync7,
48409
48501
  readdirSync as readdirSync13,
48410
- rmSync as rmSync25,
48411
- statSync as statSync14,
48502
+ rmSync as rmSync26,
48503
+ statSync as statSync15,
48412
48504
  truncateSync as truncateSync3
48413
48505
  } from "fs";
48414
48506
  import { basename as basename6, dirname as dirname14, join as join37 } from "path";
@@ -48467,7 +48559,7 @@ function createJails(deps) {
48467
48559
  const remove = async (impId) => {
48468
48560
  await removeMounts(impId);
48469
48561
  if (listMountsUnder(readMounts2(), getRoot(impId)).length === 0) {
48470
- rmSync25(getJailDir(impId), { recursive: true, force: true });
48562
+ rmSync26(getJailDir(impId), { recursive: true, force: true });
48471
48563
  }
48472
48564
  };
48473
48565
  const setupDirBind = async (source, target) => {
@@ -48488,7 +48580,7 @@ function createJails(deps) {
48488
48580
  throw new Error(`jail ${chroot.id}: ${root} still has mounts`);
48489
48581
  }
48490
48582
  chroot.setupFiles();
48491
- rmSync25(getJailDir(chroot.id), { recursive: true, force: true });
48583
+ rmSync26(getJailDir(chroot.id), { recursive: true, force: true });
48492
48584
  mkdirSync21(root, { recursive: true });
48493
48585
  await runMount(["mount", "--bind", root, root]);
48494
48586
  await runMount(["mount", "--make-private", root]);
@@ -48550,7 +48642,7 @@ function createJails(deps) {
48550
48642
  remove,
48551
48643
  removeOrphans: async (impIds) => {
48552
48644
  const base = join37(deps.chrootBase, execName);
48553
- const ids = existsSync23(base) ? readdirSync13(base) : [];
48645
+ const ids = existsSync24(base) ? readdirSync13(base) : [];
48554
48646
  const orphans = ids.filter((impId) => !impIds.has(impId));
48555
48647
  const removed = [];
48556
48648
  for (const impId of orphans) {
@@ -48576,7 +48668,7 @@ function createJails(deps) {
48576
48668
  `);
48577
48669
  },
48578
48670
  removeUffdDevice: (id) => {
48579
- rmSync25(join37(getRoot(id), "dev", "userfaultfd"), { force: true });
48671
+ rmSync26(join37(getRoot(id), "dev", "userfaultfd"), { force: true });
48580
48672
  }
48581
48673
  };
48582
48674
  }
@@ -48599,7 +48691,7 @@ function readOwnerUid(path) {
48599
48691
  function setupScratchFile(source, target, user) {
48600
48692
  mkdirSync21(dirname14(target), { recursive: true });
48601
48693
  closeSync9(openSync7(target, "wx", 384));
48602
- truncateSync3(target, statSync14(source).size);
48694
+ truncateSync3(target, statSync15(source).size);
48603
48695
  lchownSync2(target, user.uid, user.gid);
48604
48696
  }
48605
48697
  function buildJailerCommand(command) {
@@ -48632,7 +48724,7 @@ function setupOwnership(paths, user, isDiskLate) {
48632
48724
  lchownSync2(paths.runDir, user.uid, user.gid);
48633
48725
  setupImpdDir(paths.snapshotDir);
48634
48726
  for (const file of [paths.vmstate, paths.memFile]) {
48635
- if (existsSync23(file)) {
48727
+ if (existsSync24(file)) {
48636
48728
  requireRegularFile(file);
48637
48729
  }
48638
48730
  }
@@ -48641,7 +48733,7 @@ function setupOwnership(paths, user, isDiskLate) {
48641
48733
  lchownSync2(paths.disk, user.uid, user.gid);
48642
48734
  }
48643
48735
  for (const file of [paths.vmstate, paths.memFile]) {
48644
- if (existsSync23(file)) {
48736
+ if (existsSync24(file)) {
48645
48737
  setupSnapshotFile(file, user.gid);
48646
48738
  }
48647
48739
  }
@@ -48651,7 +48743,7 @@ function setupImpdRunDir(paths) {
48651
48743
  for (const name of readdirSync13(paths.runDir)) {
48652
48744
  const path = join37(paths.runDir, name);
48653
48745
  if (!probeSealedEntry(paths, path)) {
48654
- rmSync25(path, { recursive: true, force: true });
48746
+ rmSync26(path, { recursive: true, force: true });
48655
48747
  }
48656
48748
  }
48657
48749
  }
@@ -48675,7 +48767,7 @@ function setupSnapshotFile(file, gid) {
48675
48767
  function setupRealDir(directory) {
48676
48768
  const found = lstatSync3(directory, { throwIfNoEntry: false });
48677
48769
  if (found !== undefined && !found.isDirectory()) {
48678
- rmSync25(directory, { force: true });
48770
+ rmSync26(directory, { force: true });
48679
48771
  }
48680
48772
  mkdirSync21(directory, { recursive: true });
48681
48773
  }
@@ -48684,10 +48776,11 @@ function probeSealedEntry(paths, path) {
48684
48776
  const uffdSocket = join37(paths.runDir, UFFD_RUN_FILES.socket);
48685
48777
  const uffdPidFile = join37(paths.runDir, UFFD_RUN_FILES.pidFile);
48686
48778
  const uffdStatsFile = join37(paths.runDir, UFFD_RUN_FILES.statsFile);
48779
+ const uffdTouchedFile = join37(paths.runDir, UFFD_RUN_FILES.touchedFile);
48687
48780
  if (path === paths.apiSocket || path === paths.vsockSocket || path === uffdSocket) {
48688
48781
  return entry.isSocket();
48689
48782
  }
48690
- return (path === paths.logFile || path === paths.pidFile || path === uffdPidFile || path === uffdStatsFile) && entry.isFile() && entry.uid === IMPD_USER.uid && entry.nlink === 1;
48783
+ return (path === paths.logFile || path === paths.pidFile || path === uffdPidFile || path === uffdStatsFile || path === uffdTouchedFile) && entry.isFile() && entry.uid === IMPD_USER.uid && entry.nlink === 1;
48691
48784
  }
48692
48785
  function requireRegularFile(file) {
48693
48786
  if (!lstatSync3(file).isFile()) {
@@ -48867,7 +48960,7 @@ function toMib(bytes) {
48867
48960
  }
48868
48961
 
48869
48962
  // packages/daemon/src/vm/vmm/start-uffd-handler.ts
48870
- import { closeSync as closeSync10, existsSync as existsSync24, openSync as openSync8, rmSync as rmSync26 } from "fs";
48963
+ import { closeSync as closeSync10, existsSync as existsSync25, openSync as openSync8, rmSync as rmSync27 } from "fs";
48871
48964
 
48872
48965
  // packages/daemon/src/vm/vmm/uffd-stats-layout.ts
48873
48966
  var UFFD_STATS_LAYOUT = {
@@ -48891,18 +48984,20 @@ async function startUffdHandler(plan) {
48891
48984
  ];
48892
48985
  const memFd = openSync8(plan.memFile, "r");
48893
48986
  const statsFd = createZeroedFile(paths.uffdStatsFile, UFFD_STATS_BYTES);
48987
+ const touchedFd = createZeroedFile(paths.uffdTouchedFile, 0);
48894
48988
  const log = setupLogFile(paths.logFile);
48895
48989
  const child = Bun.spawn(buildSpawnArgv(command, plan.cgroup?.procsPath ?? null, null), {
48896
- stdio: ["ignore", log, log, memFd, statsFd]
48990
+ stdio: ["ignore", log, log, memFd, statsFd, touchedFd]
48897
48991
  });
48898
48992
  closeSync10(memFd);
48899
48993
  closeSync10(statsFd);
48994
+ closeSync10(touchedFd);
48900
48995
  closeSync10(log);
48901
48996
  child.unref();
48902
48997
  writeRegularFile(paths.uffdPidFile, `${String(child.pid)}
48903
48998
  `);
48904
48999
  const deadline = Date.now() + SOCKET_WAIT_MS2;
48905
- while (!existsSync24(paths.uffdSocket)) {
49000
+ while (!existsSync25(paths.uffdSocket)) {
48906
49001
  if (child.exitCode !== null || Date.now() > deadline) {
48907
49002
  stopPid(child.pid);
48908
49003
  throw new Error(`the page handler did not open its socket (exit ${String(child.exitCode)}): ${readLogTail(paths.logFile, 5)}`);
@@ -48912,10 +49007,11 @@ async function startUffdHandler(plan) {
48912
49007
  return child.pid;
48913
49008
  }
48914
49009
  function removeUffdFiles(paths) {
48915
- rmSync26(paths.uffdSocket, { force: true });
48916
- rmSync26(`${paths.uffdSocket}.new`, { force: true });
48917
- rmSync26(paths.uffdPidFile, { force: true });
48918
- rmSync26(paths.uffdStatsFile, { force: true });
49010
+ rmSync27(paths.uffdSocket, { force: true });
49011
+ rmSync27(`${paths.uffdSocket}.new`, { force: true });
49012
+ rmSync27(paths.uffdPidFile, { force: true });
49013
+ rmSync27(paths.uffdStatsFile, { force: true });
49014
+ rmSync27(paths.uffdTouchedFile, { force: true });
48919
49015
  }
48920
49016
  function readUffdStats(paths, readFile) {
48921
49017
  const raw = readFile(paths.uffdStatsFile);
@@ -48926,7 +49022,7 @@ function readUffdStats(paths, readFile) {
48926
49022
  };
48927
49023
  }
48928
49024
  function readHandlerState(paths, procRoot = "/proc") {
48929
- if (!existsSync24(paths.uffdPidFile)) {
49025
+ if (!existsSync25(paths.uffdPidFile)) {
48930
49026
  return { state: "none" };
48931
49027
  }
48932
49028
  const pid = readPidFile(paths.uffdPidFile);
@@ -48961,7 +49057,7 @@ async function createTemplateVm(plan, jails, options = {}) {
48961
49057
  setupTemplateFile(plan.memFile);
48962
49058
  writeToDisk([plan.vmstate, plan.memFile, plan.snapshotDir]);
48963
49059
  } catch (error) {
48964
- rmSync27(plan.snapshotDir, { recursive: true, force: true });
49060
+ rmSync28(plan.snapshotDir, { recursive: true, force: true });
48965
49061
  throw new Error(`template build failed: ${getErrorMessage(error)}
48966
49062
  ${readLogTail(plan.paths.logFile)}`, { cause: error });
48967
49063
  }
@@ -49182,7 +49278,7 @@ async function startColdVm(context, start) {
49182
49278
  disk.isFailed = true;
49183
49279
  throw error;
49184
49280
  }
49185
- return statSync15(paths.disk).size;
49281
+ return statSync16(paths.disk).size;
49186
49282
  };
49187
49283
  const diskBytes = readDiskBytes();
49188
49284
  Promise.allSettled([diskBytes]);
@@ -50493,7 +50589,7 @@ function createMemoryController(deps) {
50493
50589
 
50494
50590
  // packages/daemon/src/vm/vmm/cpu-cgroups.ts
50495
50591
  import {
50496
- existsSync as existsSync25,
50592
+ existsSync as existsSync26,
50497
50593
  mkdirSync as mkdirSync23,
50498
50594
  readFileSync as readFileSync34,
50499
50595
  readdirSync as readdirSync14,
@@ -50601,7 +50697,7 @@ function createCpuCgroups(options) {
50601
50697
  isMemoryEnforced,
50602
50698
  setup,
50603
50699
  apply: (impId, cpu) => {
50604
- if (isEnforced && existsSync25(getDir(impId))) {
50700
+ if (isEnforced && existsSync26(getDir(impId))) {
50605
50701
  tryWrite(impId, "apply the limit", () => {
50606
50702
  writeSettings(impId, cpu, cpu.limit);
50607
50703
  });
@@ -50624,7 +50720,7 @@ function createCpuCgroups(options) {
50624
50720
  },
50625
50721
  setGuestMib: (impId, guestMib) => {
50626
50722
  guestMibs.set(impId, guestMib);
50627
- if (isMemoryEnforced && existsSync25(getDir(impId))) {
50723
+ if (isMemoryEnforced && existsSync26(getDir(impId))) {
50628
50724
  tryWrite(impId, "set the memory limit", () => {
50629
50725
  writeMemory(impId);
50630
50726
  });
@@ -50636,7 +50732,7 @@ function createCpuCgroups(options) {
50636
50732
  if (!isEnforced) {
50637
50733
  return;
50638
50734
  }
50639
- for (let attempt = 1;existsSync25(getDir(impId)); attempt += 1) {
50735
+ for (let attempt = 1;existsSync26(getDir(impId)); attempt += 1) {
50640
50736
  try {
50641
50737
  rmdir(getDir(impId));
50642
50738
  return;
@@ -50665,7 +50761,7 @@ function createCpuCgroups(options) {
50665
50761
  return orphans;
50666
50762
  },
50667
50763
  kill: (impId) => {
50668
- if (isEnforced && existsSync25(getDir(impId))) {
50764
+ if (isEnforced && existsSync26(getDir(impId))) {
50669
50765
  tryWrite(impId, "kill", () => {
50670
50766
  writeFileSync13(join39(getDir(impId), "cgroup.kill"), "1");
50671
50767
  });
@@ -50731,7 +50827,7 @@ function probeUffdDevice(path = "/dev/userfaultfd") {
50731
50827
  }
50732
50828
 
50733
50829
  // packages/daemon/src/vm/vmm/vm-runner.ts
50734
- import { lstatSync as lstatSync4, mkdirSync as mkdirSync24, renameSync as renameSync7, rmSync as rmSync28 } from "fs";
50830
+ import { lstatSync as lstatSync4, mkdirSync as mkdirSync24, renameSync as renameSync8, rmSync as rmSync29 } from "fs";
50735
50831
  import { systemClock as systemClock5 } from "@zgeoff/std";
50736
50832
 
50737
50833
  // packages/daemon/src/vm/vmm/build-boot-args.ts
@@ -50963,9 +51059,9 @@ ${readLogTail(plan.paths.logFile)}`, {
50963
51059
  setMark("pause");
50964
51060
  await api.createSnapshot(files, type);
50965
51061
  } catch (error) {
50966
- rmSync28(files.snapshotPath, { force: true });
50967
- rmSync28(files.memFilePath, { force: true });
50968
- rmSync28(paths.memFile, { force: true });
51062
+ rmSync29(files.snapshotPath, { force: true });
51063
+ rmSync29(files.memFilePath, { force: true });
51064
+ rmSync29(paths.memFile, { force: true });
50969
51065
  try {
50970
51066
  await api.resume();
50971
51067
  cgroup?.applyLimit();
@@ -50982,10 +51078,10 @@ ${readLogTail(plan.paths.logFile)}`, {
50982
51078
  for (const file of [files.snapshotPath, files.memFilePath]) {
50983
51079
  setupSnapshotFile(file, owner.gid);
50984
51080
  }
50985
- renameSync7(files.snapshotPath, target.vmstate);
50986
- renameSync7(files.memFilePath, target.memFile);
50987
- rmSync28(paths.apiSocket, { force: true });
50988
- rmSync28(paths.vsockSocket, { force: true });
51081
+ renameSync8(files.snapshotPath, target.vmstate);
51082
+ renameSync8(files.memFilePath, target.memFile);
51083
+ rmSync29(paths.apiSocket, { force: true });
51084
+ rmSync29(paths.vsockSocket, { force: true });
50989
51085
  const dug = await runCommand(["fallocate", "--dig-holes", target.memFile]);
50990
51086
  const digStep = dug.exitCode === 0 ? "digHoles" : "digHolesFailed";
50991
51087
  setMark(digStep);
@@ -51323,7 +51419,7 @@ function makeStandInVmRam(readRam) {
51323
51419
  }
51324
51420
 
51325
51421
  // packages/daemon/src/imp-ops/moves/move-receiver.ts
51326
- import { existsSync as existsSync27, rmSync as rmSync30 } from "fs";
51422
+ import { existsSync as existsSync28, rmSync as rmSync31 } from "fs";
51327
51423
  import { join as join41 } from "path";
51328
51424
 
51329
51425
  // packages/daemon/src/platform/db/probe-slot-free.ts
@@ -51648,7 +51744,7 @@ class MoveRequestError extends ImpdError {
51648
51744
  }
51649
51745
 
51650
51746
  // packages/daemon/src/imp-ops/moves/read-move-stream.ts
51651
- import { mkdirSync as mkdirSync26, rmSync as rmSync29 } from "fs";
51747
+ import { mkdirSync as mkdirSync26, rmSync as rmSync30 } from "fs";
51652
51748
  import { open as open7 } from "fs/promises";
51653
51749
  import { join as join40 } from "path";
51654
51750
  import invariant13 from "tiny-invariant";
@@ -51664,7 +51760,7 @@ config ${configContentSha256}
51664
51760
 
51665
51761
  // packages/daemon/src/imp-ops/moves/check-warm-move.ts
51666
51762
  import { createHash as createHash7 } from "crypto";
51667
- import { existsSync as existsSync26, mkdirSync as mkdirSync25, renameSync as renameSync8 } from "fs";
51763
+ import { existsSync as existsSync27, mkdirSync as mkdirSync25, renameSync as renameSync9 } from "fs";
51668
51764
  import { dirname as dirname15 } from "path";
51669
51765
 
51670
51766
  // packages/daemon/src/imp-ops/moves/read-warm-host.ts
@@ -51831,9 +51927,9 @@ async function writeSystemDrive(deps, temp, meta) {
51831
51927
  if (!isSameHash(sha256, meta.systemDrive)) {
51832
51928
  throw new MoveRequestError("BAD_REQUEST", "the system drive does not match its sha256");
51833
51929
  }
51834
- if (!existsSync26(path)) {
51930
+ if (!existsSync27(path)) {
51835
51931
  mkdirSync25(dirname15(path), { recursive: true });
51836
- renameSync8(temp, path);
51932
+ renameSync9(temp, path);
51837
51933
  }
51838
51934
  }
51839
51935
  async function readFileSha256(path) {
@@ -52359,7 +52455,7 @@ async function readMoveStream(deps, options) {
52359
52455
  await removeStagedImp(deps, header.imp.name, header.imp.id);
52360
52456
  throw error;
52361
52457
  } finally {
52362
- rmSync29(temp, { force: true });
52458
+ rmSync30(temp, { force: true });
52363
52459
  }
52364
52460
  await createGrants(deps, header);
52365
52461
  const receipt = buildReceipt({ ticketId: row.id, name: header.imp.name, impId: header.imp.id, files }, options.secret);
@@ -52460,8 +52556,8 @@ async function requireImage(deps, options) {
52460
52556
  }));
52461
52557
  return { name, files };
52462
52558
  } finally {
52463
- rmSync29(temps.rootfs, { force: true });
52464
- rmSync29(temps.config, { force: true });
52559
+ rmSync30(temps.rootfs, { force: true });
52560
+ rmSync30(temps.config, { force: true });
52465
52561
  }
52466
52562
  }
52467
52563
  async function createGrants(deps, header) {
@@ -52518,7 +52614,7 @@ function createMoveReceiver(deps) {
52518
52614
  const offer = async (offered) => {
52519
52615
  const digests = buildOfferedDigests(offered.imageDigest, offered.receivedImageDigest);
52520
52616
  const existing = await readImageInUse(deps.db, digests, deps.now());
52521
- const needsSystemDrive = offered.systemDrive !== undefined && !existsSync27(buildSystemDrivePath(deps.dataDir, offered.systemDrive));
52617
+ const needsSystemDrive = offered.systemDrive !== undefined && !existsSync28(buildSystemDrivePath(deps.dataDir, offered.systemDrive));
52522
52618
  return {
52523
52619
  needsImage: existing === undefined,
52524
52620
  needsSystemDrive,
@@ -52720,7 +52816,7 @@ function createMoveReceiver(deps) {
52720
52816
  await removeStagedImp(deps, imp.name, imp.id);
52721
52817
  }
52722
52818
  }
52723
- rmSync30(tempDir, { recursive: true, force: true });
52819
+ rmSync31(tempDir, { recursive: true, force: true });
52724
52820
  }
52725
52821
  };
52726
52822
  }
@@ -53694,7 +53790,7 @@ function createImpdMoves(config, deps, parts, hooks) {
53694
53790
  }
53695
53791
 
53696
53792
  // packages/daemon/src/imps/images/template-service.ts
53697
- import { copyFileSync as copyFileSync4, existsSync as existsSync28, statSync as statSync16, writeFileSync as writeFileSync14 } from "fs";
53793
+ import { copyFileSync as copyFileSync5, existsSync as existsSync29, statSync as statSync17, writeFileSync as writeFileSync14 } from "fs";
53698
53794
  import { join as join42 } from "path";
53699
53795
  import { systemClock as systemClock7 } from "@zgeoff/std";
53700
53796
 
@@ -53752,8 +53848,8 @@ function createTemplateService(deps) {
53752
53848
  const image = await readImageById(deps.db, imageId);
53753
53849
  const target = join42(directory, "config.json");
53754
53850
  const config = image === undefined ? undefined : buildImagePaths(deps.config.dataDir, image.digest).config;
53755
- if (config !== undefined && existsSync28(config)) {
53756
- copyFileSync4(config, target);
53851
+ if (config !== undefined && existsSync29(config)) {
53852
+ copyFileSync5(config, target);
53757
53853
  } else {
53758
53854
  writeFileSync14(target, "{}");
53759
53855
  }
@@ -53786,7 +53882,7 @@ function createTemplateService(deps) {
53786
53882
  digest,
53787
53883
  source: "imp",
53788
53884
  sourceImp: imp.name,
53789
- sizeBytes: statSync16(rootfs).blocks * 512
53885
+ sizeBytes: statSync17(rootfs).blocks * 512
53790
53886
  }, clock.now()).catch(async (error) => {
53791
53887
  await storage.removeImage(digest);
53792
53888
  throw error;
@@ -54154,14 +54250,14 @@ function updateImageAlias(db, alias, imageName, atMs) {
54154
54250
  }
54155
54251
 
54156
54252
  // packages/daemon/src/imps/images/build/create-image-builds.ts
54157
- import { existsSync as existsSync30, mkdirSync as mkdirSync27, rmSync as rmSync31, statSync as statSync17 } from "fs";
54253
+ import { existsSync as existsSync31, mkdirSync as mkdirSync27, rmSync as rmSync32, statSync as statSync18 } from "fs";
54158
54254
  import { join as join44, posix as posix3 } from "path";
54159
54255
 
54160
54256
  // packages/local-tar/src/create-local-extractor.ts
54161
54257
  import tar from "tar-stream";
54162
54258
  import * as z95 from "zod";
54163
54259
  // packages/local-tar/src/list-context-entries.ts
54164
- import { existsSync as existsSync29 } from "fs";
54260
+ import { existsSync as existsSync30 } from "fs";
54165
54261
  import { lstat, readFile as readFile5, readdir } from "fs/promises";
54166
54262
  import { join as join43, posix as posix2 } from "path";
54167
54263
  import ignore from "@balena/dockerignore";
@@ -54447,7 +54543,7 @@ class MissingDockerfileError extends Error {
54447
54543
  name = "MissingDockerfileError";
54448
54544
  }
54449
54545
  function listContextEntries(root, dockerfile) {
54450
- const found = listDockerfileCandidates(posix2.normalize(dockerfile)).find((candidate) => existsSync29(join43(root, candidate)));
54546
+ const found = listDockerfileCandidates(posix2.normalize(dockerfile)).find((candidate) => existsSync30(join43(root, candidate)));
54451
54547
  if (found === undefined) {
54452
54548
  return Promise.reject(new MissingDockerfileError(`there is no ${dockerfile} in ${root}`));
54453
54549
  }
@@ -54459,8 +54555,8 @@ var ENTRY_KINDS = [
54459
54555
  ["file", "isFile"]
54460
54556
  ];
54461
54557
  async function listEntries2(root, dockerfile) {
54462
- const ignoreName = existsSync29(join43(root, `${dockerfile}.dockerignore`)) ? `${dockerfile}.dockerignore` : ".dockerignore";
54463
- const patterns = existsSync29(join43(root, ignoreName)) ? await readFile5(join43(root, ignoreName), "utf8") : "";
54558
+ const ignoreName = existsSync30(join43(root, `${dockerfile}.dockerignore`)) ? `${dockerfile}.dockerignore` : ".dockerignore";
54559
+ const patterns = existsSync30(join43(root, ignoreName)) ? await readFile5(join43(root, ignoreName), "utf8") : "";
54464
54560
  const matcher = ignore().add(patterns);
54465
54561
  const hasExceptions = patterns.split(`
54466
54562
  `).some((line) => line.trim().startsWith("!"));
@@ -55839,7 +55935,7 @@ function createImageBuilds(deps, writer) {
55839
55935
  const imageName = requireClientImageName(name);
55840
55936
  await requireUnaliasedName(deps.db, imageName);
55841
55937
  const tag = `imp/${imageName}:latest`;
55842
- const tarBytes = statSync17(tarPath).size;
55938
+ const tarBytes = statSync18(tarPath).size;
55843
55939
  const dockerfilePath = normalizeDockerfilePath(givenDockerfile);
55844
55940
  const rewrittenPath = `${tarPath}.rewritten`;
55845
55941
  let pins = [];
@@ -55916,7 +56012,7 @@ function createImageBuilds(deps, writer) {
55916
56012
  }
55917
56013
  throw error;
55918
56014
  } finally {
55919
- rmSync31(rewrittenPath, { force: true });
56015
+ rmSync32(rewrittenPath, { force: true });
55920
56016
  }
55921
56017
  };
55922
56018
  const createOnHost = async (contextDir, name, dockerfile, options) => {
@@ -55926,7 +56022,7 @@ function createImageBuilds(deps, writer) {
55926
56022
  message: `build context ${JSON.stringify(contextDir)} is not an absolute path`
55927
56023
  });
55928
56024
  }
55929
- if (!existsSync30(contextDir)) {
56025
+ if (!existsSync31(contextDir)) {
55930
56026
  throw new ImpdError("BAD_REQUEST", {
55931
56027
  message: `build context ${contextDir} does not exist on the impd host; build the image there and use \`impz image add\``
55932
56028
  });
@@ -55953,7 +56049,7 @@ function createImageBuilds(deps, writer) {
55953
56049
  signal: options.signal ?? new AbortController().signal
55954
56050
  });
55955
56051
  } finally {
55956
- rmSync31(tarPath, { force: true });
56052
+ rmSync32(tarPath, { force: true });
55957
56053
  }
55958
56054
  });
55959
56055
  };
@@ -56098,7 +56194,7 @@ function buildImageRuntimeConfig(ociConfig) {
56098
56194
  }
56099
56195
 
56100
56196
  // packages/daemon/src/imps/images/rootfs/create-image-writer.ts
56101
- import { existsSync as existsSync31, mkdirSync as mkdirSync29, rmSync as rmSync33, statSync as statSync18, writeFileSync as writeFileSync15 } from "fs";
56197
+ import { existsSync as existsSync32, mkdirSync as mkdirSync29, rmSync as rmSync34, statSync as statSync19, writeFileSync as writeFileSync15 } from "fs";
56102
56198
  import { join as join46 } from "path";
56103
56199
 
56104
56200
  // packages/daemon/src/imps/images/rootfs/read-oci-config.ts
@@ -56118,7 +56214,7 @@ async function readOciConfig(ref, signal, run) {
56118
56214
  }
56119
56215
 
56120
56216
  // packages/daemon/src/imps/images/rootfs/write-image-config.ts
56121
- import { closeSync as closeSync11, constants as constants6, lstatSync as lstatSync5, mkdirSync as mkdirSync28, openSync as openSync9, rmSync as rmSync32, writeSync as writeSync3 } from "fs";
56217
+ import { closeSync as closeSync11, constants as constants6, lstatSync as lstatSync5, mkdirSync as mkdirSync28, openSync as openSync9, rmSync as rmSync33, writeSync as writeSync3 } from "fs";
56122
56218
  import { join as join45 } from "path";
56123
56219
  function writeImageConfig(root, contents) {
56124
56220
  const etc = join45(root, "etc");
@@ -56126,7 +56222,7 @@ function writeImageConfig(root, contents) {
56126
56222
  createDirectory(etc, "/etc");
56127
56223
  createDirectory(directory, "/etc/imp");
56128
56224
  const file = join45(directory, "image.json");
56129
- rmSync32(file, { recursive: true, force: true });
56225
+ rmSync33(file, { recursive: true, force: true });
56130
56226
  const fd = openSync9(file, constants6.O_WRONLY | constants6.O_CREAT | constants6.O_EXCL | constants6.O_NOFOLLOW, 420);
56131
56227
  try {
56132
56228
  writeSync3(fd, contents);
@@ -56261,7 +56357,7 @@ function createImageWriter(deps) {
56261
56357
  try {
56262
56358
  guest.signal.throwIfAborted();
56263
56359
  const sizeBytes = await createRootfsOnce(digest, () => {
56264
- if (existsSync31(rootfs)) {
56360
+ if (existsSync32(rootfs)) {
56265
56361
  return Promise.resolve(readDiskUsage(rootfs));
56266
56362
  }
56267
56363
  freshRootfs.add(digest);
@@ -56298,7 +56394,7 @@ function createImageWriter(deps) {
56298
56394
  signal
56299
56395
  });
56300
56396
  } finally {
56301
- rmSync33(workDir.work, { recursive: true, force: true });
56397
+ rmSync34(workDir.work, { recursive: true, force: true });
56302
56398
  }
56303
56399
  }));
56304
56400
  };
@@ -56333,7 +56429,7 @@ function createImageWriter(deps) {
56333
56429
  signal: new AbortController().signal
56334
56430
  });
56335
56431
  } finally {
56336
- rmSync33(workDir.work, { recursive: true, force: true });
56432
+ rmSync34(workDir.work, { recursive: true, force: true });
56337
56433
  }
56338
56434
  }));
56339
56435
  };
@@ -56365,7 +56461,7 @@ function parseDuCount(stdout) {
56365
56461
  return count;
56366
56462
  }
56367
56463
  function readDiskUsage(path) {
56368
- return statSync18(path).blocks * 512;
56464
+ return statSync19(path).blocks * 512;
56369
56465
  }
56370
56466
 
56371
56467
  // packages/daemon/src/imps/images/create-image-adds.ts
@@ -57390,7 +57486,7 @@ async function listPublicImpNames(db) {
57390
57486
  }
57391
57487
 
57392
57488
  // packages/daemon/src/network/https/acme/cert-store.ts
57393
- import { existsSync as existsSync32, mkdirSync as mkdirSync30, readFileSync as readFileSync37, rmSync as rmSync34 } from "fs";
57489
+ import { existsSync as existsSync33, mkdirSync as mkdirSync30, readFileSync as readFileSync37, rmSync as rmSync35 } from "fs";
57394
57490
  import { join as join48 } from "path";
57395
57491
  import * as z103 from "zod";
57396
57492
  var AttemptStateSchema = z103.object({
@@ -57450,7 +57546,7 @@ ${certificate.chainPem.trimEnd()}
57450
57546
  },
57451
57547
  readAccount: (directoryUrl) => {
57452
57548
  const account = readStoredAccount(directoryUrl);
57453
- rmSync34(legacyKeyPath, { force: true });
57549
+ rmSync35(legacyKeyPath, { force: true });
57454
57550
  return account?.directoryUrl === directoryUrl ? account : null;
57455
57551
  },
57456
57552
  writeAccount: (account) => {
@@ -57472,7 +57568,7 @@ ${certificate.chainPem.trimEnd()}
57472
57568
  };
57473
57569
  }
57474
57570
  function readIfExists(path) {
57475
- return existsSync32(path) ? readFileSync37(path, "utf8") : null;
57571
+ return existsSync33(path) ? readFileSync37(path, "utf8") : null;
57476
57572
  }
57477
57573
  function parseJson2(text) {
57478
57574
  try {
@@ -60748,7 +60844,7 @@ function startImpdLogCapture(onLine) {
60748
60844
  }
60749
60845
 
60750
60846
  // packages/testing/src/stand-in/vm/build-stub-vmm.ts
60751
- import { existsSync as existsSync33, mkdirSync as mkdirSync31, renameSync as renameSync9, writeFileSync as writeFileSync16 } from "fs";
60847
+ import { existsSync as existsSync34, mkdirSync as mkdirSync31, renameSync as renameSync10, writeFileSync as writeFileSync16 } from "fs";
60752
60848
  var STUB_AGENT_VERSION = "0.1.0";
60753
60849
  var IMPD_OWNER = { uid: process.getuid?.() ?? 0, cgroup: null };
60754
60850
 
@@ -60898,7 +60994,7 @@ log tail`);
60898
60994
  }),
60899
60995
  wakeVm: (plan) => runInGeneration(async () => {
60900
60996
  const files = [plan.paths.disk, plan.paths.vmstate, plan.paths.memFile];
60901
- wakeJails.push({ jail: plan.jail, files: files.filter((file) => existsSync33(file)) });
60997
+ wakeJails.push({ jail: plan.jail, files: files.filter((file) => existsSync34(file)) });
60902
60998
  wakePlans.push(plan);
60903
60999
  const drive = readLoadingMeta(plan.paths)?.systemDrivePath;
60904
61000
  if (plan.jail !== null && drive !== undefined && !plan.readOnlyFiles.includes(drive)) {
@@ -60936,8 +61032,8 @@ log tail`);
60936
61032
  mkdirSync31(target.snapshotDir, { recursive: true });
60937
61033
  writeFileSync16(`${target.vmstate}.new`, "vmstate");
60938
61034
  writeFileSync16(`${target.memFile}.new`, "mem");
60939
- renameSync9(`${target.vmstate}.new`, target.vmstate);
60940
- renameSync9(`${target.memFile}.new`, target.memFile);
61035
+ renameSync10(`${target.vmstate}.new`, target.vmstate);
61036
+ renameSync10(`${target.memFile}.new`, target.memFile);
60941
61037
  usedSnapshots.delete(target.snapshotDir);
60942
61038
  return {};
60943
61039
  }),
@@ -61152,7 +61248,7 @@ log tail`);
61152
61248
  }
61153
61249
 
61154
61250
  // packages/testing/src/stand-in/vm/create-stub-uffd-handler.ts
61155
- import { existsSync as existsSync34, readFileSync as readFileSync40, writeFileSync as writeFileSync17 } from "fs";
61251
+ import { existsSync as existsSync35, readFileSync as readFileSync40, writeFileSync as writeFileSync17 } from "fs";
61156
61252
  import { join as join50 } from "path";
61157
61253
  import * as z105 from "zod";
61158
61254
  var StartSchema = z105.object({
@@ -61164,8 +61260,10 @@ var StartSchema = z105.object({
61164
61260
  served: z105.string()
61165
61261
  });
61166
61262
  var WarmRunSchema = z105.object({
61167
- mode: z105.enum(["--count-data", "--warm"]),
61263
+ mode: z105.enum(["--count-data", "--warm", "--count-blocks", "--warm-blocks"]),
61168
61264
  memFile: z105.string(),
61265
+ blockList: z105.string().optional(),
61266
+ limit: z105.int().optional(),
61169
61267
  pid: z105.int()
61170
61268
  });
61171
61269
  function createStubUffdHandler(directory, mode = "serve") {
@@ -61186,7 +61284,7 @@ exec '${process.execPath}' '${script}' '${mode}' '${recorded}' '${warmAnswer}' "
61186
61284
  };
61187
61285
  }
61188
61286
  function readRecords(path, schema) {
61189
- return existsSync34(path) ? readFileSync40(path, "utf8").trimEnd().split(`
61287
+ return existsSync35(path) ? readFileSync40(path, "utf8").trimEnd().split(`
61190
61288
  `).map((line) => schema.parse(JSON.parse(line))) : [];
61191
61289
  }
61192
61290
 
@@ -61244,7 +61342,7 @@ async function startTestImpd(stack, options = {}) {
61244
61342
  const logs = [];
61245
61343
  const filesystemGrows = [];
61246
61344
  const cloneDisk = options.cloneDisk ?? ((source, target) => {
61247
- copyFileSync5(source, target);
61345
+ copyFileSync6(source, target);
61248
61346
  return Promise.resolve();
61249
61347
  });
61250
61348
  const createStorage = () => options.createStorage?.(dataDir) ?? createXfsBackend({ dataDir, cloneFile: cloneDisk });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impz/testing",
3
- "version": "7.9.0",
3
+ "version": "7.11.0",
4
4
  "description": "A real impd on stand-ins, for Bun tests of code that drives impd through @impz/client",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -47,7 +47,7 @@
47
47
  "ts-pattern": "^5.9.2",
48
48
  "xstate": "^5.33.3",
49
49
  "zod": "^4.6.7",
50
- "@impz/client": "7.9.0"
50
+ "@impz/client": "7.11.0"
51
51
  },
52
52
  "engines": {
53
53
  "bun": ">=1.4.3"