@calltelemetry/fmix 2.7.24 → 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 +101 -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
|
|
|
@@ -12830,6 +12846,21 @@ fmix_ensure_partitions() {
|
|
|
12830
12846
|
# compile step: ensure app beams are up to date in the worktree
|
|
12831
12847
|
# ---------------------------------------------------------------------------
|
|
12832
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
|
+
|
|
12833
12864
|
fmix_compile_build_root() {
|
|
12834
12865
|
local worktree="$1" configured="${MIX_BUILD_PATH:-_build}"
|
|
12835
12866
|
if [[ -n "$FMIX_ACTIVE_SESSION_ROOT" \
|
|
@@ -12919,10 +12950,10 @@ fmix_hash_compile_paths() {
|
|
|
12919
12950
|
fmix_reject_compile_input_symlink_components "$root" "$path" || return 1
|
|
12920
12951
|
done
|
|
12921
12952
|
if [[ -d "$root/.git" || -f "$root/.git" ]]; then
|
|
12922
|
-
|
|
12953
|
+
fmix_git_in "$root" rev-parse --is-inside-work-tree >/dev/null 2>&1 \
|
|
12923
12954
|
|| return 1
|
|
12924
12955
|
tracked_file="$(mktemp)" || return 1
|
|
12925
|
-
if !
|
|
12956
|
+
if ! fmix_git_in "$root" ls-files -s -z -- "$@" \
|
|
12926
12957
|
>"$tracked_file" 2>/dev/null; then
|
|
12927
12958
|
rm -f "$tracked_file"
|
|
12928
12959
|
return 1
|
|
@@ -12934,14 +12965,14 @@ fmix_hash_compile_paths() {
|
|
|
12934
12965
|
rm -f "$tracked_file"
|
|
12935
12966
|
untracked_file="$(mktemp)" || return 1
|
|
12936
12967
|
if ! (
|
|
12937
|
-
|
|
12968
|
+
fmix_git_in "$root" ls-files --others --exclude-standard -z -- "$@" \
|
|
12938
12969
|
|| exit 1
|
|
12939
12970
|
# Git ignores do not change what Mix can compile or execute. Keep
|
|
12940
12971
|
# ignored source files in the exact run identity, but only beneath
|
|
12941
12972
|
# the caller's bounded source/test pathspecs. Never widen an empty
|
|
12942
12973
|
# pathspec into a scan of ignored cache artifacts.
|
|
12943
12974
|
if (( $# > 0 )); then
|
|
12944
|
-
|
|
12975
|
+
fmix_git_in "$root" ls-files --others --ignored \
|
|
12945
12976
|
--exclude-standard -z -- "$@" || exit 1
|
|
12946
12977
|
fi
|
|
12947
12978
|
) >"$untracked_file" 2>/dev/null; then
|
|
@@ -13005,11 +13036,11 @@ fmix_ignored_compile_inputs_hash() {
|
|
|
13005
13036
|
return 0
|
|
13006
13037
|
fi
|
|
13007
13038
|
command -v git >/dev/null 2>&1 || return 1
|
|
13008
|
-
|
|
13039
|
+
fmix_git_in "$real" rev-parse --is-inside-work-tree >/dev/null 2>&1 \
|
|
13009
13040
|
|| return 1
|
|
13010
13041
|
ignored_file="$(mktemp)" || return 1
|
|
13011
13042
|
manifest="$(mktemp)" || { rm -f "$ignored_file"; return 1; }
|
|
13012
|
-
if !
|
|
13043
|
+
if ! fmix_git_in "$real" ls-files --others --ignored --exclude-standard -z \
|
|
13013
13044
|
-- "${compile_paths[@]}" >"$ignored_file" 2>/dev/null; then
|
|
13014
13045
|
rm -f "$ignored_file" "$manifest"
|
|
13015
13046
|
return 1
|
|
@@ -13101,9 +13132,9 @@ fmix_source_stability_compile_identity() {
|
|
|
13101
13132
|
(( $# >= 1 )) || return 1
|
|
13102
13133
|
real="$(fmix_realpath "$worktree")" || return 1
|
|
13103
13134
|
if [[ -d "$real/.git" || -f "$real/.git" ]]; then
|
|
13104
|
-
|
|
13135
|
+
fmix_git_in "$real" rev-parse --is-inside-work-tree >/dev/null 2>&1 \
|
|
13105
13136
|
|| return 1
|
|
13106
|
-
head="$(
|
|
13137
|
+
head="$(fmix_git_in "$real" rev-parse HEAD 2>/dev/null)" || return 1
|
|
13107
13138
|
[[ "$head" =~ ^[0-9a-f]{40}$ ]] || return 1
|
|
13108
13139
|
else
|
|
13109
13140
|
head="non-git"
|
|
@@ -13325,6 +13356,22 @@ fmix_compute_dependency_fingerprint() {
|
|
|
13325
13356
|
printf '%s\n' "$fingerprint"
|
|
13326
13357
|
}
|
|
13327
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
|
+
|
|
13328
13375
|
fmix_compute_mix_project_reconciliation_guard() {
|
|
13329
13376
|
# Normalize mix.exs while replacing exactly one ordinary deps/0 body. This
|
|
13330
13377
|
# permits dependency declaration/constraint edits but keeps application,
|
|
@@ -13822,16 +13869,16 @@ fmix_hash_git_dependency() {
|
|
|
13822
13869
|
local dependency="$1" commit diff_hash file untracked_file
|
|
13823
13870
|
local -a untracked=()
|
|
13824
13871
|
fmix_reject_nested_source_symlinks "$dependency" || return 1
|
|
13825
|
-
commit="$(
|
|
13872
|
+
commit="$(fmix_git_in "$dependency" rev-parse HEAD 2>/dev/null)" || return 1
|
|
13826
13873
|
[[ -n "$commit" ]] || return 1
|
|
13827
13874
|
printf '.git-commit:%s\n' "$commit"
|
|
13828
13875
|
|
|
13829
|
-
diff_hash="$(
|
|
13876
|
+
diff_hash="$(fmix_git_in "$dependency" diff --no-ext-diff --binary HEAD 2>/dev/null \
|
|
13830
13877
|
| fmix_hash_stdin)" || return 1
|
|
13831
13878
|
printf '.git-worktree-diff:%s\n' "$diff_hash"
|
|
13832
13879
|
|
|
13833
13880
|
untracked_file="$(mktemp)" || return 1
|
|
13834
|
-
if !
|
|
13881
|
+
if ! fmix_git_in "$dependency" ls-files --others --exclude-standard -z \
|
|
13835
13882
|
>"$untracked_file" 2>/dev/null; then
|
|
13836
13883
|
rm -f "$untracked_file"
|
|
13837
13884
|
return 1
|
|
@@ -14722,8 +14769,14 @@ fmix_compile_semaphore_acquire() {
|
|
|
14722
14769
|
local permits deadline_secs
|
|
14723
14770
|
permits="$(fmix_compile_semaphore_permits)"
|
|
14724
14771
|
deadline_secs="${FMIX_CALLER_DEADLINE_SECS:-}"
|
|
14725
|
-
|
|
14726
|
-
|
|
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
|
|
14727
14780
|
mkdir -p "$FMIX_HOME/lock-kernel" "$FMIX_HOME/lock-metadata" || return 1
|
|
14728
14781
|
|
|
14729
14782
|
local t0=$(fmix_epoch)
|
|
@@ -14731,6 +14784,7 @@ fmix_compile_semaphore_acquire() {
|
|
|
14731
14784
|
local estimated_compile_s=60
|
|
14732
14785
|
|
|
14733
14786
|
while true; do
|
|
14787
|
+
bootstrap_transient=0
|
|
14734
14788
|
for (( slot = 0; slot < permits; slot++ )); do
|
|
14735
14789
|
local kfile="$FMIX_HOME/lock-kernel/compile-permit-${slot}"
|
|
14736
14790
|
local keeper_rc=0
|
|
@@ -14741,9 +14795,16 @@ fmix_compile_semaphore_acquire() {
|
|
|
14741
14795
|
break
|
|
14742
14796
|
else
|
|
14743
14797
|
keeper_rc=$?
|
|
14744
|
-
#
|
|
14745
|
-
|
|
14746
|
-
|
|
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"
|
|
14747
14808
|
fi
|
|
14748
14809
|
done
|
|
14749
14810
|
|
|
@@ -14766,6 +14827,25 @@ EOF
|
|
|
14766
14827
|
local elapsed=$(( now - t0 ))
|
|
14767
14828
|
local queue_depth=$permits
|
|
14768
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
|
+
|
|
14769
14849
|
if [[ -n "$deadline_secs" && "$deadline_secs" =~ ^[0-9]+$ ]]; then
|
|
14770
14850
|
local estimated_wait=$(( (queue_depth / permits) * estimated_compile_s ))
|
|
14771
14851
|
if (( elapsed + estimated_wait + estimated_compile_s > deadline_secs )); then
|
|
@@ -15314,6 +15394,7 @@ _fmix_ensure_compile_impl() {
|
|
|
15314
15394
|
return 0
|
|
15315
15395
|
fi
|
|
15316
15396
|
fmix_error "Compile artifacts are valid, but final dependency provenance could not be recorded."
|
|
15397
|
+
fmix_error "$(fmix_dependency_provenance_failure_cause "$worktree")"
|
|
15317
15398
|
FMIX_LAST_COMPILE_OUTCOME="error"
|
|
15318
15399
|
return 1
|
|
15319
15400
|
fi
|
|
@@ -15449,6 +15530,7 @@ _fmix_ensure_compile_impl() {
|
|
|
15449
15530
|
|| ! fmix_write_dependency_stamp "$worktree" "$dependency_fingerprint"; then
|
|
15450
15531
|
fmix_invalidate_rejected_stamps "$worktree"
|
|
15451
15532
|
fmix_error "Compile succeeded, but final dependency provenance could not be recorded."
|
|
15533
|
+
fmix_error "$(fmix_dependency_provenance_failure_cause "$worktree")"
|
|
15452
15534
|
FMIX_LAST_COMPILE_OUTCOME="error"
|
|
15453
15535
|
return 1
|
|
15454
15536
|
fi
|
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
|
}
|