opencode-model-router 2.10.0 → 2.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.
- package/CHANGELOG.md +306 -0
- package/README.md +3 -2
- package/package.json +8 -1
- package/src/compat/background.ts +5 -0
- package/src/compat/session-lookup.ts +21 -0
- package/src/compat/v2-hooks.ts +256 -88
- package/src/compat/v2-observations.ts +1 -0
- package/src/compat/v2-vocabulary.ts +14 -0
- package/src/executor/create.ts +3 -0
- package/src/executor/git.ts +110 -26
- package/src/executor/integrate/checks.ts +29 -11
- package/src/executor/integrate/queue.ts +95 -13
- package/src/executor/ledger.ts +16 -12
- package/src/executor/lfs-restore.ts +492 -0
- package/src/executor/paths.ts +7 -2
- package/src/executor/recovery.ts +2 -1
- package/src/executor/runtime.ts +1010 -226
- package/src/executor/slots/pool.ts +120 -19
- package/src/executor/slots/provision.ts +111 -23
- package/src/executor/slots/root.ts +81 -0
- package/src/executor/types.ts +28 -2
- package/src/executor/unattended.ts +6 -1
- package/src/executor/verify-trees.ts +507 -0
- package/src/guard/enforce.ts +2 -1
- package/src/guard/fingerprint.ts +9 -0
- package/src/guard/guards.ts +7 -1
- package/src/index.ts +107 -27
- package/src/router/answer-dedup.ts +198 -0
- package/src/router/common-dir.ts +241 -0
- package/src/router/config.ts +71 -12
- package/src/router/diff-handles.ts +322 -0
- package/src/router/diff-summary.ts +318 -0
- package/src/router/git-metadata-guard.ts +144 -7
- package/src/router/git-tools.ts +930 -73
- package/src/router/role-agents.ts +100 -36
- package/src/router/run-summary.ts +253 -0
- package/src/router/run-tools.ts +145 -23
- package/src/router/sessions.ts +14 -1
- package/src/routing/classify/rules.ts +93 -14
- package/src/routing/wire/hint.ts +9 -2
- package/src/v2.ts +3 -1
- package/src/verify/exec.ts +454 -2
- package/src/verify/plan-task.ts +86 -26
- package/src/verify/runner.ts +14 -6
- package/src/verify/tree.ts +5 -1
- package/src/verify/types.ts +44 -0
- package/src/verify/wiring.ts +87 -10
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
* - launch-step-end {taskId,attempt,result}; orchestrator {event}
|
|
51
51
|
* - runtime-attach, activation, activation-end, promote, schedule, abort, dispose,
|
|
52
52
|
* detach, lease-released-notification: detail=null.
|
|
53
|
+
* - close-wait-slow {waitedMs,pending:[label]}: a plan close still waits for its cut attachment's work.
|
|
53
54
|
* Other raw states: capacity-init {maxParallel,providers:[{provider,limit,holdUntilMs,
|
|
54
55
|
* lastSignalAtMs,pausedUntilMs}]}; provider {provider,change,from,to,until};
|
|
55
56
|
* lease-acquire {taskRef,ok}; lease-release {taskRef}.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The router's own v1 tool vocabulary, translated at the OpenCode v2 boundary (`Task(` -> `subagent(`, `subagent_type` ->
|
|
3
|
+
* `agent`, `task_id` -> `sessionID`). Pure and dependency-free: the v2 adapter (src/compat/v2-hooks.ts, which re-exports it)
|
|
4
|
+
* and the plugin's v2-only finish API (src/index.ts, the held verdict text, #191) apply the same translation.
|
|
5
|
+
*/
|
|
6
|
+
export function v2Instructions(text: string): string {
|
|
7
|
+
return text
|
|
8
|
+
.replace(/\bTask(?=\s*\()/g, "subagent")
|
|
9
|
+
.replace(/\bTask (calls?|tool)\b/g, "subagent $1")
|
|
10
|
+
.replace(/\btask tool\b/g, "subagent tool")
|
|
11
|
+
.replace(/`task`/g, "`subagent`")
|
|
12
|
+
.replace(/\bsubagent_type\b/g, "agent")
|
|
13
|
+
.replace(/\btask_id\b/g, "sessionID");
|
|
14
|
+
}
|
package/src/executor/create.ts
CHANGED
|
@@ -31,6 +31,7 @@ import type { V2Observations } from "../compat/v2-observations";
|
|
|
31
31
|
import { createScheduler } from "./schedule";
|
|
32
32
|
import { countPlanMarkers, createSlotPool, defaultSlotsDir, type SlotPoolOpenOptions } from "./slots/pool";
|
|
33
33
|
import { createProvisioner } from "./slots/provision";
|
|
34
|
+
import { createVerifyTrees } from "./verify-trees";
|
|
34
35
|
import { ExecutorError, type ExecutorRuntime, type LedgerStore, type LedgerV1, type PlanId, type SlotPool, type Spawner } from "./types";
|
|
35
36
|
|
|
36
37
|
/** Process adapter over the router's bounded, no-shell runner. */
|
|
@@ -541,6 +542,8 @@ function assembleExecutor(context: { directory: string }, options: CreateExecuto
|
|
|
541
542
|
};
|
|
542
543
|
const self = processIdentity();
|
|
543
544
|
runtime = createExecutorRuntime({ store, compiler, self, executorHome: home,
|
|
545
|
+
// #189 R2-pre-2: plan-task verifications journal their process trees; activation ends what a dead server left.
|
|
546
|
+
verifyTrees: createVerifyTrees({ home, self, isAlive: spawner.isAlive, log }),
|
|
544
547
|
observations: options.observations,
|
|
545
548
|
slots: planPools.facade, slotsFor: (id) => planPools.of(id), purgeSlots: (id, finished) => planPools.purge(id, finished),
|
|
546
549
|
forgetSlots: (id) => planPools.forget(id),
|
package/src/executor/git.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/executor/git.ts
|
|
2
2
|
// Phase 2.4.2: hardened git operations for the executor (design memo 2.4.1 §2 in
|
|
3
3
|
// docs/qa/critical-path-execution/phase-2.4.md). Every git call goes through an injected `GitRunner`, which never
|
|
4
|
-
// spawns a shell; hooks never run (
|
|
4
|
+
// spawns a shell; hooks never run (`core.hooksPath` is an empty regular file), signing and editors are off, and an in-slot call
|
|
5
5
|
// never trusts the slot's own `.git` (explicit `--git-dir`/`--work-tree` after `verifySlotPointers`).
|
|
6
6
|
|
|
7
7
|
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
gitEnvironment, gitExecutable, gitPointers, hardeningArgs, isNetworkOrDevicePath, repositoryDriverArgs,
|
|
10
10
|
spawnBounded, stripUrlUserinfo, workRootGuards,
|
|
11
11
|
} from "../router/git-tools";
|
|
12
|
+
import { lfsRestoreTarget, restoreLocalLfsObjects, type LfsRestoreGit, type LfsRestoreTarget } from "./lfs-restore";
|
|
12
13
|
import {
|
|
13
14
|
ExecutorError, GIT_ID_PATTERN, PLAN_ID_PATTERN, WIP_TRAILER,
|
|
14
15
|
type FileSystem, type GitRunner, type JsonValue, type PhaseId, type PlanId, type ProcessResult, type ProcOpts,
|
|
@@ -107,8 +108,11 @@ export function createGitRunner(o: { mode: "hardened" | "user"; toplevel: string
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
export interface GitContext {
|
|
110
|
-
/**
|
|
111
|
-
|
|
111
|
+
/**
|
|
112
|
+
* `<home>\git\hooks-off`: an empty regular file created by the executor. Git looks for `<file>/<hook>` and finds none, and
|
|
113
|
+
* Git LFS, which installs its hooks into `core.hooksPath` whenever it runs a filter, cannot create them under a file (#215).
|
|
114
|
+
*/
|
|
115
|
+
hooksPath: string;
|
|
112
116
|
/** `<home>\git\slot-excludes`. */
|
|
113
117
|
excludesFile: string;
|
|
114
118
|
/** DV6 snapshot of the user's line-ending configuration. */
|
|
@@ -124,7 +128,7 @@ export interface GitContext {
|
|
|
124
128
|
export function executorGitArgs(c: GitContext): string[] {
|
|
125
129
|
const args = [
|
|
126
130
|
...hardeningArgs(),
|
|
127
|
-
"-c", "core.longpaths=true", "-c", `core.hooksPath=${c.
|
|
131
|
+
"-c", "core.longpaths=true", "-c", `core.hooksPath=${c.hooksPath}`, "-c", `core.excludesFile=${c.excludesFile}`,
|
|
128
132
|
"-c", "core.editor=:", "-c", "sequence.editor=:",
|
|
129
133
|
"-c", "commit.gpgSign=false", "-c", "tag.gpgSign=false", "-c", "tag.forceSignAnnotated=false",
|
|
130
134
|
"-c", "rebase.updateRefs=false", "-c", "rebase.autoStash=false", "-c", "rebase.autoSquash=false",
|
|
@@ -140,6 +144,23 @@ export function executorGitArgs(c: GitContext): string[] {
|
|
|
140
144
|
/** Bound of one driver listing (its include reads included) before an executor git call. */
|
|
141
145
|
const DRIVER_LISTING_TIMEOUT_MS = 15_000;
|
|
142
146
|
|
|
147
|
+
/** #208: the local LFS restore's warnings, each distinct message once per process. */
|
|
148
|
+
const lfsRestoreWarnings = new Set<string>();
|
|
149
|
+
function warnOnce(message: string): void {
|
|
150
|
+
if (lfsRestoreWarnings.has(message)) return;
|
|
151
|
+
lfsRestoreWarnings.add(message);
|
|
152
|
+
console.warn(`[model-router] executor: ${message}`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* #208: set on every executor git call, over a caller's own value. Git LFS skips its smudge, so it never downloads an object:
|
|
157
|
+
* no endpoint is asked (not even one a `.lfsconfig` written by the same checkout names) and no transfer program the
|
|
158
|
+
* repository's configuration names (`lfs.customtransfer.*`) is started. Git writes every LFS file as its pointer file;
|
|
159
|
+
* {@link withRepositoryDrivers} then restores, offline, those whose object is in the local LFS store (executor/lfs-restore.ts).
|
|
160
|
+
* The clean filter (commit) is unchanged.
|
|
161
|
+
*/
|
|
162
|
+
export const EXECUTOR_GIT_ENV: Readonly<Record<string, string>> = Object.freeze({ GIT_LFS_SKIP_SMUDGE: "1" });
|
|
163
|
+
|
|
143
164
|
/**
|
|
144
165
|
* Where an executor git call runs: `cwd` after a leading `-C <dir>`, and the `--git-dir=`/`--work-tree=` options it passes
|
|
145
166
|
* (in-slot calls), read from the global options before the subcommand. A bare `--git-dir`/`--work-tree` (the value as the
|
|
@@ -172,33 +193,75 @@ export function gitCallLocation(args: readonly string[], cwd: string): { cwd: st
|
|
|
172
193
|
* never missed, and it costs far less than the call it protects. The listing runs where the call runs (its `-C`, `--git-dir`,
|
|
173
194
|
* `--work-tree`) in the call's own environment with the user's system/global configuration visible, so a global LFS filter
|
|
174
195
|
* and its `git lfs install --local` copy are kept. `filter.<name>.required=true`: a blanked filter makes git refuse
|
|
175
|
-
* (commit, cherry-pick, checkout, reset, clean) instead of writing unfiltered content.
|
|
176
|
-
*
|
|
196
|
+
* (commit, cherry-pick, checkout, reset, clean) instead of writing unfiltered content. The hardened environment hides the
|
|
197
|
+
* system and global configuration, so every filter clean/smudge/process/required and merge driver whose effective value is
|
|
198
|
+
* the user's (system, global, command line) is passed on with `-c` (`forwardUser`, #162): a filter set only globally (Git
|
|
199
|
+
* LFS, git-crypt) applies as with plain git. A user value `-c` cannot carry as git read it (a line break, a byte that is not
|
|
200
|
+
* UTF-8) is not passed on: that filter is blanked and required, so only calls that use it fail. A forwarded filter program
|
|
201
|
+
* (git-lfs) reads the repository's configuration and `.lfsconfig` itself, line by line, so every key it would derive there as
|
|
202
|
+
* an extension command, a custom transfer agent, the standalone agent, `core.sshCommand`, `core.askPass` or `lfs.storage` is
|
|
203
|
+
* blanked, and a credential helper resets the helper list (#184, git-tools `repositoryOnlyDriverArgs`). A configuration that
|
|
204
|
+
* cannot be read, a user driver name with a `=`, such a key `-c` cannot name, a repository include target inside a work tree
|
|
205
|
+
* (the call itself may write it before git-lfs reads it), a `.lfsconfig` that is a link, not a regular file or includes
|
|
206
|
+
* another file, or a config-based hook (`hook.<name>.command|event`, which the hooks-off `core.hooksPath` does not disable)
|
|
207
|
+
* in the repository's configuration, is `E_GIT`, and the call does not run. Not covered: a `.lfsconfig` the call itself
|
|
208
|
+
* writes (a checkout, cherry-pick or rebase) before git-lfs starts, though under {@link EXECUTOR_GIT_ENV} that git-lfs asks
|
|
209
|
+
* no server it names. Every call (and its listing) carries {@link EXECUTOR_GIT_ENV} in its environment: Git LFS never
|
|
210
|
+
* smudges, so it never downloads (#208). After a successful call that can write a work tree (checkout, switch, restore,
|
|
211
|
+
* `reset --hard`, cherry-pick, rebase, revert, merge …), the LFS files whose object is in the local LFS store are restored
|
|
212
|
+
* there through this runner (`restoreLocalLfsObjects`; GitOps asks for the new work tree of `worktree add` with
|
|
213
|
+
* `restoreLocalLfs`), so the restore's own git calls get the same blanking and `hook.*` refusal. A restore never changes the
|
|
214
|
+
* call's result: what it leaves as pointer files is one warning (each distinct message once per process).
|
|
177
215
|
*/
|
|
178
216
|
export function withRepositoryDrivers(inner: GitRunner, toplevel: string): GitRunner {
|
|
179
217
|
let executable: string | undefined;
|
|
180
|
-
|
|
218
|
+
const restore = async (target: LfsRestoreTarget, o: { timeoutMs: number; env?: Readonly<Record<string, string>>; signal?: AbortSignal }) => {
|
|
219
|
+
const call: LfsRestoreGit = (args, extra) => runner.run(args, {
|
|
220
|
+
cwd: target.cwd, timeoutMs: o.timeoutMs, ...(extra?.maxOutputBytes === undefined ? {} : { maxOutputBytes: extra.maxOutputBytes }),
|
|
221
|
+
...(o.env === undefined ? {} : { env: o.env }), ...(o.signal === undefined ? {} : { signal: o.signal }),
|
|
222
|
+
});
|
|
223
|
+
let warning: string | undefined;
|
|
224
|
+
try {
|
|
225
|
+
warning = (await restoreLocalLfsObjects(call, target, o.signal === undefined ? {} : { signal: o.signal })).warning;
|
|
226
|
+
} catch (error) {
|
|
227
|
+
warning = `local LFS restore in ${target.cwd}: ${errorText(error)}`;
|
|
228
|
+
}
|
|
229
|
+
if (warning !== undefined) warnOnce(warning);
|
|
230
|
+
};
|
|
231
|
+
const runner: GitRunner = {
|
|
232
|
+
async restoreLocalLfs(prefix: readonly string[], cwd: string, o: { timeoutMs: number; signal?: AbortSignal }): Promise<void> {
|
|
233
|
+
await restore({ prefix: [...prefix], cwd }, o);
|
|
234
|
+
},
|
|
181
235
|
async run(args: readonly string[], p: ProcOpts): Promise<ProcessResult> {
|
|
182
236
|
const { cwd, location } = gitCallLocation(args, p.cwd);
|
|
237
|
+
const env = { ...(p.env ?? {}), ...EXECUTOR_GIT_ENV };
|
|
183
238
|
let drivers: string[];
|
|
184
239
|
try {
|
|
185
240
|
executable ??= gitExecutable(workRootGuards(toplevel));
|
|
186
241
|
drivers = await repositoryDriverArgs(cwd, {
|
|
187
|
-
executable, env: hardenedEnvironment(
|
|
242
|
+
executable, env: hardenedEnvironment(env), required: true, forwardUser: true, location,
|
|
188
243
|
timeoutMs: Math.min(p.timeoutMs, DRIVER_LISTING_TIMEOUT_MS), ...(p.signal === undefined ? {} : { signal: p.signal }),
|
|
189
244
|
});
|
|
190
245
|
} catch (error) {
|
|
191
246
|
throw new ExecutorError("E_GIT", `git driver configuration could not be read: ${stripUrlUserinfo(errorText(error)).slice(0, 300)}`,
|
|
192
247
|
{ op: "config", code: null, stderr: "" });
|
|
193
248
|
}
|
|
194
|
-
|
|
249
|
+
const result = await inner.run([...drivers, ...args], { ...p, env });
|
|
250
|
+
const target = result.code === 0 ? lfsRestoreTarget(args, p.cwd) : undefined;
|
|
251
|
+
if (target !== undefined) await restore(target, p);
|
|
252
|
+
return result;
|
|
195
253
|
},
|
|
196
254
|
};
|
|
255
|
+
return runner;
|
|
197
256
|
}
|
|
198
257
|
|
|
199
|
-
/**
|
|
258
|
+
/**
|
|
259
|
+
* Fixed content of `slot-excludes` (DV5): ignore rules never affect tracked files. `.omr-lfs-*` (#208): a temporary or
|
|
260
|
+
* pointer backup file the local LFS restore could not remove is never staged by a slot's `add -A`.
|
|
261
|
+
*/
|
|
200
262
|
export const SLOT_EXCLUDES_CONTENT = [
|
|
201
263
|
"node_modules/", "/.venv/", "/.yarn/cache/", "/.yarn/unplugged/", "/.yarn/install-state.gz", "/.pnp.*", "*.egg-info/",
|
|
264
|
+
".omr-lfs-*",
|
|
202
265
|
].join("\n") + "\n";
|
|
203
266
|
|
|
204
267
|
// ---------------------------------------------------------------------------------------------------------------
|
|
@@ -509,8 +572,12 @@ async function refCommit(git: GitRunner, o: SlotCall, ref: string): Promise<stri
|
|
|
509
572
|
return r.code === 0 && GIT_ID_PATTERN.test(oid) ? oid : null;
|
|
510
573
|
}
|
|
511
574
|
|
|
512
|
-
/**
|
|
513
|
-
|
|
575
|
+
/**
|
|
576
|
+
* QA-PDF21-3, #189 L7: a step that failed on a leftover `index.lock`, as git reports it (`Unable to create '…index.lock':
|
|
577
|
+
* File exists`). Any other failure that merely mentions the lock never removes it.
|
|
578
|
+
*/
|
|
579
|
+
export const STALE_INDEX_LOCK_PATTERN = /Unable to create '[^'\r\n]*index\.lock': File exists/i;
|
|
580
|
+
const SLOT_INDEX_LOCK_PATTERN = STALE_INDEX_LOCK_PATTERN;
|
|
514
581
|
|
|
515
582
|
/**
|
|
516
583
|
* pdf2-1 (b): saves the slot's work (tracked changes and untracked, non-ignored files) at `refs/heads/<ref>` without
|
|
@@ -745,14 +812,15 @@ export function createGitOps(d: GitOpsDeps): GitOps {
|
|
|
745
812
|
const timeoutMs = d.timeoutMs ?? GIT_OP_TIMEOUT_MS;
|
|
746
813
|
const toplevel = d.toplevel;
|
|
747
814
|
const gitHome = join(d.executorHome, "git");
|
|
748
|
-
|
|
815
|
+
// #215: a regular file, not the former `no-hooks` directory (an old home keeps that one, unused).
|
|
816
|
+
const hooksPath = join(gitHome, "hooks-off");
|
|
749
817
|
const excludesFile = join(gitHome, "slot-excludes");
|
|
750
818
|
const refFormatCache = new Map<string, boolean>();
|
|
751
819
|
let versionCache: string | undefined;
|
|
752
820
|
let contextPromise: Promise<OpsContext> | undefined;
|
|
753
821
|
let commonCache: string | undefined;
|
|
754
822
|
|
|
755
|
-
// ---- context: hooks
|
|
823
|
+
// ---- context: hooks path, excludes file, identity and conversion snapshot ----
|
|
756
824
|
|
|
757
825
|
async function ensureDir(p: string): Promise<void> {
|
|
758
826
|
const st = await d.fs.lstat(p);
|
|
@@ -768,10 +836,12 @@ export function createGitOps(d: GitOpsDeps): GitOps {
|
|
|
768
836
|
async function prepareFiles(): Promise<void> {
|
|
769
837
|
await ensureDir(d.executorHome);
|
|
770
838
|
await ensureDir(gitHome);
|
|
771
|
-
await
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
839
|
+
if ((await d.fs.lstat(hooksPath)) === null) {
|
|
840
|
+
try { await d.fs.writeText(hooksPath, "", { exclusive: true, fsync: true }); } catch (error) {
|
|
841
|
+
if (errorCode(error) !== "EEXIST") throw error;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
await assertHooksOff();
|
|
775
845
|
const existing = await d.fs.lstat(excludesFile);
|
|
776
846
|
if (existing !== null && existing.kind !== "file") throw new ExecutorError("E_GIT", "slot excludes path is not a file", { path: excludesFile });
|
|
777
847
|
if (existing === null || (await d.fs.readText(excludesFile)) !== SLOT_EXCLUDES_CONTENT) {
|
|
@@ -784,7 +854,7 @@ export function createGitOps(d: GitOpsDeps): GitOps {
|
|
|
784
854
|
const pending = (async (): Promise<OpsContext> => {
|
|
785
855
|
await prepareFiles();
|
|
786
856
|
const { conversion, ...identity } = await readCommitIdentity(d.userGit, toplevel);
|
|
787
|
-
return { args: executorGitArgs({
|
|
857
|
+
return { args: executorGitArgs({ hooksPath, excludesFile, conversion }), identity };
|
|
788
858
|
})();
|
|
789
859
|
contextPromise = pending;
|
|
790
860
|
pending.catch(() => { if (contextPromise === pending) contextPromise = undefined; });
|
|
@@ -821,17 +891,19 @@ export function createGitOps(d: GitOpsDeps): GitOps {
|
|
|
821
891
|
return wanted === true ? commitIdentityArgs(x.identity) : [];
|
|
822
892
|
}
|
|
823
893
|
|
|
824
|
-
/**
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
894
|
+
/**
|
|
895
|
+
* The hooks path is re-checked before every call: an op could run a hook only if it were replaced by a directory. Not a link,
|
|
896
|
+
* not a directory, zero bytes.
|
|
897
|
+
*/
|
|
898
|
+
async function assertHooksOff(): Promise<void> {
|
|
899
|
+
const st = await d.fs.lstat(hooksPath);
|
|
900
|
+
if (st === null || st.kind !== "file" || st.size !== 0) throw new ExecutorError("E_GIT", "hooks path is not an empty regular file", { path: hooksPath });
|
|
829
901
|
}
|
|
830
902
|
|
|
831
903
|
/** cwd = toplevel. */
|
|
832
904
|
async function inRepo(c: Call): Promise<ProcessResult> {
|
|
833
905
|
const x = await context();
|
|
834
|
-
await
|
|
906
|
+
await assertHooksOff();
|
|
835
907
|
return exec(c.op, toplevel, [...x.args, ...identityArgs(x, c.identity), ...c.args], c.timeoutMs ?? timeoutMs, c.service);
|
|
836
908
|
}
|
|
837
909
|
|
|
@@ -839,7 +911,7 @@ export function createGitOps(d: GitOpsDeps): GitOps {
|
|
|
839
911
|
async function inSlot(slot: string, c: Call): Promise<ProcessResult> {
|
|
840
912
|
const { gitdir } = await verifySlotPointers(slot);
|
|
841
913
|
const x = await context();
|
|
842
|
-
await
|
|
914
|
+
await assertHooksOff();
|
|
843
915
|
const scope = [`--git-dir=${gitdir}`, `--work-tree=${slot}`];
|
|
844
916
|
return exec(c.op, slot, [...x.args, ...identityArgs(x, c.identity), ...scope, ...c.args], c.timeoutMs ?? timeoutMs, c.service);
|
|
845
917
|
}
|
|
@@ -987,6 +1059,18 @@ export function createGitOps(d: GitOpsDeps): GitOps {
|
|
|
987
1059
|
op: "worktree add", timeoutMs: GIT_WORKTREE_ADD_TIMEOUT_MS, identity: true,
|
|
988
1060
|
args: ["worktree", "add", "--detach", "--lock", "--reason", lockReason, path, commit],
|
|
989
1061
|
}), "worktree add");
|
|
1062
|
+
// #208: the new work tree's local LFS objects, restored through its explicit --git-dir/--work-tree (as inSlot), never
|
|
1063
|
+
// repository discovery. A slot whose pointers do not verify is left to the checks that report it, with one warning.
|
|
1064
|
+
if (d.git.restoreLocalLfs === undefined) return;
|
|
1065
|
+
let gitdir: string;
|
|
1066
|
+
try { ({ gitdir } = await verifySlotPointers(path)); } catch (error) {
|
|
1067
|
+
warnOnce(`local LFS restore in ${path}: skipped, its git pointers do not verify (${stripUrlUserinfo(errorText(error)).slice(0, 300)}); `
|
|
1068
|
+
+ "its LFS files stay pointer files (`git lfs checkout` there restores them)");
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
const x = await context();
|
|
1072
|
+
await assertHooksOff();
|
|
1073
|
+
await d.git.restoreLocalLfs([...x.args, `--git-dir=${gitdir}`, `--work-tree=${path}`], path, { timeoutMs: GIT_WORKTREE_ADD_TIMEOUT_MS });
|
|
990
1074
|
}
|
|
991
1075
|
|
|
992
1076
|
async function worktreeRemove(path: string, lockReason: string): Promise<void> {
|
|
@@ -540,10 +540,27 @@ export function createIntegrationChecks(d: IntegrationChecksDeps): IntegrationCh
|
|
|
540
540
|
...(c.cwd === undefined ? {} : { cwd: c.cwd }), ...(c.env === undefined ? {} : { env: c.env }) };
|
|
541
541
|
}
|
|
542
542
|
|
|
543
|
-
/**
|
|
544
|
-
|
|
543
|
+
/**
|
|
544
|
+
* The configured pytest interpreter for `cwd` and its command label, the one place both are chosen: a selection, a
|
|
545
|
+
* command moved to another slot and each spawn ask it, so the label always names the interpreter that runs. `python`
|
|
546
|
+
* is a bare name or an absolute path; "auto" is the bare `python`. POSIX (#192): outside a slot with a virtual
|
|
547
|
+
* environment (which always has `python`), "auto" is `python3` when it resolves (Debian and Ubuntu ship only
|
|
548
|
+
* `python3`), else `python`.
|
|
549
|
+
*/
|
|
550
|
+
function pytestInterpreter(cwd: string): { program: string; label: string } {
|
|
551
|
+
const pick = (program: string) => ({ program, label: `${program} -m pytest` });
|
|
545
552
|
const python = d.ledger().config.python;
|
|
546
|
-
|
|
553
|
+
if (python !== "auto") return pick(python);
|
|
554
|
+
const platform = process.platform;
|
|
555
|
+
if (platform === "win32" || slotEnvFor(cwd, platform)?.set.VIRTUAL_ENV !== undefined) return pick("python");
|
|
556
|
+
const guards = workRootGuards(cwd);
|
|
557
|
+
try {
|
|
558
|
+
resolveCommandExecutable("python3", { platform, env: runEnvironment(process.env, platform, undefined, { guards }) }, guards);
|
|
559
|
+
return pick("python3");
|
|
560
|
+
} catch {
|
|
561
|
+
// No usable python3 on PATH: the bare `python` (resolution then reports it when it is missing too).
|
|
562
|
+
return pick("python");
|
|
563
|
+
}
|
|
547
564
|
}
|
|
548
565
|
|
|
549
566
|
/**
|
|
@@ -563,7 +580,8 @@ export function createIntegrationChecks(d: IntegrationChecksDeps): IntegrationCh
|
|
|
563
580
|
* never a bare name resolved from the cwd. `configured`: argv[0] is the configured interpreter (N-A-1), else the
|
|
564
581
|
* planner's (a scoped or rerun spec planned in this cwd).
|
|
565
582
|
*/
|
|
566
|
-
function resolvePython(c: ResolvedCommand, cwd: string, configured: boolean
|
|
583
|
+
function resolvePython(c: ResolvedCommand, cwd: string, configured: boolean,
|
|
584
|
+
chosen: { program: string; label: string } | undefined = configured ? pytestInterpreter(cwd) : undefined): ResolvedCommand {
|
|
567
585
|
const platform = process.platform;
|
|
568
586
|
const guards = workRootGuards(cwd);
|
|
569
587
|
let shell: string | undefined;
|
|
@@ -575,11 +593,11 @@ export function createIntegrationChecks(d: IntegrationChecksDeps): IntegrationCh
|
|
|
575
593
|
const slotEnv = slotEnvFor(cwd, platform);
|
|
576
594
|
try {
|
|
577
595
|
const host = { platform, env: base };
|
|
578
|
-
const program =
|
|
596
|
+
const program = chosen?.program ?? c.file;
|
|
579
597
|
const file = slotToolExecutable(program, slotEnv, host, () => guards) ?? resolveCommandExecutable(program, host, guards);
|
|
580
598
|
const env = applySlotEnv(base, slotEnv, platform);
|
|
581
|
-
const resolved: ResolvedCommand = { ...c,
|
|
582
|
-
.filter((entry): entry is [string, string] => entry[1] !== undefined)) } };
|
|
599
|
+
const resolved: ResolvedCommand = { ...c, ...(chosen === undefined ? {} : { label: chosen.label }), file,
|
|
600
|
+
resolution: { cwd, env: Object.fromEntries(Object.entries(env).filter((entry): entry is [string, string] => entry[1] !== undefined)) } };
|
|
583
601
|
if (configured) fromConfig.add(resolved);
|
|
584
602
|
return resolved;
|
|
585
603
|
} catch (e) {
|
|
@@ -602,10 +620,10 @@ export function createIntegrationChecks(d: IntegrationChecksDeps): IntegrationCh
|
|
|
602
620
|
const tests: TestComponent[] = [];
|
|
603
621
|
if (sel.node) tests.push({ framework: "node", full: await resolveRef({ script: "test", args: [] }, cwd) });
|
|
604
622
|
if (sel.pytest) {
|
|
605
|
-
const
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
623
|
+
const chosen = pytestInterpreter(cwd);
|
|
624
|
+
if (d.allowCommand === undefined || d.allowCommand(chosen.label)) {
|
|
625
|
+
tests.push({ framework: "pytest", full: resolvePython(
|
|
626
|
+
{ label: chosen.label, file: chosen.program, args: ["-m", "pytest"], source: "pytest", ref: null }, cwd, true, chosen) });
|
|
609
627
|
}
|
|
610
628
|
}
|
|
611
629
|
const extras: ResolvedCommand[] = [];
|
|
@@ -67,6 +67,8 @@ export const PREEMPT_LIMIT = 3, LOCK_HEARTBEAT_MS = 30_000, LOCK_STALE_MS = 600_
|
|
|
67
67
|
export const LOCK_WAIT_REPORT_MS = 300_000;
|
|
68
68
|
/** QA-62C-7: a failed repo-lock heartbeat is retried after at most this long; this many failures in a row are warned once. */
|
|
69
69
|
export const LOCK_HEARTBEAT_RETRY_MS = 1_000, LOCK_HEARTBEAT_WARN_FAILURES = 3;
|
|
70
|
+
/** 3.2-m3 (#187): background retries of a release's failed compare-and-delete (heartbeat retry delay, doubling). */
|
|
71
|
+
export const LOCK_RELEASE_RETRIES = 5;
|
|
70
72
|
/** QA-3.2-30: retries of a tag entry of a completed plan (after its 3 tries), with doubling delays from TAG_RETRY_BASE_MS. */
|
|
71
73
|
export const TAG_RETRY_LIMIT = 3, TAG_RETRY_BASE_MS = 60_000;
|
|
72
74
|
|
|
@@ -669,6 +671,35 @@ export function createRepoLockFactory(o: {
|
|
|
669
671
|
void p.finally(() => { if (beating === p) beating = null; });
|
|
670
672
|
};
|
|
671
673
|
let timer = o.clock.setTimer(heartbeatMs, beat);
|
|
674
|
+
const report = (text: string): void => {
|
|
675
|
+
try {
|
|
676
|
+
o.logger?.warn(text);
|
|
677
|
+
} catch {
|
|
678
|
+
// A reporting failure never blocks a release.
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
/**
|
|
682
|
+
* 3.2-m3 (#187): retry `n` of a release's failed compare-and-delete, after heartbeatRetryMs·2^(n-1). It removes only
|
|
683
|
+
* the file this lock wrote (`ours` compares the token): once the file is gone, or holds a newer lock (this process's
|
|
684
|
+
* next acquire or another holder writes a new token), nothing of ours is left and the retries stop.
|
|
685
|
+
*/
|
|
686
|
+
const retryRemoval = (n: number): void => {
|
|
687
|
+
o.clock.setTimer(heartbeatRetryMs * 2 ** (n - 1), () => {
|
|
688
|
+
void (async () => {
|
|
689
|
+
try {
|
|
690
|
+
const raw = await readRaw(file);
|
|
691
|
+
if (raw !== null && ours(raw)) await removeIfSame(file, raw);
|
|
692
|
+
} catch (e) {
|
|
693
|
+
if (n < LOCK_RELEASE_RETRIES) {
|
|
694
|
+
retryRemoval(n + 1);
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
report(`integration queue: gave up removing the repo lock ${file} after ${n} retries (${message(e)}); other `
|
|
698
|
+
+ "processes on this host wait for it until this process exits or the file is removed");
|
|
699
|
+
}
|
|
700
|
+
})();
|
|
701
|
+
});
|
|
702
|
+
};
|
|
672
703
|
const lock: RepoLockWithTakeover = {
|
|
673
704
|
lost: lost.signal,
|
|
674
705
|
takeover,
|
|
@@ -688,10 +719,15 @@ export function createRepoLockFactory(o: {
|
|
|
688
719
|
o.clock.clearTimer(timer);
|
|
689
720
|
try {
|
|
690
721
|
if (beating !== null) await beating;
|
|
722
|
+
// Already gone (null) or replaced by a takeover (not ours): nothing of ours to remove.
|
|
691
723
|
const raw = await readRaw(file);
|
|
692
724
|
if (raw !== null && ours(raw)) await removeIfSame(file, raw);
|
|
693
|
-
} catch {
|
|
694
|
-
//
|
|
725
|
+
} catch (e) {
|
|
726
|
+
// 3.2-m3 (#187): a failed read or compare-and-delete leaves our lock file, which another process on this host
|
|
727
|
+
// would wait for until this one exits. Reported, and retried in the background a bounded number of times.
|
|
728
|
+
report(`integration queue: could not remove the repo lock ${file} on release (${message(e)}); retrying up to `
|
|
729
|
+
+ `${LOCK_RELEASE_RETRIES} times`);
|
|
730
|
+
retryRemoval(1);
|
|
695
731
|
} finally {
|
|
696
732
|
freeMutex();
|
|
697
733
|
}
|
|
@@ -1273,9 +1309,11 @@ class Queue implements IntegrationQueue {
|
|
|
1273
1309
|
/**
|
|
1274
1310
|
* QA-3.2-10 / QA-3.2-25: the rebase upstream of a task that was reverted. A retry built on the old task branch whose
|
|
1275
1311
|
* original change lies below the merge base (fast-forwarded as is, then reverted) would replay only its fixes. Unless the
|
|
1276
|
-
* tip already contains the latest revert (a retry rebuilt on the head keeps the merge base), the upstream is the
|
|
1277
|
-
* journaled in the task's
|
|
1278
|
-
*
|
|
1312
|
+
* tip already contains the latest revert (a retry rebuilt on the head keeps the merge base), the upstream is the NEWEST
|
|
1313
|
+
* one journaled in the task's rebase steps that is an ancestor of the tip (3.2-m2, #188: a retry branch rebuilt on a head
|
|
1314
|
+
* and then reused must not replay from an older base, which would replay other tasks' reverted changes), even when it is
|
|
1315
|
+
* the merge base (a retry that landed as a rebased copy: its own commits are not on the branch), else the `from` of the
|
|
1316
|
+
* OLDEST revert whose `to` is below the merge base. Any number of reverts keeps the original change.
|
|
1279
1317
|
*/
|
|
1280
1318
|
private async reintegrationUpstream(id: TaskId, tip: string, mergeBase: string): Promise<string> {
|
|
1281
1319
|
const reverts = await this.revertedRanges(id);
|
|
@@ -1283,8 +1321,13 @@ class Queue implements IntegrationQueue {
|
|
|
1283
1321
|
if (latest === undefined) return mergeBase;
|
|
1284
1322
|
const top = this.ledger.repo.toplevel;
|
|
1285
1323
|
if (latest.revertHead !== null && await this.d.igit.isAncestor(top, latest.revertHead, tip)) return mergeBase;
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1324
|
+
const journaled = await this.journaledUpstreams(id);
|
|
1325
|
+
let newest: string | null = null;
|
|
1326
|
+
for (let i = journaled.length - 1; i >= 0 && newest === null; i--) {
|
|
1327
|
+
const u = journaled[i];
|
|
1328
|
+
if (u !== undefined && await this.d.igit.isAncestor(top, u, tip)) newest = u;
|
|
1329
|
+
}
|
|
1330
|
+
if (newest !== null) return newest;
|
|
1288
1331
|
for (const rv of reverts) {
|
|
1289
1332
|
if (rv.to !== rv.from && await this.d.igit.isAncestor(top, rv.to, mergeBase)) return rv.from;
|
|
1290
1333
|
}
|
|
@@ -1311,18 +1354,22 @@ class Queue implements IntegrationQueue {
|
|
|
1311
1354
|
return out;
|
|
1312
1355
|
}
|
|
1313
1356
|
|
|
1314
|
-
/**
|
|
1315
|
-
private async
|
|
1357
|
+
/** Every distinct `upstream` journaled for `id` in the rebase steps that planned it, oldest first (first = original base). */
|
|
1358
|
+
private async journaledUpstreams(id: TaskId): Promise<string[]> {
|
|
1359
|
+
const out: string[] = [];
|
|
1316
1360
|
for (const ev of await this.loadSteps()) {
|
|
1317
1361
|
if (ev.step !== "rebase" || ev.edge !== "start" || (ev.entry.kind !== "task" && ev.entry.kind !== "batch")) continue;
|
|
1318
1362
|
const tasks = parseDetail(ev.detail)?.tasks;
|
|
1319
1363
|
if (!Array.isArray(tasks)) continue;
|
|
1320
1364
|
for (const t of tasks as unknown[]) {
|
|
1321
1365
|
const x = t as { taskId?: unknown; upstream?: unknown } | null;
|
|
1322
|
-
if (x
|
|
1366
|
+
if (x === null || typeof x !== "object" || x.taskId !== id || typeof x.upstream !== "string") continue;
|
|
1367
|
+
const i = out.indexOf(x.upstream);
|
|
1368
|
+
if (i >= 0) out.splice(i, 1);
|
|
1369
|
+
out.push(x.upstream);
|
|
1323
1370
|
}
|
|
1324
1371
|
}
|
|
1325
|
-
return
|
|
1372
|
+
return out;
|
|
1326
1373
|
}
|
|
1327
1374
|
|
|
1328
1375
|
private async runTaskEntry(ids: TaskId[], requeue: boolean): Promise<void> {
|
|
@@ -2284,14 +2331,49 @@ class Queue implements IntegrationQueue {
|
|
|
2284
2331
|
"revert-build", { v: 1, culprit: { ...rv.culprit }, suiteCommit: rv.suiteCommit, head, files: [...rv.files] }, NONE, rv.ids);
|
|
2285
2332
|
this.serial = live;
|
|
2286
2333
|
const slot = await this.integrationSlot();
|
|
2334
|
+
const p = rv.phaseId;
|
|
2335
|
+
let commands = rv.commands;
|
|
2336
|
+
if (rv.ids.length === 0 && commands.length === 0) {
|
|
2337
|
+
// 3.2-m4 (#188): a culprit with no ids (a full-command bisect), rebuilt from history or rerun after the suite commands
|
|
2338
|
+
// failed to resolve, has only the suite commands to re-check the regression with. They are resolved once more; still
|
|
2339
|
+
// none: fail closed, never a revert without its regression run.
|
|
2340
|
+
let why: string;
|
|
2341
|
+
let phaseCause = false;
|
|
2342
|
+
try {
|
|
2343
|
+
const res = await this.d.suite.resolve(this.ledger, p, rv.suiteCommit);
|
|
2344
|
+
if (res.kind === "runs") commands = res.commands;
|
|
2345
|
+
phaseCause = res.kind !== "runs" || res.commands.length === 0;
|
|
2346
|
+
why = res.kind === "refused" ? res.reason : res.kind === "runs" ? "the suite resolves to no command" : `the suite resolves to "${res.kind}"`;
|
|
2347
|
+
} catch (e) {
|
|
2348
|
+
why = message(e);
|
|
2349
|
+
}
|
|
2350
|
+
if (commands.length === 0) {
|
|
2351
|
+
const text = `The revert of ${rv.culprit.taskId} was not built: the culprit has no failing test ids, so only the phase suite commands can check the revert, and they do not resolve at ${rv.suiteCommit} (${clipText(why, 500)}).`;
|
|
2352
|
+
if (!phaseCause) {
|
|
2353
|
+
// The resolver failed: the entry stays open (M36); unpause rolls it back and rebuilds the revert, resolving again.
|
|
2354
|
+
if (live.open !== null) await this.end(live, "refused", { v: 1, reason: "resolve", message: clipText(why, 1000) }, false);
|
|
2355
|
+
return this.infraPause(live, text);
|
|
2356
|
+
}
|
|
2357
|
+
// The phase's suite setting (refused/none/off): as `suiteRefused`, only the phase pauses. The entry closes, so the
|
|
2358
|
+
// unpause reruns the suite (M25: no revert pending), which resolves the commands again.
|
|
2359
|
+
const now = this.d.clock.iso();
|
|
2360
|
+
const before = this.ledger.inbox.length;
|
|
2361
|
+
if (live.open === null) await this.start(live, "revert-build", { v: 1, culprit: { ...rv.culprit }, suiteCommit: rv.suiteCommit, head: this.ledger.integration.head, files: [...rv.files] });
|
|
2362
|
+
const next = await this.end(live, "refused", { v: 1, reason: "resolve", message: clipText(why, 1000) }, true, [],
|
|
2363
|
+
lg => [{ type: "phase-paused", phaseId: p, paused: true, reason: "suite-unresolvable" },
|
|
2364
|
+
this.inboxEvent(lg, "failure", "critical", rv.culprit.taskId,
|
|
2365
|
+
`${text} Phase ${p} is paused; fix its suite, then unpause phase ${p} to run the suite again.`, now)]);
|
|
2366
|
+
this.notifyInbox(this.newInbox(next, before));
|
|
2367
|
+
return;
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2287
2370
|
// M26: built at the current head (a rerun entry may have been journaled before requeued tasks integrated).
|
|
2288
2371
|
const buildHead = this.ledger.integration.head;
|
|
2289
2372
|
const v = await this.d.suite.revert({ planId: this.d.planId, phaseId: rv.phaseId, culprit: { ...rv.culprit }, suiteCommit: rv.suiteCommit,
|
|
2290
|
-
head: buildHead, regression: { ids: [...rv.ids], files: [...rv.files], commands: [...
|
|
2373
|
+
head: buildHead, regression: { ids: [...rv.ids], files: [...rv.files], commands: [...commands] }, slot },
|
|
2291
2374
|
this.journal(live, this.ctl.signal));
|
|
2292
2375
|
const now = this.d.clock.iso();
|
|
2293
2376
|
const before = this.ledger.inbox.length;
|
|
2294
|
-
const p = rv.phaseId;
|
|
2295
2377
|
if (v.kind === "interrupted") throw new LaneStop(`revert interrupted by ${v.by}`);
|
|
2296
2378
|
if (v.kind === "error") {
|
|
2297
2379
|
if (live.open !== null) await this.end(live, "refused", { v: 1, reason: v.reason, message: clipText(v.message, 1000) }, false);
|
package/src/executor/ledger.ts
CHANGED
|
@@ -301,10 +301,6 @@ function edgeEndpointExists(l: LedgerV1, id: string): boolean {
|
|
|
301
301
|
return taskOf(l, id) !== null;
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
function sameStrings(a: readonly string[], b: readonly string[]): boolean {
|
|
305
|
-
return a.length === b.length && a.every((x, i) => x === b[i]);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
304
|
function isSuperset(next: readonly string[], prev: readonly string[]): boolean {
|
|
309
305
|
return prev.every((p) => next.includes(p));
|
|
310
306
|
}
|
|
@@ -2132,6 +2128,16 @@ function fsErrorCode(e: unknown): string | undefined {
|
|
|
2132
2128
|
return undefined;
|
|
2133
2129
|
}
|
|
2134
2130
|
|
|
2131
|
+
/**
|
|
2132
|
+
* The error codes the node FileSystem's `fsyncDir` ignores. Windows cannot open a directory for fsync (EPERM, EACCES,
|
|
2133
|
+
* EISDIR); NTFS journals the directory entry itself. POSIX (#192): some file systems cannot fsync a directory (EINVAL,
|
|
2134
|
+
* ENOTSUP, macOS EOPNOTSUPP); the rename itself has landed. Never ENOENT.
|
|
2135
|
+
*/
|
|
2136
|
+
export function fsyncDirIgnorable(code: string | undefined, platform: NodeJS.Platform): boolean {
|
|
2137
|
+
if (platform === "win32") return code === "EPERM" || code === "EACCES" || code === "EISDIR";
|
|
2138
|
+
return code === "EINVAL" || code === "ENOTSUP" || code === "EOPNOTSUPP";
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2135
2141
|
/** Production `FileSystem` over node:fs. Nothing runs at module load; every call is made on demand. */
|
|
2136
2142
|
export function createNodeFileSystem(): FileSystem {
|
|
2137
2143
|
return {
|
|
@@ -2167,14 +2173,16 @@ export function createNodeFileSystem(): FileSystem {
|
|
|
2167
2173
|
await nodeFsp.rmdir(p);
|
|
2168
2174
|
}
|
|
2169
2175
|
},
|
|
2170
|
-
async mkdir(p) {
|
|
2171
|
-
await nodeFsp.mkdir(p, { recursive: true });
|
|
2176
|
+
async mkdir(p, o) {
|
|
2177
|
+
await nodeFsp.mkdir(p, o?.mode === undefined ? { recursive: true } : { recursive: true, mode: o.mode });
|
|
2172
2178
|
},
|
|
2173
2179
|
readdir: (p) => nodeFsp.readdir(p),
|
|
2174
2180
|
async lstat(p): Promise<FsStat | null> {
|
|
2175
2181
|
try {
|
|
2176
2182
|
const s = await nodeFsp.lstat(p);
|
|
2177
2183
|
const kind: FsStat["kind"] = s.isSymbolicLink() ? "symlink" : s.isDirectory() ? "dir" : s.isFile() ? "file" : "other";
|
|
2184
|
+
// POSIX (#192): owner and mode, for the private slots root and lock directory checks.
|
|
2185
|
+
if (process.platform !== "win32") return { kind, size: s.size, mtimeMs: s.mtimeMs, uid: s.uid, mode: s.mode };
|
|
2178
2186
|
return { kind, size: s.size, mtimeMs: s.mtimeMs };
|
|
2179
2187
|
} catch (e) {
|
|
2180
2188
|
if (fsErrorCode(e) === "ENOENT") return null;
|
|
@@ -2182,13 +2190,9 @@ export function createNodeFileSystem(): FileSystem {
|
|
|
2182
2190
|
}
|
|
2183
2191
|
},
|
|
2184
2192
|
realpath: (p) => nodeFsp.realpath(p),
|
|
2193
|
+
chmod: (p, mode) => nodeFsp.chmod(p, mode),
|
|
2185
2194
|
async fsyncDir(p) {
|
|
2186
|
-
|
|
2187
|
-
const ignorable = (e: unknown): boolean => {
|
|
2188
|
-
if (process.platform !== "win32") return false;
|
|
2189
|
-
const c = fsErrorCode(e);
|
|
2190
|
-
return c === "EPERM" || c === "EACCES" || c === "EISDIR";
|
|
2191
|
-
};
|
|
2195
|
+
const ignorable = (e: unknown): boolean => fsyncDirIgnorable(fsErrorCode(e), process.platform);
|
|
2192
2196
|
let fh: nodeFsp.FileHandle;
|
|
2193
2197
|
try {
|
|
2194
2198
|
fh = await nodeFsp.open(p, "r");
|