@feigi/fleet-ctl 3.76.3 → 3.76.5
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/package.json +1 -1
- package/scripts/fleet-dir.mjs +20 -5
- package/scripts/git-env.mjs +5 -0
- package/scripts/ledger.mjs +14 -6
package/package.json
CHANGED
package/scripts/fleet-dir.mjs
CHANGED
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
// it, otherwise the common git dir itself. This module is the spawn around
|
|
14
14
|
// that function — the scrubbed env, the bound, the join onto `.fleet/` — so a
|
|
15
15
|
// new `.fleet/`-rooted file is one `fleetFile("name")` call rather than
|
|
16
|
-
// another hand-spelled probe.
|
|
16
|
+
// another hand-spelled probe. The bound is per git child, not per call: when
|
|
17
|
+
// the common git dir is not named `.git`, resolveWorkspace() runs a second
|
|
18
|
+
// `rev-parse` after this module's own, with a bound of its own, so one call's
|
|
19
|
+
// worst case approaches twice `timeoutMs`.
|
|
17
20
|
//
|
|
18
21
|
// One error policy: anything that leaves no workspace THROWS
|
|
19
22
|
// FleetDirUnresolvable, never a null or an empty path. What a caller does
|
|
@@ -78,8 +81,10 @@ function workspaceOf(cwd, timeoutMs, canonicalise) {
|
|
|
78
81
|
});
|
|
79
82
|
// No separate `r.status === 0` gate: every failure mode (no repository, an
|
|
80
83
|
// unresolvable GIT_DIR, a permission-denied `.git`, a corrupt worktree
|
|
81
|
-
// pointer, a missing `git` binary, a timed
|
|
82
|
-
// empty, which resolveWorkspace() reads as `null` on its
|
|
84
|
+
// pointer, a missing `git` binary, a probe timed out before it printed)
|
|
85
|
+
// leaves `r.stdout` empty, which resolveWorkspace() reads as `null` on its
|
|
86
|
+
// own. A probe that printed its answer and was THEN killed at its bound
|
|
87
|
+
// leaves that answer in `r.stdout`, so resolveWorkspace() goes on with it.
|
|
83
88
|
let found;
|
|
84
89
|
try {
|
|
85
90
|
found = resolveWorkspace(r.stdout, cwd, { canonicalise, timeoutMs });
|
|
@@ -109,6 +114,13 @@ function workspaceOf(cwd, timeoutMs, canonicalise) {
|
|
|
109
114
|
* it. Everyone else prints the path it resolves, and realpath would change
|
|
110
115
|
* that spelling without changing which file it names.
|
|
111
116
|
*
|
|
117
|
+
* `timeoutMs` (default git-env.mjs's DEFAULT_GIT_TIMEOUT_MS) bounds each git
|
|
118
|
+
* child, not the call. When the common git dir is not named `.git` (the
|
|
119
|
+
* `.bare` layout, a bare repository, a submodule, a `--separate-git-dir`
|
|
120
|
+
* clone), resolveWorkspace() runs a second probe after `--git-common-dir`,
|
|
121
|
+
* with its own full `timeoutMs`, so one call's worst case approaches twice
|
|
122
|
+
* `timeoutMs`.
|
|
123
|
+
*
|
|
112
124
|
* Throws FleetDirUnresolvable for every probe that leaves no workspace — no
|
|
113
125
|
* repository, an unreadable `.git`, git missing, a probe killed at
|
|
114
126
|
* `timeoutMs` — with git's own reason in the message.
|
|
@@ -132,8 +144,11 @@ export function fleetFile(name, { cwd = process.cwd(), timeoutMs, canonicalise =
|
|
|
132
144
|
* so two clones that share a name get different roots. Both come from the
|
|
133
145
|
* canonical form, so a symlinked route to one workspace is not a second root.
|
|
134
146
|
*
|
|
135
|
-
* `home` exists for tests; it defaults to the user's home directory.
|
|
136
|
-
*
|
|
147
|
+
* `home` exists for tests; it defaults to the user's home directory.
|
|
148
|
+
* `timeoutMs` bounds each git child exactly as in fleetFile(): two may run in
|
|
149
|
+
* sequence when the common git dir is not named `.git`, so one call's worst
|
|
150
|
+
* case approaches twice `timeoutMs`. Throws FleetDirUnresolvable exactly as
|
|
151
|
+
* fleetFile() does.
|
|
137
152
|
*/
|
|
138
153
|
export function scratchRoot({ cwd = process.cwd(), timeoutMs, home = homedir() } = {}) {
|
|
139
154
|
const { dir, gitDir } = workspaceOf(cwd, timeoutMs, true);
|
package/scripts/git-env.mjs
CHANGED
|
@@ -159,6 +159,11 @@ function parentGitDirNames(parent, gitDir, cwd, timeoutMs) {
|
|
|
159
159
|
* A path that does not resolve is not a failure: the caller gets back the
|
|
160
160
|
* uncanonicalised path.
|
|
161
161
|
*
|
|
162
|
+
* `timeoutMs` (default DEFAULT_GIT_TIMEOUT_MS) bounds this function's own
|
|
163
|
+
* step-2 probe only, the one spawn it makes. The caller's `--git-common-dir`
|
|
164
|
+
* probe that produced `gitCommonDir` is the caller's to bound, so a caller
|
|
165
|
+
* passing the same `timeoutMs` to both can wait close to twice that in all.
|
|
166
|
+
*
|
|
162
167
|
* Throws WorkspaceProbeFailed only when the step-2 probe could not run to an
|
|
163
168
|
* answer.
|
|
164
169
|
*/
|
package/scripts/ledger.mjs
CHANGED
|
@@ -124,12 +124,20 @@ function cause(...candidates) {
|
|
|
124
124
|
// ledger and only warns (a fallback that predates this budget, not
|
|
125
125
|
// something the budget introduces). It also stays under the `gh` bound beside it —
|
|
126
126
|
// though "dominant" overstates that relationship: a normal invocation
|
|
127
|
-
// without `--file`
|
|
128
|
-
// once more in repoCheck() below, before ever reaching `gh` at all
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
//
|
|
132
|
-
//
|
|
127
|
+
// without `--file` can pay this same budget TWICE in sequence, once here and
|
|
128
|
+
// once more in repoCheck() below, before ever reaching `gh` at all — and
|
|
129
|
+
// THREE times in layouts whose common git dir is not named `.git` (the
|
|
130
|
+
// `.bare` layout, a bare repository, a submodule, a `--separate-git-dir`
|
|
131
|
+
// clone), where fleetFile() runs a second probe with its own full budget:
|
|
132
|
+
// fleetFile()'s bound is per git child, not per call. At default settings
|
|
133
|
+
// two stalled probes TIE `gh`'s own 20 s bound and three exceed it, and even
|
|
134
|
+
// one stall can EXCEED it — up to GIT_TIMEOUT_MS + 20 s — when `gh` still
|
|
135
|
+
// runs (measured). `check`'s worst case is the sum of whichever of its
|
|
136
|
+
// children actually stall, not a single fixed term. That is three children
|
|
137
|
+
// normally; in those layouts it is three git children, and `gh` is a fourth
|
|
138
|
+
// only where the ledger's repository still has a work tree (a submodule) —
|
|
139
|
+
// in the `.bare`, bare and `--separate-git-dir` layouts repoCheck() fails
|
|
140
|
+
// and `gh` never runs (measured).
|
|
133
141
|
//
|
|
134
142
|
// `LEDGER_GIT_TIMEOUT` is this script's OWN override, in seconds, and it can
|
|
135
143
|
// only ever SHORTEN. The rule and the reasons for it are net_budget's, in
|