@calltelemetry/fmix 2.7.23 → 2.7.25
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/bin/fmix +324 -19
- package/package.json +3 -3
package/bin/fmix
CHANGED
|
@@ -28,7 +28,7 @@ set -uo pipefail
|
|
|
28
28
|
# ---------------------------------------------------------------------------
|
|
29
29
|
# Constants & config
|
|
30
30
|
# ---------------------------------------------------------------------------
|
|
31
|
-
FMIX_VERSION="2.7.
|
|
31
|
+
FMIX_VERSION="2.7.25"
|
|
32
32
|
FMIX_HOME="${FMIX_HOME:-${HOME}/.ct-fmix}"
|
|
33
33
|
FMIX_OS="$(uname -s)"
|
|
34
34
|
FMIX_ARCH="$(uname -m)"
|
|
@@ -145,6 +145,10 @@ FMIX_LAST_LOCK_KEEPER_PID=""
|
|
|
145
145
|
FMIX_LOCK_STOP_PROBE_PIDS=()
|
|
146
146
|
FMIX_PENDING_LOCK_KEEPER_PID=""
|
|
147
147
|
FMIX_PENDING_LOCK_KEEPER_STATE=""
|
|
148
|
+
# Typed kind of the last keeper bootstrap failure, set only after its keeper
|
|
149
|
+
# was retired: "bootstrap_deadline" (host load; retryable) or "bootstrap_failed"
|
|
150
|
+
# (genuine; fail fast). Callers branch on this, never on the message text.
|
|
151
|
+
FMIX_LAST_LOCK_KEEPER_FAILURE=""
|
|
148
152
|
|
|
149
153
|
# Set by fmix_activate_session before any mutable artifact, stamp, or scratch
|
|
150
154
|
# database path is resolved.
|
|
@@ -7144,7 +7148,9 @@ fmix_lock_keeper_start() {
|
|
|
7144
7148
|
local lock_name="${5:-${diagnostic_name:-lock}}"
|
|
7145
7149
|
local py_bin owner_pid owner_file state keeper_pid status keeper_source
|
|
7146
7150
|
local bootstrap_deadline acquire_deadline="" failure="keeper exited before readiness"
|
|
7151
|
+
local bootstrap_secs failure_kind="bootstrap_failed" retryable=false
|
|
7147
7152
|
local probe_pid
|
|
7153
|
+
FMIX_LAST_LOCK_KEEPER_FAILURE=""
|
|
7148
7154
|
# Failed retirement is not contention. Preserve its exact recovery handle
|
|
7149
7155
|
# rather than overwriting it with a second keeper, even for a different lock.
|
|
7150
7156
|
if [[ -n "$FMIX_PENDING_LOCK_KEEPER_PID" ]]; then
|
|
@@ -7329,7 +7335,11 @@ finally:
|
|
|
7329
7335
|
# try-locks still need a finite startup allowance, but a started keeper may
|
|
7330
7336
|
# wait for the original contention timeout. SECONDS is shell-local and
|
|
7331
7337
|
# avoids launching a clock subprocess for every poll.
|
|
7332
|
-
|
|
7338
|
+
# Interpreter start-up alone can exceed five seconds on a host under heavy
|
|
7339
|
+
# load (ADR 0478 agents share one machine). The default is deliberately
|
|
7340
|
+
# generous; FMIX_LOCK_KEEPER_BOOTSTRAP_SECS overrides it for tests and ops.
|
|
7341
|
+
bootstrap_secs="$(fmix_positive_uint_or_default "${FMIX_LOCK_KEEPER_BOOTSTRAP_SECS:-30}" 30 FMIX_LOCK_KEEPER_BOOTSTRAP_SECS)"
|
|
7342
|
+
bootstrap_deadline=$(( SECONDS + bootstrap_secs ))
|
|
7333
7343
|
while true; do
|
|
7334
7344
|
if [[ -s "$state" ]]; then
|
|
7335
7345
|
IFS= read -r status <"$state"
|
|
@@ -7365,6 +7375,7 @@ finally:
|
|
|
7365
7375
|
if [[ -z "$acquire_deadline" ]]; then
|
|
7366
7376
|
if (( SECONDS >= bootstrap_deadline )); then
|
|
7367
7377
|
failure="keeper bootstrap deadline exceeded"
|
|
7378
|
+
failure_kind="bootstrap_deadline"
|
|
7368
7379
|
break
|
|
7369
7380
|
fi
|
|
7370
7381
|
elif (( SECONDS >= acquire_deadline )); then
|
|
@@ -7373,9 +7384,14 @@ finally:
|
|
|
7373
7384
|
fi
|
|
7374
7385
|
sleep 0.05
|
|
7375
7386
|
done
|
|
7387
|
+
[[ "$failure_kind" != bootstrap_deadline ]] || retryable=true
|
|
7376
7388
|
# This is exactly the child launched above, never an inferred lock holder.
|
|
7377
|
-
printf '{"error":"lock_keeper_bootstrap_failed","reason":"%s"}\n'
|
|
7389
|
+
printf '{"error":"lock_keeper_bootstrap_failed","reason":"%s","retryable":%s}\n' \
|
|
7390
|
+
"$failure" "$retryable" >&2
|
|
7378
7391
|
fmix_lock_keeper_retire "$keeper_pid" "$state" || return 70
|
|
7392
|
+
# Publish the typed kind only after the abandoned keeper is confirmed gone:
|
|
7393
|
+
# a retry must never run beside a keeper this attempt failed to retire.
|
|
7394
|
+
FMIX_LAST_LOCK_KEEPER_FAILURE="$failure_kind"
|
|
7379
7395
|
return 70
|
|
7380
7396
|
}
|
|
7381
7397
|
|
|
@@ -8061,10 +8077,195 @@ fmix_host_test_lock_enabled() {
|
|
|
8061
8077
|
# Worktree resolution: find nearest cisco-cdr checkout from CWD
|
|
8062
8078
|
# ---------------------------------------------------------------------------
|
|
8063
8079
|
|
|
8080
|
+
# REL-3297: fmix probes git as `git -C <worktree> ... 2>/dev/null` in well over
|
|
8081
|
+
# a hundred places. A checkout whose git metadata does not resolve back to the
|
|
8082
|
+
# checkout itself therefore failed far from its cause, most visibly as "Could
|
|
8083
|
+
# not capture a source-stability identity after acquiring the worktree lock".
|
|
8084
|
+
# The usual cause is a linked worktree of a submodule: once
|
|
8085
|
+
# extensions.worktreeConfig is true it inherits the submodule's shared,
|
|
8086
|
+
# relative core.worktree and resolves it against its own per-worktree gitdir.
|
|
8087
|
+
# That names a missing directory, or the module gitdir itself, where a
|
|
8088
|
+
# submodule bootstrap or checkout would write the tree into the git directory.
|
|
8089
|
+
#
|
|
8090
|
+
# Diagnose before any lock, session or submodule work and name the exact config
|
|
8091
|
+
# file and a one-line repair. Values are read with `git config --file` from `/`
|
|
8092
|
+
# because every repository-scoped git command run inside the broken checkout
|
|
8093
|
+
# dies during setup. fmix never rewrites git config itself.
|
|
8094
|
+
|
|
8095
|
+
# Collapse `.`, `..` and repeated slashes in an absolute path without touching
|
|
8096
|
+
# the filesystem, so a core.worktree that names a missing directory can still
|
|
8097
|
+
# be shown where it lands.
|
|
8098
|
+
fmix_lexical_abs_path() {
|
|
8099
|
+
local path="${1:-}" part out=""
|
|
8100
|
+
local -a parts=() kept=()
|
|
8101
|
+
[[ "$path" == /* ]] || return 1
|
|
8102
|
+
IFS='/' read -r -a parts <<<"$path"
|
|
8103
|
+
for part in "${parts[@]+"${parts[@]}"}"; do
|
|
8104
|
+
case "$part" in
|
|
8105
|
+
''|.) ;;
|
|
8106
|
+
..)
|
|
8107
|
+
if (( ${#kept[@]} > 0 )); then
|
|
8108
|
+
unset "kept[$(( ${#kept[@]} - 1 ))]"
|
|
8109
|
+
kept=("${kept[@]+"${kept[@]}"}")
|
|
8110
|
+
fi
|
|
8111
|
+
;;
|
|
8112
|
+
*) kept+=("$part") ;;
|
|
8113
|
+
esac
|
|
8114
|
+
done
|
|
8115
|
+
for part in "${kept[@]+"${kept[@]}"}"; do
|
|
8116
|
+
out="$out/$part"
|
|
8117
|
+
done
|
|
8118
|
+
printf '%s\n' "${out:-/}"
|
|
8119
|
+
}
|
|
8120
|
+
|
|
8121
|
+
# Read one key from one config file, outside any repository and ignoring any
|
|
8122
|
+
# GIT_* environment that would redirect git's own setup.
|
|
8123
|
+
fmix_git_config_file_get() {
|
|
8124
|
+
local file="${1:-}" key="${2:-}"
|
|
8125
|
+
shift 2 || return 1
|
|
8126
|
+
[[ -f "$file" ]] || return 1
|
|
8127
|
+
env -u GIT_DIR -u GIT_WORK_TREE -u GIT_COMMON_DIR -u GIT_CONFIG \
|
|
8128
|
+
git -C / config --file "$file" "$@" --get "$key" 2>/dev/null
|
|
8129
|
+
}
|
|
8130
|
+
|
|
8131
|
+
# Print a diagnosis and return 1 when `dir` is a git checkout whose metadata
|
|
8132
|
+
# does not resolve back to `dir`. Silent and 0 for a sound checkout and for a
|
|
8133
|
+
# directory without a `.git` entry (the non-git contract is unchanged).
|
|
8134
|
+
fmix_git_worktree_metadata_report() {
|
|
8135
|
+
local dir="${1:-}" real err_file toplevel="" real_toplevel="" git_err=""
|
|
8136
|
+
local gitfile_line="" gitdir="" commondir="" ext="" bare="" value="" origin=""
|
|
8137
|
+
local resolved="" real_resolved="" where="" fix_file=""
|
|
8138
|
+
[[ -n "$dir" ]] || return 0
|
|
8139
|
+
real="$(fmix_realpath "$dir" 2>/dev/null)" || return 0
|
|
8140
|
+
[[ -n "$real" ]] || return 0
|
|
8141
|
+
[[ -e "$real/.git" || -L "$real/.git" ]] || return 0
|
|
8142
|
+
|
|
8143
|
+
err_file="$(mktemp)" || return 1
|
|
8144
|
+
if toplevel="$(git -C "$real" rev-parse --show-toplevel 2>"$err_file")" && [[ -n "$toplevel" ]]; then
|
|
8145
|
+
real_toplevel="$(fmix_realpath "$toplevel" 2>/dev/null)" || real_toplevel="$toplevel"
|
|
8146
|
+
if [[ "$real_toplevel" == "$real" ]]; then
|
|
8147
|
+
rm -f "$err_file"
|
|
8148
|
+
return 0
|
|
8149
|
+
fi
|
|
8150
|
+
else
|
|
8151
|
+
toplevel=""
|
|
8152
|
+
fi
|
|
8153
|
+
git_err="$(head -n 1 "$err_file" 2>/dev/null)"
|
|
8154
|
+
rm -f "$err_file"
|
|
8155
|
+
|
|
8156
|
+
if [[ -f "$real/.git" ]]; then
|
|
8157
|
+
gitfile_line="$(head -n 1 "$real/.git" 2>/dev/null)"
|
|
8158
|
+
gitdir="${gitfile_line#gitdir: }"
|
|
8159
|
+
[[ "$gitdir" == /* ]] || gitdir="$real/$gitdir"
|
|
8160
|
+
else
|
|
8161
|
+
gitdir="$real/.git"
|
|
8162
|
+
fi
|
|
8163
|
+
if [[ -d "$gitdir" ]]; then
|
|
8164
|
+
gitdir="$(fmix_realpath "$gitdir" 2>/dev/null)" || gitdir="$(fmix_lexical_abs_path "$gitdir")"
|
|
8165
|
+
else
|
|
8166
|
+
gitdir="$(fmix_lexical_abs_path "$gitdir")"
|
|
8167
|
+
printf 'git_worktree_metadata_broken: %s/.git names gitdir %s, which does not exist.\n' "$real" "$gitdir"
|
|
8168
|
+
[[ -z "$git_err" ]] || printf 'git said: %s\n' "$git_err"
|
|
8169
|
+
printf 'fix: run `git worktree repair %s` from the main checkout of this repository, or recreate the worktree.\n' "$real"
|
|
8170
|
+
return 1
|
|
8171
|
+
fi
|
|
8172
|
+
commondir="$gitdir"
|
|
8173
|
+
if [[ -f "$gitdir/commondir" ]]; then
|
|
8174
|
+
commondir="$(head -n 1 "$gitdir/commondir" 2>/dev/null)"
|
|
8175
|
+
[[ "$commondir" == /* ]] || commondir="$gitdir/$commondir"
|
|
8176
|
+
commondir="$(fmix_realpath "$commondir" 2>/dev/null)" || commondir="$(fmix_lexical_abs_path "$commondir")"
|
|
8177
|
+
fi
|
|
8178
|
+
|
|
8179
|
+
ext="$(fmix_git_config_file_get "$commondir/config" extensions.worktreeConfig --bool)" || ext=""
|
|
8180
|
+
if [[ "$ext" == "true" ]] \
|
|
8181
|
+
&& value="$(fmix_git_config_file_get "$gitdir/config.worktree" core.worktree)"; then
|
|
8182
|
+
origin="$gitdir/config.worktree"
|
|
8183
|
+
elif value="$(fmix_git_config_file_get "$commondir/config" core.worktree)"; then
|
|
8184
|
+
origin="$commondir/config"
|
|
8185
|
+
# Without extensions.worktreeConfig git ignores the shared value in a
|
|
8186
|
+
# linked worktree, so it cannot be this worktree's cause.
|
|
8187
|
+
if [[ "$gitdir" != "$commondir" && "$ext" != "true" ]]; then
|
|
8188
|
+
value=""
|
|
8189
|
+
origin=""
|
|
8190
|
+
fi
|
|
8191
|
+
else
|
|
8192
|
+
value=""
|
|
8193
|
+
fi
|
|
8194
|
+
|
|
8195
|
+
if [[ -n "$value" ]]; then
|
|
8196
|
+
printf 'git_core_worktree_broken: git cannot resolve %s to itself, so no source identity, receipt or dirty-tree check can run there.\n' "$real"
|
|
8197
|
+
else
|
|
8198
|
+
printf 'git_worktree_metadata_broken: git cannot resolve %s to itself, so no source identity, receipt or dirty-tree check can run there.\n' "$real"
|
|
8199
|
+
fi
|
|
8200
|
+
if [[ -n "$toplevel" ]]; then
|
|
8201
|
+
printf 'git resolves it to %s\n' "${real_toplevel:-$toplevel}"
|
|
8202
|
+
elif [[ -n "$git_err" ]]; then
|
|
8203
|
+
printf 'git said: %s\n' "$git_err"
|
|
8204
|
+
fi
|
|
8205
|
+
printf 'gitdir: %s\n' "$gitdir"
|
|
8206
|
+
if [[ -n "${GIT_DIR:-}" || -n "${GIT_WORK_TREE:-}" ]]; then
|
|
8207
|
+
printf 'environment overrides discovery: GIT_DIR=%s GIT_WORK_TREE=%s\n' "${GIT_DIR:-}" "${GIT_WORK_TREE:-}"
|
|
8208
|
+
fi
|
|
8209
|
+
bare="$(fmix_git_config_file_get "$commondir/config" core.bare --bool)" || bare=""
|
|
8210
|
+
if [[ "$bare" == "true" ]]; then
|
|
8211
|
+
printf 'core.bare = true (set in %s): git treats this repository as having no work tree.\n' "$commondir/config"
|
|
8212
|
+
fi
|
|
8213
|
+
|
|
8214
|
+
if [[ -z "$value" ]]; then
|
|
8215
|
+
printf 'no core.worktree applies to this checkout; check `git -C %s rev-parse --show-toplevel` and the GIT_* environment.\n' "$real"
|
|
8216
|
+
return 1
|
|
8217
|
+
fi
|
|
8218
|
+
|
|
8219
|
+
case "$value" in
|
|
8220
|
+
/*) resolved="$(fmix_lexical_abs_path "$value")" ;;
|
|
8221
|
+
*) resolved="$(fmix_lexical_abs_path "$gitdir/$value")" ;;
|
|
8222
|
+
esac
|
|
8223
|
+
if [[ ! -d "$resolved" ]]; then
|
|
8224
|
+
where="a directory that does not exist"
|
|
8225
|
+
else
|
|
8226
|
+
real_resolved="$(fmix_realpath "$resolved" 2>/dev/null)" || real_resolved="$resolved"
|
|
8227
|
+
case "$real_resolved/" in
|
|
8228
|
+
"$gitdir"/*|"$commondir"/*)
|
|
8229
|
+
where="the git directory itself; a status, checkout or submodule update there acts on the gitdir"
|
|
8230
|
+
;;
|
|
8231
|
+
*) where="another directory, not this checkout" ;;
|
|
8232
|
+
esac
|
|
8233
|
+
fi
|
|
8234
|
+
printf 'core.worktree = %s (set in %s)\n' "$value" "$origin"
|
|
8235
|
+
printf 'it resolves against %s to %s: %s.\n' "$gitdir" "$resolved" "$where"
|
|
8236
|
+
if [[ "$origin" == "$commondir/config" && "$gitdir" != "$commondir" ]]; then
|
|
8237
|
+
printf 'cause: with extensions.worktreeConfig=true a linked worktree reads the shared core.worktree of %s unless its own config.worktree overrides it, and a relative value resolves against the linked gitdir.\n' "$commondir/config"
|
|
8238
|
+
fi
|
|
8239
|
+
fix_file="$gitdir/config.worktree"
|
|
8240
|
+
[[ "$ext" == "true" ]] || fix_file="$commondir/config"
|
|
8241
|
+
printf "fix (this worktree only): git config --file '%s' core.worktree '%s'\n" "$fix_file" "$real"
|
|
8242
|
+
printf "verify: git -C '%s' rev-parse --show-toplevel must print %s\n" "$real" "$real"
|
|
8243
|
+
return 1
|
|
8244
|
+
}
|
|
8245
|
+
|
|
8246
|
+
# Refuse a checkout whose git metadata is broken, naming the cause on stderr.
|
|
8247
|
+
fmix_require_git_worktree_metadata() {
|
|
8248
|
+
local report line
|
|
8249
|
+
report="$(fmix_git_worktree_metadata_report "${1:-}")" && return 0
|
|
8250
|
+
if [[ -z "$report" ]]; then
|
|
8251
|
+
fmix_error "git_worktree_metadata_broken: could not inspect the git metadata of ${1:-}."
|
|
8252
|
+
return 1
|
|
8253
|
+
fi
|
|
8254
|
+
while IFS= read -r line; do
|
|
8255
|
+
[[ -n "$line" ]] && fmix_error "$line"
|
|
8256
|
+
done <<<"$report"
|
|
8257
|
+
return 1
|
|
8258
|
+
}
|
|
8259
|
+
|
|
8064
8260
|
fmix_ensure_worktree_submodules() {
|
|
8065
8261
|
local target_dir="$1"
|
|
8066
8262
|
local selected_gitlink="${2:-}"
|
|
8067
8263
|
|
|
8264
|
+
# REL-3297: never run a submodule bootstrap through git metadata that
|
|
8265
|
+
# resolves to another tree (it could land in the module gitdir). The
|
|
8266
|
+
# caller's fmix_require_git_worktree_metadata names the cause.
|
|
8267
|
+
fmix_git_worktree_metadata_report "$target_dir" >/dev/null || return 0
|
|
8268
|
+
|
|
8068
8269
|
# Find top-level repo if inside a Git tree
|
|
8069
8270
|
local top_repo
|
|
8070
8271
|
top_repo="$(git -C "$target_dir" rev-parse --show-toplevel 2>/dev/null)" || return 0
|
|
@@ -8361,7 +8562,17 @@ fmix_worktree_is_cold_submodule() {
|
|
|
8361
8562
|
return 1
|
|
8362
8563
|
}
|
|
8363
8564
|
|
|
8565
|
+
# Resolve the cisco-cdr checkout, then refuse it when its git metadata does not
|
|
8566
|
+
# resolve back to it (REL-3297). Every verb that resolves a worktree goes through
|
|
8567
|
+
# here, so the named error replaces the unrelated failures further down.
|
|
8364
8568
|
fmix_find_worktree() {
|
|
8569
|
+
local found
|
|
8570
|
+
found="$(fmix_find_worktree_resolve "$@")" || return 1
|
|
8571
|
+
fmix_require_git_worktree_metadata "$found" || return 1
|
|
8572
|
+
printf '%s\n' "$found"
|
|
8573
|
+
}
|
|
8574
|
+
|
|
8575
|
+
fmix_find_worktree_resolve() {
|
|
8365
8576
|
local path="$1"
|
|
8366
8577
|
# Admission needs a verified candidate without initializing submodules.
|
|
8367
8578
|
# The default resolution still initializes and verifies the checkout.
|
|
@@ -12635,6 +12846,21 @@ fmix_ensure_partitions() {
|
|
|
12635
12846
|
# compile step: ensure app beams are up to date in the worktree
|
|
12636
12847
|
# ---------------------------------------------------------------------------
|
|
12637
12848
|
|
|
12849
|
+
fmix_git_in() {
|
|
12850
|
+
# Run git in <dir>. A linked worktree of a bare hub (core.bare=true, with
|
|
12851
|
+
# extensions.worktreeConfig) reports "false" for is-inside-work-tree and
|
|
12852
|
+
# rejects every work-tree command. Only in that case pass the work tree
|
|
12853
|
+
# explicitly; other failures keep git's native resolution so the existing
|
|
12854
|
+
# dead-core.worktree diagnostics still apply.
|
|
12855
|
+
local dir="$1"
|
|
12856
|
+
shift
|
|
12857
|
+
if [[ "$(git -C "$dir" rev-parse --is-inside-work-tree 2>/dev/null)" == "false" ]]; then
|
|
12858
|
+
git -C "$dir" --work-tree="$dir" "$@"
|
|
12859
|
+
else
|
|
12860
|
+
git -C "$dir" "$@"
|
|
12861
|
+
fi
|
|
12862
|
+
}
|
|
12863
|
+
|
|
12638
12864
|
fmix_compile_build_root() {
|
|
12639
12865
|
local worktree="$1" configured="${MIX_BUILD_PATH:-_build}"
|
|
12640
12866
|
if [[ -n "$FMIX_ACTIVE_SESSION_ROOT" \
|
|
@@ -12724,10 +12950,10 @@ fmix_hash_compile_paths() {
|
|
|
12724
12950
|
fmix_reject_compile_input_symlink_components "$root" "$path" || return 1
|
|
12725
12951
|
done
|
|
12726
12952
|
if [[ -d "$root/.git" || -f "$root/.git" ]]; then
|
|
12727
|
-
|
|
12953
|
+
fmix_git_in "$root" rev-parse --is-inside-work-tree >/dev/null 2>&1 \
|
|
12728
12954
|
|| return 1
|
|
12729
12955
|
tracked_file="$(mktemp)" || return 1
|
|
12730
|
-
if !
|
|
12956
|
+
if ! fmix_git_in "$root" ls-files -s -z -- "$@" \
|
|
12731
12957
|
>"$tracked_file" 2>/dev/null; then
|
|
12732
12958
|
rm -f "$tracked_file"
|
|
12733
12959
|
return 1
|
|
@@ -12739,14 +12965,14 @@ fmix_hash_compile_paths() {
|
|
|
12739
12965
|
rm -f "$tracked_file"
|
|
12740
12966
|
untracked_file="$(mktemp)" || return 1
|
|
12741
12967
|
if ! (
|
|
12742
|
-
|
|
12968
|
+
fmix_git_in "$root" ls-files --others --exclude-standard -z -- "$@" \
|
|
12743
12969
|
|| exit 1
|
|
12744
12970
|
# Git ignores do not change what Mix can compile or execute. Keep
|
|
12745
12971
|
# ignored source files in the exact run identity, but only beneath
|
|
12746
12972
|
# the caller's bounded source/test pathspecs. Never widen an empty
|
|
12747
12973
|
# pathspec into a scan of ignored cache artifacts.
|
|
12748
12974
|
if (( $# > 0 )); then
|
|
12749
|
-
|
|
12975
|
+
fmix_git_in "$root" ls-files --others --ignored \
|
|
12750
12976
|
--exclude-standard -z -- "$@" || exit 1
|
|
12751
12977
|
fi
|
|
12752
12978
|
) >"$untracked_file" 2>/dev/null; then
|
|
@@ -12810,11 +13036,11 @@ fmix_ignored_compile_inputs_hash() {
|
|
|
12810
13036
|
return 0
|
|
12811
13037
|
fi
|
|
12812
13038
|
command -v git >/dev/null 2>&1 || return 1
|
|
12813
|
-
|
|
13039
|
+
fmix_git_in "$real" rev-parse --is-inside-work-tree >/dev/null 2>&1 \
|
|
12814
13040
|
|| return 1
|
|
12815
13041
|
ignored_file="$(mktemp)" || return 1
|
|
12816
13042
|
manifest="$(mktemp)" || { rm -f "$ignored_file"; return 1; }
|
|
12817
|
-
if !
|
|
13043
|
+
if ! fmix_git_in "$real" ls-files --others --ignored --exclude-standard -z \
|
|
12818
13044
|
-- "${compile_paths[@]}" >"$ignored_file" 2>/dev/null; then
|
|
12819
13045
|
rm -f "$ignored_file" "$manifest"
|
|
12820
13046
|
return 1
|
|
@@ -12906,9 +13132,9 @@ fmix_source_stability_compile_identity() {
|
|
|
12906
13132
|
(( $# >= 1 )) || return 1
|
|
12907
13133
|
real="$(fmix_realpath "$worktree")" || return 1
|
|
12908
13134
|
if [[ -d "$real/.git" || -f "$real/.git" ]]; then
|
|
12909
|
-
|
|
13135
|
+
fmix_git_in "$real" rev-parse --is-inside-work-tree >/dev/null 2>&1 \
|
|
12910
13136
|
|| return 1
|
|
12911
|
-
head="$(
|
|
13137
|
+
head="$(fmix_git_in "$real" rev-parse HEAD 2>/dev/null)" || return 1
|
|
12912
13138
|
[[ "$head" =~ ^[0-9a-f]{40}$ ]] || return 1
|
|
12913
13139
|
else
|
|
12914
13140
|
head="non-git"
|
|
@@ -13130,6 +13356,22 @@ fmix_compute_dependency_fingerprint() {
|
|
|
13130
13356
|
printf '%s\n' "$fingerprint"
|
|
13131
13357
|
}
|
|
13132
13358
|
|
|
13359
|
+
fmix_dependency_provenance_failure_cause() {
|
|
13360
|
+
# Name why the dependency fingerprint could not be computed. The probes
|
|
13361
|
+
# themselves swallow git stderr, so ask git directly. A linked worktree of
|
|
13362
|
+
# a bare hub (core.bare=true) answers "false" to plain rev-parse and must
|
|
13363
|
+
# be reported as such, not as a generic provenance failure.
|
|
13364
|
+
local worktree="$1" probe
|
|
13365
|
+
probe="$(git -C "$worktree" rev-parse --is-inside-work-tree 2>&1)" || probe="error: ${probe}"
|
|
13366
|
+
if [[ "$probe" == "false" ]]; then
|
|
13367
|
+
printf '%s\n' "git reports $worktree is not a work tree (core.bare=true in the shared repo config); fmix now passes --work-tree explicitly, so this checkout is not a supported git layout"
|
|
13368
|
+
elif [[ "$probe" == "true" ]]; then
|
|
13369
|
+
printf '%s\n' "git resolves a work tree for $worktree, so a dependency input could not be hashed (see the fmix error above and 'fmix doctor')"
|
|
13370
|
+
else
|
|
13371
|
+
printf '%s\n' "git could not inspect $worktree: $probe"
|
|
13372
|
+
fi
|
|
13373
|
+
}
|
|
13374
|
+
|
|
13133
13375
|
fmix_compute_mix_project_reconciliation_guard() {
|
|
13134
13376
|
# Normalize mix.exs while replacing exactly one ordinary deps/0 body. This
|
|
13135
13377
|
# permits dependency declaration/constraint edits but keeps application,
|
|
@@ -13627,16 +13869,16 @@ fmix_hash_git_dependency() {
|
|
|
13627
13869
|
local dependency="$1" commit diff_hash file untracked_file
|
|
13628
13870
|
local -a untracked=()
|
|
13629
13871
|
fmix_reject_nested_source_symlinks "$dependency" || return 1
|
|
13630
|
-
commit="$(
|
|
13872
|
+
commit="$(fmix_git_in "$dependency" rev-parse HEAD 2>/dev/null)" || return 1
|
|
13631
13873
|
[[ -n "$commit" ]] || return 1
|
|
13632
13874
|
printf '.git-commit:%s\n' "$commit"
|
|
13633
13875
|
|
|
13634
|
-
diff_hash="$(
|
|
13876
|
+
diff_hash="$(fmix_git_in "$dependency" diff --no-ext-diff --binary HEAD 2>/dev/null \
|
|
13635
13877
|
| fmix_hash_stdin)" || return 1
|
|
13636
13878
|
printf '.git-worktree-diff:%s\n' "$diff_hash"
|
|
13637
13879
|
|
|
13638
13880
|
untracked_file="$(mktemp)" || return 1
|
|
13639
|
-
if !
|
|
13881
|
+
if ! fmix_git_in "$dependency" ls-files --others --exclude-standard -z \
|
|
13640
13882
|
>"$untracked_file" 2>/dev/null; then
|
|
13641
13883
|
rm -f "$untracked_file"
|
|
13642
13884
|
return 1
|
|
@@ -14527,8 +14769,14 @@ fmix_compile_semaphore_acquire() {
|
|
|
14527
14769
|
local permits deadline_secs
|
|
14528
14770
|
permits="$(fmix_compile_semaphore_permits)"
|
|
14529
14771
|
deadline_secs="${FMIX_CALLER_DEADLINE_SECS:-}"
|
|
14530
|
-
|
|
14531
|
-
|
|
14772
|
+
# A keeper bootstrap that misses its deadline under host load is transient:
|
|
14773
|
+
# retry it on a bounded backoff. The budget keeps a truly hung interpreter
|
|
14774
|
+
# from blocking forever when no caller deadline is set.
|
|
14775
|
+
local bootstrap_retries bootstrap_retries_left bootstrap_backoff=1
|
|
14776
|
+
bootstrap_retries="$(fmix_uint_or_default "${FMIX_LOCK_KEEPER_BOOTSTRAP_RETRIES:-3}" 3 FMIX_LOCK_KEEPER_BOOTSTRAP_RETRIES)"
|
|
14777
|
+
bootstrap_retries_left="$bootstrap_retries"
|
|
14778
|
+
|
|
14779
|
+
local slot acquired_slot=-1 acquired_keeper_pid="" bootstrap_transient=0
|
|
14532
14780
|
mkdir -p "$FMIX_HOME/lock-kernel" "$FMIX_HOME/lock-metadata" || return 1
|
|
14533
14781
|
|
|
14534
14782
|
local t0=$(fmix_epoch)
|
|
@@ -14536,6 +14784,7 @@ fmix_compile_semaphore_acquire() {
|
|
|
14536
14784
|
local estimated_compile_s=60
|
|
14537
14785
|
|
|
14538
14786
|
while true; do
|
|
14787
|
+
bootstrap_transient=0
|
|
14539
14788
|
for (( slot = 0; slot < permits; slot++ )); do
|
|
14540
14789
|
local kfile="$FMIX_HOME/lock-kernel/compile-permit-${slot}"
|
|
14541
14790
|
local keeper_rc=0
|
|
@@ -14546,9 +14795,16 @@ fmix_compile_semaphore_acquire() {
|
|
|
14546
14795
|
break
|
|
14547
14796
|
else
|
|
14548
14797
|
keeper_rc=$?
|
|
14549
|
-
#
|
|
14550
|
-
|
|
14551
|
-
|
|
14798
|
+
# Real contention is rc 1 and is handled below.
|
|
14799
|
+
(( keeper_rc == 1 )) && continue
|
|
14800
|
+
# The abandoned keeper was retired; retry the whole pass.
|
|
14801
|
+
if [[ "$FMIX_LAST_LOCK_KEEPER_FAILURE" == bootstrap_deadline ]]; then
|
|
14802
|
+
bootstrap_transient=1
|
|
14803
|
+
break
|
|
14804
|
+
fi
|
|
14805
|
+
# A genuine bootstrap error is not permit contention. Surface
|
|
14806
|
+
# its typed failure immediately instead of retrying it.
|
|
14807
|
+
return "$keeper_rc"
|
|
14552
14808
|
fi
|
|
14553
14809
|
done
|
|
14554
14810
|
|
|
@@ -14571,6 +14827,25 @@ EOF
|
|
|
14571
14827
|
local elapsed=$(( now - t0 ))
|
|
14572
14828
|
local queue_depth=$permits
|
|
14573
14829
|
|
|
14830
|
+
if (( bootstrap_transient )); then
|
|
14831
|
+
if (( bootstrap_retries_left == 0 )); then
|
|
14832
|
+
printf '{"error":"lock_keeper_bootstrap_deadline_exhausted","retries":%d}\n' \
|
|
14833
|
+
"$bootstrap_retries" >&2
|
|
14834
|
+
return 70
|
|
14835
|
+
fi
|
|
14836
|
+
if [[ -n "$deadline_secs" && "$deadline_secs" =~ ^[0-9]+$ ]] \
|
|
14837
|
+
&& (( elapsed + bootstrap_backoff >= deadline_secs )); then
|
|
14838
|
+
printf '{"error": "host_compile_deadline_exceeded", "queue_depth": %d, "estimated_wait_s": 0, "permit_limit": %d}\n' \
|
|
14839
|
+
"$queue_depth" "$permits" >&2
|
|
14840
|
+
return 75
|
|
14841
|
+
fi
|
|
14842
|
+
fmix_info "Compile keeper bootstrap exceeded its deadline under host load; retrying in ${bootstrap_backoff}s."
|
|
14843
|
+
bootstrap_retries_left=$(( bootstrap_retries_left - 1 ))
|
|
14844
|
+
sleep "$bootstrap_backoff"
|
|
14845
|
+
(( bootstrap_backoff >= 8 )) || bootstrap_backoff=$(( bootstrap_backoff * 2 ))
|
|
14846
|
+
continue
|
|
14847
|
+
fi
|
|
14848
|
+
|
|
14574
14849
|
if [[ -n "$deadline_secs" && "$deadline_secs" =~ ^[0-9]+$ ]]; then
|
|
14575
14850
|
local estimated_wait=$(( (queue_depth / permits) * estimated_compile_s ))
|
|
14576
14851
|
if (( elapsed + estimated_wait + estimated_compile_s > deadline_secs )); then
|
|
@@ -15119,6 +15394,7 @@ _fmix_ensure_compile_impl() {
|
|
|
15119
15394
|
return 0
|
|
15120
15395
|
fi
|
|
15121
15396
|
fmix_error "Compile artifacts are valid, but final dependency provenance could not be recorded."
|
|
15397
|
+
fmix_error "$(fmix_dependency_provenance_failure_cause "$worktree")"
|
|
15122
15398
|
FMIX_LAST_COMPILE_OUTCOME="error"
|
|
15123
15399
|
return 1
|
|
15124
15400
|
fi
|
|
@@ -15254,6 +15530,7 @@ _fmix_ensure_compile_impl() {
|
|
|
15254
15530
|
|| ! fmix_write_dependency_stamp "$worktree" "$dependency_fingerprint"; then
|
|
15255
15531
|
fmix_invalidate_rejected_stamps "$worktree"
|
|
15256
15532
|
fmix_error "Compile succeeded, but final dependency provenance could not be recorded."
|
|
15533
|
+
fmix_error "$(fmix_dependency_provenance_failure_cause "$worktree")"
|
|
15257
15534
|
FMIX_LAST_COMPILE_OUTCOME="error"
|
|
15258
15535
|
return 1
|
|
15259
15536
|
fi
|
|
@@ -17055,6 +17332,8 @@ cmd_verify_push() {
|
|
|
17055
17332
|
local real_worktree
|
|
17056
17333
|
real_worktree="$(fmix_realpath "$worktree")"
|
|
17057
17334
|
|
|
17335
|
+
# REL-3297: name a broken core.worktree instead of "not a git worktree".
|
|
17336
|
+
fmix_require_git_worktree_metadata "$real_worktree" || return 1
|
|
17058
17337
|
if ! git -C "$real_worktree" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
17059
17338
|
fmix_error "Path is not inside a git worktree: $real_worktree"
|
|
17060
17339
|
return 1
|
|
@@ -17248,6 +17527,8 @@ cmd_hook_install() {
|
|
|
17248
17527
|
fi
|
|
17249
17528
|
local real_worktree
|
|
17250
17529
|
real_worktree="$(fmix_realpath "$worktree")"
|
|
17530
|
+
# REL-3297: name a broken core.worktree instead of "not a git worktree".
|
|
17531
|
+
fmix_require_git_worktree_metadata "$real_worktree" || return 1
|
|
17251
17532
|
if ! git -C "$real_worktree" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
17252
17533
|
fmix_error "Path is not inside a git worktree: $real_worktree"
|
|
17253
17534
|
return 1
|
|
@@ -18918,6 +19199,23 @@ cmd_doctor() {
|
|
|
18918
19199
|
worktree="$(fmix_find_worktree "$PWD/cisco-cdr" 2>/dev/null)" || true
|
|
18919
19200
|
[[ -n "$worktree" ]] && echo " (auto-resolved worktree: $worktree — pass --worktree to be explicit)"
|
|
18920
19201
|
fi
|
|
19202
|
+
# REL-3297: the lookups above refuse a checkout with broken git metadata and
|
|
19203
|
+
# their stderr is discarded, which used to end in "all checks passed".
|
|
19204
|
+
# Re-resolve without the metadata check (readonly: no submodule bootstrap)
|
|
19205
|
+
# and report it as a failure.
|
|
19206
|
+
local git_metadata_candidate="" git_metadata_report=""
|
|
19207
|
+
if [[ -z "$worktree" ]]; then
|
|
19208
|
+
git_metadata_candidate="$(fmix_find_worktree_resolve "$worktree_arg" readonly 2>/dev/null)" \
|
|
19209
|
+
|| git_metadata_candidate=""
|
|
19210
|
+
if [[ -z "$git_metadata_candidate" && "$worktree_arg" == "auto" && -f "$PWD/cisco-cdr/mix.exs" ]]; then
|
|
19211
|
+
git_metadata_candidate="$(fmix_find_worktree_resolve "$PWD/cisco-cdr" readonly 2>/dev/null)" \
|
|
19212
|
+
|| git_metadata_candidate=""
|
|
19213
|
+
fi
|
|
19214
|
+
if [[ -n "$git_metadata_candidate" ]]; then
|
|
19215
|
+
git_metadata_report="$(fmix_git_worktree_metadata_report "$git_metadata_candidate")" \
|
|
19216
|
+
&& git_metadata_report=""
|
|
19217
|
+
fi
|
|
19218
|
+
fi
|
|
18921
19219
|
|
|
18922
19220
|
# OS detection
|
|
18923
19221
|
echo " OS: $FMIX_OS $FMIX_ARCH"
|
|
@@ -19139,6 +19437,13 @@ cmd_doctor() {
|
|
|
19139
19437
|
else
|
|
19140
19438
|
echo " [INFO] no state file yet — will be created on first run"
|
|
19141
19439
|
fi
|
|
19440
|
+
elif [[ -n "$git_metadata_report" ]]; then
|
|
19441
|
+
echo " [FAIL] git worktree metadata: $git_metadata_candidate"
|
|
19442
|
+
local git_metadata_line
|
|
19443
|
+
while IFS= read -r git_metadata_line; do
|
|
19444
|
+
[[ -n "$git_metadata_line" ]] && echo " $git_metadata_line"
|
|
19445
|
+
done <<<"$git_metadata_report"
|
|
19446
|
+
fail=$(( fail + 1 ))
|
|
19142
19447
|
fi
|
|
19143
19448
|
|
|
19144
19449
|
# fmix state dir
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calltelemetry/fmix",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.25",
|
|
4
4
|
"description": "Verified native FMix runner for CallTelemetry workspaces",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"directory": "packages/npm"
|
|
27
27
|
},
|
|
28
28
|
"fmix": {
|
|
29
|
-
"runnerSha256": "
|
|
30
|
-
"sourceTag": "fmix-v2.7.
|
|
29
|
+
"runnerSha256": "0a78d4b1ae469d91558f9d881df1d56802bc4fb9840f2d8603657ff004b336ae",
|
|
30
|
+
"sourceTag": "fmix-v2.7.25"
|
|
31
31
|
}
|
|
32
32
|
}
|