rightsize 0.7.14 → 0.7.15
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/README.md +3 -1
- package/dist/backend-msb/backend.d.ts +26 -8
- package/dist/backend-msb/backend.d.ts.map +1 -1
- package/dist/backend-msb/backend.js +47 -10
- package/dist/backend-msb/backend.js.map +1 -1
- package/dist/backend-msb/commands.d.ts +30 -20
- package/dist/backend-msb/commands.d.ts.map +1 -1
- package/dist/backend-msb/commands.js +63 -39
- package/dist/backend-msb/commands.js.map +1 -1
- package/dist/backend-msb/provisioner.d.ts +1 -1
- package/dist/backend-msb/provisioner.js +1 -1
- package/dist/backend-msb/restore-missing-bindings.d.ts +38 -0
- package/dist/backend-msb/restore-missing-bindings.d.ts.map +1 -0
- package/dist/backend-msb/restore-missing-bindings.js +40 -0
- package/dist/backend-msb/restore-missing-bindings.js.map +1 -0
- package/dist/core/backend.d.ts +6 -0
- package/dist/core/backend.d.ts.map +1 -1
- package/dist/core/checkpoint/copied-files.d.ts +16 -0
- package/dist/core/checkpoint/copied-files.d.ts.map +1 -0
- package/dist/core/checkpoint/copied-files.js +29 -0
- package/dist/core/checkpoint/copied-files.js.map +1 -0
- package/dist/core/errors.d.ts +67 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +82 -2
- package/dist/core/errors.js.map +1 -1
- package/dist/core/generic-container.d.ts +28 -4
- package/dist/core/generic-container.d.ts.map +1 -1
- package/dist/core/generic-container.js +38 -4
- package/dist/core/generic-container.js.map +1 -1
- package/dist/core/model.d.ts +12 -3
- package/dist/core/model.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `SOURCE:GUEST:OPTIONS` value of one copied file, shared by `run()`'s
|
|
3
|
+
* `--mount-file` and `restore()`'s `--volume` so the two cannot drift. The
|
|
4
|
+
* option block is always spelled out, never left to msb's defaults, for two
|
|
5
|
+
* reasons on top of each other. The access token (`ro`/`rw`) carries
|
|
6
|
+
* FileMount.readOnly, which msb enforces as a genuine guest-side write block — and it
|
|
7
|
+
* keeps OUR spec parseable on Windows: msb stages each mount into a temp directory
|
|
8
|
+
* and canonicalizes it, which there yields the extended-length `\\?\C:\...` form, and
|
|
9
|
+
* its splitter skips a drive prefix only for a bare drive letter, so a spec with no
|
|
10
|
+
* option block splits at the drive's colon and rejects the path tail as options.
|
|
11
|
+
* `nodev` exists because msb then rebuilds an INTERNAL `tag:staged_path[:opts]` spec
|
|
12
|
+
* for the same mount, carrying over only NON-DEFAULT option tokens — `rw` is its
|
|
13
|
+
* default and is dropped, which on Windows strips the internal spec's option block
|
|
14
|
+
* and re-creates the same misparse one layer down (captured: `--mount
|
|
15
|
+
* "fm_…:\\?\C:\…": expected flag or key=value option`). `nodev` always survives the
|
|
16
|
+
* carry-over, and for a single-file mount it is meaningless (no device nodes to
|
|
17
|
+
* block): verified against a real msb 0.6.8 — `rw,nodev` mounts `rw,nodev` and
|
|
18
|
+
* accepts an in-guest write, `ro,nodev` rejects one with `Read-only file system`.
|
|
19
|
+
*
|
|
20
|
+
* `--volume` and `--mount-file` go through the same shared mount-spec parser,
|
|
21
|
+
* which splits `SOURCE:/guest[:options]` at the colon before the absolute guest
|
|
22
|
+
* path and skips a Windows drive colon (`find_guest_path_separator` /
|
|
23
|
+
* `is_windows_drive_separator` in msb's `crates/cli/lib/commands/common.rs`),
|
|
24
|
+
* so the host path goes in as the OS gives it, with no conversion.
|
|
25
|
+
*/
|
|
26
|
+
function fileMountValue(mount) {
|
|
27
|
+
return `${mount.hostPath}:${mount.guestPath}:${mount.readOnly ? "ro" : "rw"},nodev`;
|
|
28
|
+
}
|
|
1
29
|
/**
|
|
2
30
|
* Pure msb CLI argv construction. Every spelling here was checked against the
|
|
3
31
|
* real `msb` binary, not guessed from `--help` text alone. ATTACHED mode (no
|
|
@@ -47,23 +75,10 @@ export const MsbCommands = {
|
|
|
47
75
|
for (const [key, value] of spec.env) {
|
|
48
76
|
argv.push("-e", `${key}=${value}`);
|
|
49
77
|
}
|
|
50
|
-
// The
|
|
51
|
-
//
|
|
52
|
-
// FileMount.readOnly, which msb enforces as a genuine guest-side write block — and it
|
|
53
|
-
// keeps OUR spec parseable on Windows: msb stages each mount into a temp directory
|
|
54
|
-
// and canonicalizes it, which there yields the extended-length `\\?\C:\...` form, and
|
|
55
|
-
// its splitter skips a drive prefix only for a bare drive letter, so a spec with no
|
|
56
|
-
// option block splits at the drive's colon and rejects the path tail as options.
|
|
57
|
-
// `nodev` exists because msb then rebuilds an INTERNAL `tag:staged_path[:opts]` spec
|
|
58
|
-
// for the same mount, carrying over only NON-DEFAULT option tokens — `rw` is its
|
|
59
|
-
// default and is dropped, which on Windows strips the internal spec's option block
|
|
60
|
-
// and re-creates the same misparse one layer down (captured: `--mount
|
|
61
|
-
// "fm_…:\\?\C:\…": expected flag or key=value option`). `nodev` always survives the
|
|
62
|
-
// carry-over, and for a single-file mount it is meaningless (no device nodes to
|
|
63
|
-
// block): verified against a real msb 0.6.8 — `rw,nodev` mounts `rw,nodev` and
|
|
64
|
-
// accepts an in-guest write, `ro,nodev` rejects one with `Read-only file system`.
|
|
78
|
+
// The value comes from `fileMountValue`, which also builds restore()'s
|
|
79
|
+
// `--volume`; see its doc for why the option block is always spelled out.
|
|
65
80
|
for (const mount of spec.mounts) {
|
|
66
|
-
argv.push("--mount-file",
|
|
81
|
+
argv.push("--mount-file", fileMountValue(mount));
|
|
67
82
|
}
|
|
68
83
|
// `checkpointRef` never reaches here: msb 0.7.1 removed `run --from-snapshot`
|
|
69
84
|
// outright (clap rejects it as an unexpected argument now), so a spec that
|
|
@@ -78,8 +93,8 @@ export const MsbCommands = {
|
|
|
78
93
|
return argv;
|
|
79
94
|
},
|
|
80
95
|
/**
|
|
81
|
-
* `msb restore <ref> --name <name> [-m SIZE] [--no-net] [
|
|
82
|
-
* SOURCE:GUEST:OPTS]
|
|
96
|
+
* `msb restore <ref> --name <name> [-m SIZE] [--no-net] [-p HOST:GUEST]...
|
|
97
|
+
* [--volume SOURCE:GUEST:OPTS]...` — the checkpoint-reboot argv,
|
|
83
98
|
* replacing the removed `run --from-snapshot` (msb 0.7.1 moved restore to
|
|
84
99
|
* this dedicated subcommand). NEVER emits `--disk-only`: EMPIRICALLY
|
|
85
100
|
* VERIFIED against a real msb 0.7.1 binary, a disk-scope snapshot — the
|
|
@@ -105,30 +120,40 @@ export const MsbCommands = {
|
|
|
105
120
|
* call.
|
|
106
121
|
*
|
|
107
122
|
* Mounts and network are NOT in that category — they thread through here,
|
|
108
|
-
* mirroring `run()`'s own `--mount-file`/`--net private`.
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* `
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
123
|
+
* mirroring `run()`'s own `--mount-file`/`--net private`. A file added with
|
|
124
|
+
* `.withCopyFileToContainer()` is a start-time bind mount of a host file, so
|
|
125
|
+
* a snapshot does NOT capture its content. Per msb's own source
|
|
126
|
+
* (`sdk/rust/lib/sandbox/restore_builder.rs`'s `RestoreBuilder::new`),
|
|
127
|
+
* every restore starts with `mounts`/`ports`/`vsock` CLEARED: they are the
|
|
128
|
+
* destination's OWN fresh bindings for this specific restore, not something
|
|
129
|
+
* msb re-derives from the snapshot. Verified live: a plain restore of such
|
|
130
|
+
* a snapshot brings the file back EMPTY on msb 0.7.6 and is REFUSED on
|
|
131
|
+
* 0.7.8 (`restore requires destination bindings for: mount <path>`, see
|
|
132
|
+
* `isRestoreMissingBindingsFailure`), while `--volume HOST:GUEST` supplies
|
|
133
|
+
* the file again with its content intact on both. `createCheckpoint`'s
|
|
115
134
|
* stop/snapshot/reboot cycle (see `MsbCliBackend.createCheckpoint`) hands
|
|
116
135
|
* this function `handle.spec` itself — the ORIGINAL sandbox's live
|
|
117
136
|
* `mounts`/`networkDisabled` exactly as the caller set them via
|
|
118
137
|
* `.withCopyFileToContainer()`/`.withNetworkDisabled()`, not anything
|
|
119
138
|
* "carried over from a captured spec" — so they must be re-emitted here or
|
|
120
|
-
* they
|
|
121
|
-
*
|
|
122
|
-
* `
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* `
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
139
|
+
* they vanish across the reboot (an empty file on 0.7.6, a refused restore
|
|
140
|
+
* on 0.7.8). The host files must therefore still exist when the reboot
|
|
141
|
+
* runs; `requireCopiedHostFilesExist` checks that before the source
|
|
142
|
+
* sandbox is touched. Every restore this backend makes builds its argv
|
|
143
|
+
* here (direct, brokered, retried and fresh-name attempts alike), so one
|
|
144
|
+
* `--volume` per mount reaches all of them.
|
|
145
|
+
* `GenericContainer.fromCheckpoint()` is the unrelated case: it never
|
|
146
|
+
* copies `cp.spec.mounts`/`networkDisabled` onto the new container's own
|
|
147
|
+
* builder state in the first place (see its own doc), so a
|
|
148
|
+
* `fromCheckpoint()` container's `spec.mounts` is `[]` and
|
|
149
|
+
* `networkDisabled` is `false` unless the caller adds them back explicitly
|
|
150
|
+
* via `.withCopyFileToContainer()`/`.withNetworkDisabled()` on it directly —
|
|
130
151
|
* in which case this function threads those through exactly the same as
|
|
131
|
-
* for any other spec, as it should.
|
|
152
|
+
* for any other spec, as it should. A copied file left out there makes
|
|
153
|
+
* msb 0.7.8 refuse the restore, which `bootRestoreOnce` turns into
|
|
154
|
+
* `CheckpointMissingCopiedFilesError`; this function never passes
|
|
155
|
+
* `--allow-missing-resources` to get past that. A `--volume` for a guest
|
|
156
|
+
* path the snapshot never had is accepted by both versions.
|
|
132
157
|
*
|
|
133
158
|
* `--volume SOURCE:GUEST[:OPTIONS]` is restore's own mount flag (`-v`
|
|
134
159
|
* short form; `RestoreResourceArgs.volume` in
|
|
@@ -181,9 +206,8 @@ export const MsbCommands = {
|
|
|
181
206
|
argv.push("-p", `${port.hostPort}:${port.guestPort}${port.protocol === "udp" ? "/udp" : ""}`);
|
|
182
207
|
}
|
|
183
208
|
for (const mount of spec.mounts) {
|
|
184
|
-
//
|
|
185
|
-
|
|
186
|
-
argv.push("--volume", `${mount.hostPath}:${mount.guestPath}:${mount.readOnly ? "ro" : "rw"},nodev`);
|
|
209
|
+
// The very value `run()` hands `--mount-file` — see `fileMountValue`.
|
|
210
|
+
argv.push("--volume", fileMountValue(mount));
|
|
187
211
|
}
|
|
188
212
|
return argv;
|
|
189
213
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/backend-msb/commands.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,GAAG,CAAC,IAAmB;QACrB,MAAM,IAAI,GAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;YACrC,uEAAuE;YACvE,oEAAoE;YACpE,kDAAkD;YAClD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;QAC5C,CAAC;QACD,2EAA2E;QAC3E,2EAA2E;QAC3E,+CAA+C;QAC/C,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACnD,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACzD,CAAC;QACD,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,OA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C;IACpC,CAAC;IAED;;;;;;;OAOG;IACH,WAAW,CAAC,SAAiB;QAC3B,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IACxC,CAAC;CACF,CAAC"}
|
|
@@ -4,7 +4,7 @@ import type { Platform } from "./platform.js";
|
|
|
4
4
|
* while msb 0.6.10-0.6.13 were broken on Windows (fixed upstream in 0.6.14).
|
|
5
5
|
* MSB_PATH users on Windows must avoid 0.6.10-0.6.13.
|
|
6
6
|
*/
|
|
7
|
-
export declare const MSB_VERSION = "0.7.
|
|
7
|
+
export declare const MSB_VERSION = "0.7.8";
|
|
8
8
|
/** Test seam: the full resolution logic parameterized over the release base URL, cache dir, and environment. */
|
|
9
9
|
export declare function ensureInstalledAt(baseUrl: string, cacheDir: string, env: Record<string, string | undefined>): Promise<string>;
|
|
10
10
|
/** Resolves (downloading and verifying if needed) a runnable `msb` binary path, using the real GitHub release base, `RIGHTSIZE_CACHE_DIR`, and `process.env`. */
|
|
@@ -12,7 +12,7 @@ import { PlatformInfo } from "./platform.js";
|
|
|
12
12
|
* while msb 0.6.10-0.6.13 were broken on Windows (fixed upstream in 0.6.14).
|
|
13
13
|
* MSB_PATH users on Windows must avoid 0.6.10-0.6.13.
|
|
14
14
|
*/
|
|
15
|
-
export const MSB_VERSION = "0.7.
|
|
15
|
+
export const MSB_VERSION = "0.7.8";
|
|
16
16
|
function releaseBaseUrl(version) {
|
|
17
17
|
return `https://github.com/superradcompany/microsandbox/releases/download/v${version}`;
|
|
18
18
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True if `output` (an `msb restore` invocation's combined stdout/stderr) is
|
|
3
|
+
* msb refusing to restore a snapshot whose source sandbox had files copied in
|
|
4
|
+
* at start (`withCopyFileToContainer`), because the restore did not supply a
|
|
5
|
+
* destination for each of them. A copied file is a start-time bind mount of a
|
|
6
|
+
* host file, so the snapshot holds no content for it; msb 0.7.8 records the
|
|
7
|
+
* mount in the snapshots it creates and refuses to restore without it.
|
|
8
|
+
* Captured from msb 0.7.8:
|
|
9
|
+
*
|
|
10
|
+
* ```text
|
|
11
|
+
* error: invalid config: restore requires destination bindings for: mount /etc/app/b.conf; provide a destination mount for each path or explicitly allow missing resources
|
|
12
|
+
* → map each path with -v SOURCE:GUEST or --mount-disk SOURCE:GUEST
|
|
13
|
+
* → or pass --allow-missing-resources to start without them
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* The 0.7.6 binary carries the same sentence with `invalid config:` missing
|
|
17
|
+
* in front and a different tail (`; provide --volume mappings, select
|
|
18
|
+
* captured disks with --volume GUEST, or explicitly use
|
|
19
|
+
* --allow-missing-resources`), used for other restore shapes. A snapshot
|
|
20
|
+
* taken by 0.7.6 does not carry the mount record, so restoring it never
|
|
21
|
+
* produces this refusal: the file comes back empty.
|
|
22
|
+
*
|
|
23
|
+
* Matches only the stable sentence `restore requires destination bindings
|
|
24
|
+
* for`, with any run of whitespace (a wrapped line included) between the
|
|
25
|
+
* words. It does not depend on the `invalid config:` prefix, the version-
|
|
26
|
+
* specific tail, the hint lines, the arrows or the line structure, all of
|
|
27
|
+
* which change with the msb version and with how a Windows host captures the
|
|
28
|
+
* output (PowerShell decorates the first line with `msb.exe : ` and mangles
|
|
29
|
+
* the arrow). The entries after `for:` can be disk entries as well as `mount
|
|
30
|
+
* <path>`, so nothing here parses them.
|
|
31
|
+
*
|
|
32
|
+
* The caller must not retry on a match: the same restore is refused the same
|
|
33
|
+
* way every time. It must also never answer the refusal by passing
|
|
34
|
+
* `--allow-missing-resources`, which would start the sandbox with the copied
|
|
35
|
+
* files silently absent.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isRestoreMissingBindingsFailure(output: string): boolean;
|
|
38
|
+
//# sourceMappingURL=restore-missing-bindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore-missing-bindings.d.ts","sourceRoot":"","sources":["../../src/backend-msb/restore-missing-bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEvE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True if `output` (an `msb restore` invocation's combined stdout/stderr) is
|
|
3
|
+
* msb refusing to restore a snapshot whose source sandbox had files copied in
|
|
4
|
+
* at start (`withCopyFileToContainer`), because the restore did not supply a
|
|
5
|
+
* destination for each of them. A copied file is a start-time bind mount of a
|
|
6
|
+
* host file, so the snapshot holds no content for it; msb 0.7.8 records the
|
|
7
|
+
* mount in the snapshots it creates and refuses to restore without it.
|
|
8
|
+
* Captured from msb 0.7.8:
|
|
9
|
+
*
|
|
10
|
+
* ```text
|
|
11
|
+
* error: invalid config: restore requires destination bindings for: mount /etc/app/b.conf; provide a destination mount for each path or explicitly allow missing resources
|
|
12
|
+
* → map each path with -v SOURCE:GUEST or --mount-disk SOURCE:GUEST
|
|
13
|
+
* → or pass --allow-missing-resources to start without them
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* The 0.7.6 binary carries the same sentence with `invalid config:` missing
|
|
17
|
+
* in front and a different tail (`; provide --volume mappings, select
|
|
18
|
+
* captured disks with --volume GUEST, or explicitly use
|
|
19
|
+
* --allow-missing-resources`), used for other restore shapes. A snapshot
|
|
20
|
+
* taken by 0.7.6 does not carry the mount record, so restoring it never
|
|
21
|
+
* produces this refusal: the file comes back empty.
|
|
22
|
+
*
|
|
23
|
+
* Matches only the stable sentence `restore requires destination bindings
|
|
24
|
+
* for`, with any run of whitespace (a wrapped line included) between the
|
|
25
|
+
* words. It does not depend on the `invalid config:` prefix, the version-
|
|
26
|
+
* specific tail, the hint lines, the arrows or the line structure, all of
|
|
27
|
+
* which change with the msb version and with how a Windows host captures the
|
|
28
|
+
* output (PowerShell decorates the first line with `msb.exe : ` and mangles
|
|
29
|
+
* the arrow). The entries after `for:` can be disk entries as well as `mount
|
|
30
|
+
* <path>`, so nothing here parses them.
|
|
31
|
+
*
|
|
32
|
+
* The caller must not retry on a match: the same restore is refused the same
|
|
33
|
+
* way every time. It must also never answer the refusal by passing
|
|
34
|
+
* `--allow-missing-resources`, which would start the sandbox with the copied
|
|
35
|
+
* files silently absent.
|
|
36
|
+
*/
|
|
37
|
+
export function isRestoreMissingBindingsFailure(output) {
|
|
38
|
+
return /restore\s+requires\s+destination\s+bindings\s+for/i.test(output);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=restore-missing-bindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore-missing-bindings.js","sourceRoot":"","sources":["../../src/backend-msb/restore-missing-bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,+BAA+B,CAAC,MAAc;IAC5D,OAAO,oDAAoD,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC3E,CAAC"}
|
package/dist/core/backend.d.ts
CHANGED
|
@@ -134,6 +134,12 @@ export interface SandboxBackend {
|
|
|
134
134
|
* the named-checkpoint registry and on the `Checkpoint` it hands back,
|
|
135
135
|
* never `ref` itself. Never called on a backend whose
|
|
136
136
|
* `capabilities.checkpoint` is `false`.
|
|
137
|
+
*
|
|
138
|
+
* Files copied in at start (`handle.spec.mounts`) are bind mounts of host
|
|
139
|
+
* files and are not part of what either backend captures. Docker leaves
|
|
140
|
+
* them as they are. Microsandbox boots the sandbox again from its snapshot,
|
|
141
|
+
* so it mounts each one again from its host file, and throws
|
|
142
|
+
* `CheckpointHostFileMissingError` before stopping anything if one is gone.
|
|
137
143
|
*/
|
|
138
144
|
createCheckpoint(handle: SandboxHandle, ref: string): Promise<string>;
|
|
139
145
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/core/backend.ts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a,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,mEAAmE;IACnE,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,+FAA+F;IAC/F,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7F;;;;;;;;;;OAUG;IACH,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,qJAAqJ;IACrJ,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjG,kFAAkF;IAClF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,2FAA2F;IAC3F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2HAA2H;IAC3H,WAAW,IAAI,OAAO,CAAC;IACvB,8GAA8G;IAC9G,iBAAiB,IAAI,MAAM,CAAC;IAC5B,8EAA8E;IAC9E,MAAM,IAAI,cAAc,CAAC;CAC1B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FileMount } from "../model.js";
|
|
2
|
+
/**
|
|
3
|
+
* Throws `CheckpointHostFileMissingError` for the first mount, in spec order,
|
|
4
|
+
* whose host file is gone. Used by the microsandbox checkpoint, which stops the
|
|
5
|
+
* container, snapshots it and boots it again with `msb restore --volume` for
|
|
6
|
+
* every copied file, so each host file has to exist before the first of those
|
|
7
|
+
* steps. A snapshot holds no content for a copied file, and a boot that finds
|
|
8
|
+
* the host file missing would come after the source sandbox is already gone.
|
|
9
|
+
*
|
|
10
|
+
* Only "no such file or directory" counts as missing. Any other `stat` failure
|
|
11
|
+
* (a permission error on a parent directory, say) is left for msb to report
|
|
12
|
+
* with its own message, so this never claims a file no longer exists when it
|
|
13
|
+
* might still.
|
|
14
|
+
*/
|
|
15
|
+
export declare function requireCopiedHostFilesExist(mounts: readonly FileMount[]): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=copied-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copied-files.d.ts","sourceRoot":"","sources":["../../../src/core/checkpoint/copied-files.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,wBAAsB,2BAA2B,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAW7F"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import { CheckpointHostFileMissingError } from "../errors.js";
|
|
3
|
+
/**
|
|
4
|
+
* Throws `CheckpointHostFileMissingError` for the first mount, in spec order,
|
|
5
|
+
* whose host file is gone. Used by the microsandbox checkpoint, which stops the
|
|
6
|
+
* container, snapshots it and boots it again with `msb restore --volume` for
|
|
7
|
+
* every copied file, so each host file has to exist before the first of those
|
|
8
|
+
* steps. A snapshot holds no content for a copied file, and a boot that finds
|
|
9
|
+
* the host file missing would come after the source sandbox is already gone.
|
|
10
|
+
*
|
|
11
|
+
* Only "no such file or directory" counts as missing. Any other `stat` failure
|
|
12
|
+
* (a permission error on a parent directory, say) is left for msb to report
|
|
13
|
+
* with its own message, so this never claims a file no longer exists when it
|
|
14
|
+
* might still.
|
|
15
|
+
*/
|
|
16
|
+
export async function requireCopiedHostFilesExist(mounts) {
|
|
17
|
+
for (const mount of mounts) {
|
|
18
|
+
try {
|
|
19
|
+
await fs.stat(mount.hostPath);
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
const code = err.code;
|
|
23
|
+
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
24
|
+
throw new CheckpointHostFileMissingError(mount.guestPath, mount.hostPath);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=copied-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copied-files.js","sourceRoot":"","sources":["../../../src/core/checkpoint/copied-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAG9D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,MAA4B;IAC5E,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,GAAI,GAA6B,CAAC,IAAI,CAAC;YACjD,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC5C,MAAM,IAAI,8BAA8B,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -42,7 +42,11 @@ export declare class ContainerLaunchError extends Error {
|
|
|
42
42
|
}
|
|
43
43
|
/** Thrown on subprocess/daemon failures; message carries full stderr/body. */
|
|
44
44
|
export declare class BackendError extends Error {
|
|
45
|
-
|
|
45
|
+
/** The underlying error this one wraps, when there is one. */
|
|
46
|
+
readonly cause?: unknown | undefined;
|
|
47
|
+
constructor(message: string,
|
|
48
|
+
/** The underlying error this one wraps, when there is one. */
|
|
49
|
+
cause?: unknown | undefined);
|
|
46
50
|
}
|
|
47
51
|
/** Thrown when the msb toolchain provisioner can't get a runnable `msb` binary in place (download, checksum, or lock failure). */
|
|
48
52
|
export declare class ProvisionError extends Error {
|
|
@@ -300,4 +304,66 @@ export declare class CheckpointWorkloadCommandMissingError extends Error {
|
|
|
300
304
|
/** The checkpoint ref being restored. */
|
|
301
305
|
ref: string);
|
|
302
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Thrown by `checkpoint()` on microsandbox when a file added with
|
|
309
|
+
* `withCopyFileToContainer` has lost its host file. Copied files are not part
|
|
310
|
+
* of a checkpoint: they are start-time mounts of host files, so a snapshot
|
|
311
|
+
* holds no content for them. microsandbox's `checkpoint()` stops the
|
|
312
|
+
* container, snapshots it and boots it again, and that boot mounts each copied
|
|
313
|
+
* file again from its host file, so the host file has to still be there.
|
|
314
|
+
*
|
|
315
|
+
* Thrown from two places, both before any destructive step:
|
|
316
|
+
* `GenericContainer.checkpoint()` itself (ahead of the named-checkpoint replace
|
|
317
|
+
* semantics' removal of whatever currently sits under the same ref, so a
|
|
318
|
+
* refused re-checkpoint never replaces a prior checkpoint) and, redundantly,
|
|
319
|
+
* `MsbCliBackend.createCheckpoint` (ahead of stopping the sandbox) for any
|
|
320
|
+
* caller that reaches the backend directly. docker never throws it: its
|
|
321
|
+
* checkpoint is a commit of the running container and does not reboot it.
|
|
322
|
+
*/
|
|
323
|
+
export declare class CheckpointHostFileMissingError extends Error {
|
|
324
|
+
/** The guest path the copied file is mounted at. */
|
|
325
|
+
readonly guestPath: string;
|
|
326
|
+
/** The host file that was meant to back it and no longer exists. */
|
|
327
|
+
readonly hostPath: string;
|
|
328
|
+
constructor(
|
|
329
|
+
/** The guest path the copied file is mounted at. */
|
|
330
|
+
guestPath: string,
|
|
331
|
+
/** The host file that was meant to back it and no longer exists. */
|
|
332
|
+
hostPath: string);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Thrown when microsandbox refuses to restore a checkpoint because the
|
|
336
|
+
* container it was taken from had files copied in with
|
|
337
|
+
* `withCopyFileToContainer`. Those files are mounts of host files, not part of
|
|
338
|
+
* the checkpoint. msb 0.7.8 records them in the snapshots it creates and
|
|
339
|
+
* refuses a restore that does not supply each one again; a snapshot made by an
|
|
340
|
+
* older msb restores with the file empty instead. msb's own output lists the
|
|
341
|
+
* missing guest paths and is carried in `output` and in the message.
|
|
342
|
+
*
|
|
343
|
+
* The remedy is to add the same files again, at the same guest paths, on the
|
|
344
|
+
* container started from the checkpoint:
|
|
345
|
+
* `GenericContainer.fromCheckpoint(cp).withCopyFileToContainer(...)`. Never
|
|
346
|
+
* retried: another attempt would be refused the same way.
|
|
347
|
+
*
|
|
348
|
+
* Thrown by `start()` on a container built with `fromCheckpoint()`. It could
|
|
349
|
+
* also come from `checkpoint()`'s own reboot, which supplies the container's
|
|
350
|
+
* copied files itself, so only a container whose mounts the library could not
|
|
351
|
+
* see would reach that. docker never throws it: it cannot tell, and starts the
|
|
352
|
+
* container with the path left empty.
|
|
353
|
+
*/
|
|
354
|
+
export declare class CheckpointMissingCopiedFilesError extends Error {
|
|
355
|
+
/** The sandbox the restore was meant to create. */
|
|
356
|
+
readonly sandbox: string;
|
|
357
|
+
/** The checkpoint ref being restored. */
|
|
358
|
+
readonly ref: string;
|
|
359
|
+
/** msb's own output for the refused restore; it names the missing guest paths. */
|
|
360
|
+
readonly output: string;
|
|
361
|
+
constructor(
|
|
362
|
+
/** The sandbox the restore was meant to create. */
|
|
363
|
+
sandbox: string,
|
|
364
|
+
/** The checkpoint ref being restored. */
|
|
365
|
+
ref: string,
|
|
366
|
+
/** msb's own output for the refused restore; it names the missing guest paths. */
|
|
367
|
+
output: string);
|
|
368
|
+
}
|
|
303
369
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAEhD,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,qFAAqF;IACrF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;;IALxB,uDAAuD;IAC9C,OAAO,EAAE,MAAM;IACxB,yDAAyD;IAChD,OAAO,EAAE,MAAM;IACxB,qFAAqF;IAC5E,MAAM,CAAC,EAAE,MAAM,YAAA;CAK3B;AAED;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAG5C,4FAA4F;IAC5F,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO;gBAFxB,OAAO,EAAE,MAAM;IACf,4FAA4F;IACnF,KAAK,CAAC,EAAE,OAAO,YAAA;CAK3B;AAED,gFAAgF;AAChF,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B;AAED,8EAA8E;AAC9E,qBAAa,YAAa,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAEhD,uDAAuD;IACvD,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,qFAAqF;IACrF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;;IALxB,uDAAuD;IAC9C,OAAO,EAAE,MAAM;IACxB,yDAAyD;IAChD,OAAO,EAAE,MAAM;IACxB,qFAAqF;IAC5E,MAAM,CAAC,EAAE,MAAM,YAAA;CAK3B;A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51
51
|
}
|
|
52
52
|
/** Thrown on subprocess/daemon failures; message carries full stderr/body. */
|
|
53
53
|
export class BackendError extends Error {
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
cause;
|
|
55
|
+
constructor(message,
|
|
56
|
+
/** The underlying error this one wraps, when there is one. */
|
|
57
|
+
cause) {
|
|
58
|
+
super(message, cause !== undefined ? { cause } : undefined);
|
|
59
|
+
this.cause = cause;
|
|
56
60
|
this.name = "BackendError";
|
|
57
61
|
}
|
|
58
62
|
}
|
|
@@ -387,4 +391,80 @@ export class CheckpointWorkloadCommandMissingError extends Error {
|
|
|
387
391
|
this.name = "CheckpointWorkloadCommandMissingError";
|
|
388
392
|
}
|
|
389
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Thrown by `checkpoint()` on microsandbox when a file added with
|
|
396
|
+
* `withCopyFileToContainer` has lost its host file. Copied files are not part
|
|
397
|
+
* of a checkpoint: they are start-time mounts of host files, so a snapshot
|
|
398
|
+
* holds no content for them. microsandbox's `checkpoint()` stops the
|
|
399
|
+
* container, snapshots it and boots it again, and that boot mounts each copied
|
|
400
|
+
* file again from its host file, so the host file has to still be there.
|
|
401
|
+
*
|
|
402
|
+
* Thrown from two places, both before any destructive step:
|
|
403
|
+
* `GenericContainer.checkpoint()` itself (ahead of the named-checkpoint replace
|
|
404
|
+
* semantics' removal of whatever currently sits under the same ref, so a
|
|
405
|
+
* refused re-checkpoint never replaces a prior checkpoint) and, redundantly,
|
|
406
|
+
* `MsbCliBackend.createCheckpoint` (ahead of stopping the sandbox) for any
|
|
407
|
+
* caller that reaches the backend directly. docker never throws it: its
|
|
408
|
+
* checkpoint is a commit of the running container and does not reboot it.
|
|
409
|
+
*/
|
|
410
|
+
export class CheckpointHostFileMissingError extends Error {
|
|
411
|
+
guestPath;
|
|
412
|
+
hostPath;
|
|
413
|
+
constructor(
|
|
414
|
+
/** The guest path the copied file is mounted at. */
|
|
415
|
+
guestPath,
|
|
416
|
+
/** The host file that was meant to back it and no longer exists. */
|
|
417
|
+
hostPath) {
|
|
418
|
+
super(`checkpoint() can't keep the copied file at ${guestPath}: its host file ${hostPath} no longer exists. ` +
|
|
419
|
+
"Copied files are not part of a checkpoint; on microsandbox, checkpoint() mounts them again from their " +
|
|
420
|
+
"host files when it reboots the container.");
|
|
421
|
+
this.guestPath = guestPath;
|
|
422
|
+
this.hostPath = hostPath;
|
|
423
|
+
this.name = "CheckpointHostFileMissingError";
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Thrown when microsandbox refuses to restore a checkpoint because the
|
|
428
|
+
* container it was taken from had files copied in with
|
|
429
|
+
* `withCopyFileToContainer`. Those files are mounts of host files, not part of
|
|
430
|
+
* the checkpoint. msb 0.7.8 records them in the snapshots it creates and
|
|
431
|
+
* refuses a restore that does not supply each one again; a snapshot made by an
|
|
432
|
+
* older msb restores with the file empty instead. msb's own output lists the
|
|
433
|
+
* missing guest paths and is carried in `output` and in the message.
|
|
434
|
+
*
|
|
435
|
+
* The remedy is to add the same files again, at the same guest paths, on the
|
|
436
|
+
* container started from the checkpoint:
|
|
437
|
+
* `GenericContainer.fromCheckpoint(cp).withCopyFileToContainer(...)`. Never
|
|
438
|
+
* retried: another attempt would be refused the same way.
|
|
439
|
+
*
|
|
440
|
+
* Thrown by `start()` on a container built with `fromCheckpoint()`. It could
|
|
441
|
+
* also come from `checkpoint()`'s own reboot, which supplies the container's
|
|
442
|
+
* copied files itself, so only a container whose mounts the library could not
|
|
443
|
+
* see would reach that. docker never throws it: it cannot tell, and starts the
|
|
444
|
+
* container with the path left empty.
|
|
445
|
+
*/
|
|
446
|
+
export class CheckpointMissingCopiedFilesError extends Error {
|
|
447
|
+
sandbox;
|
|
448
|
+
ref;
|
|
449
|
+
output;
|
|
450
|
+
constructor(
|
|
451
|
+
/** The sandbox the restore was meant to create. */
|
|
452
|
+
sandbox,
|
|
453
|
+
/** The checkpoint ref being restored. */
|
|
454
|
+
ref,
|
|
455
|
+
/** msb's own output for the refused restore; it names the missing guest paths. */
|
|
456
|
+
output) {
|
|
457
|
+
super(`msb refused to restore sandbox '${sandbox}' from checkpoint '${ref}': the container it was taken from ` +
|
|
458
|
+
"had files copied in with withCopyFileToContainer, and copied files are not part of a checkpoint (they " +
|
|
459
|
+
"are mounts of host files, so the checkpoint holds no content for them). Add the same files again, at " +
|
|
460
|
+
"the same guest paths, on the container you start from the checkpoint: " +
|
|
461
|
+
'GenericContainer.fromCheckpoint(cp).withCopyFileToContainer(MountableFile.forHostPath("<host file>"), ' +
|
|
462
|
+
'"<guest path>"). msb\'s output names the missing guest paths:\n' +
|
|
463
|
+
output);
|
|
464
|
+
this.sandbox = sandbox;
|
|
465
|
+
this.ref = ref;
|
|
466
|
+
this.output = output;
|
|
467
|
+
this.name = "CheckpointMissingCopiedFilesError";
|
|
468
|
+
}
|
|
469
|
+
}
|
|
390
470
|
//# sourceMappingURL=errors.js.map
|
package/dist/core/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAGvC;IAEA;IAEA;IANX;IACE,uDAAuD;IAC9C,OAAe;IACxB,yDAAyD;IAChD,OAAe;IACxB,qFAAqF;IAC5E,MAAe;QAExB,KAAK,CAAC,YAAY,OAAO,8BAA8B,OAAO,YAAY,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QANjG,YAAO,GAAP,OAAO,CAAQ;QAEf,YAAO,GAAP,OAAO,CAAQ;QAEf,WAAM,GAAN,MAAM,CAAS;QAGxB,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAInC;IAHX,YACE,OAAe;IACf,4F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