@calltelemetry/fmix 2.4.1 → 2.4.3
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 +195 -77
- package/package.json +5 -5
package/bin/fmix
CHANGED
|
@@ -23,7 +23,7 @@ set -uo pipefail
|
|
|
23
23
|
# ---------------------------------------------------------------------------
|
|
24
24
|
# Constants & config
|
|
25
25
|
# ---------------------------------------------------------------------------
|
|
26
|
-
FMIX_VERSION="2.4.
|
|
26
|
+
FMIX_VERSION="2.4.3"
|
|
27
27
|
FMIX_HOME="${FMIX_HOME:-${HOME}/.ct-fmix}"
|
|
28
28
|
FMIX_OS="$(uname -s)"
|
|
29
29
|
FMIX_ARCH="$(uname -m)"
|
|
@@ -34,14 +34,15 @@ FMIX_LOCK_TIMEOUT="${FMIX_LOCK_TIMEOUT:-900}" # 15 min template build wait
|
|
|
34
34
|
FMIX_LOCK_INIT_GRACE="${FMIX_LOCK_INIT_GRACE:-5}"
|
|
35
35
|
FMIX_LOCK_METADATA_TTL_DAYS="${FMIX_LOCK_METADATA_TTL_DAYS:-7}"
|
|
36
36
|
FMIX_WORKTREE_LOCK_TIMEOUT="${FMIX_WORKTREE_LOCK_TIMEOUT:-360}"
|
|
37
|
-
# Session overlays are large (roughly 0.5 GiB each), so
|
|
37
|
+
# Session overlays are large (roughly 0.5 GiB each), so four hours is the
|
|
38
38
|
# retention default for both automatic housekeeping and explicit GC. Preserve
|
|
39
|
-
#
|
|
40
|
-
# leave the modern
|
|
41
|
-
# legacy overrides continue to work
|
|
42
|
-
# fmix_activate_session ...`).
|
|
39
|
+
# the day-based variables as compatibility fallbacks for existing operator
|
|
40
|
+
# config, but leave the modern overrides unset when they were not supplied so
|
|
41
|
+
# command-scoped legacy overrides continue to work.
|
|
43
42
|
FMIX_SESSION_TTL_DEFAULT="1"
|
|
44
43
|
FMIX_SESSION_TTL_DAYS="${FMIX_SESSION_TTL_DAYS-}"
|
|
44
|
+
FMIX_SESSION_TTL_HOURS="${FMIX_SESSION_TTL_HOURS-}"
|
|
45
|
+
FMIX_SESSION_TTL_DEFAULT_HOURS="4"
|
|
45
46
|
FMIX_SESSION_WARN_THRESHOLD="${FMIX_SESSION_WARN_THRESHOLD:-24}"
|
|
46
47
|
FMIX_COPY_MODE="${FMIX_COPY_MODE:-}" # override: "full" to skip CoW
|
|
47
48
|
FMIX_HOST_TEST_LOCK="${FMIX_HOST_TEST_LOCK:-1}" # default: serialize only CREATE/DROP DATABASE on this host
|
|
@@ -787,15 +788,44 @@ fmix_effective_session_ttl_days() {
|
|
|
787
788
|
"$FMIX_SESSION_TTL_DEFAULT" FMIX_SESSION_TTL_DAYS
|
|
788
789
|
}
|
|
789
790
|
|
|
791
|
+
fmix_effective_session_ttl_hours() {
|
|
792
|
+
local explicit_hours="${FMIX_SESSION_TTL_HOURS-}"
|
|
793
|
+
local legacy_days="${FMIX_SESSION_TTL_DAYS:-${FMIX_CACHE_TTL_DAYS:-}}"
|
|
794
|
+
local hours
|
|
795
|
+
if [[ -n "$explicit_hours" ]]; then
|
|
796
|
+
fmix_nonnegative_number_or_default \
|
|
797
|
+
"$explicit_hours" "$FMIX_SESSION_TTL_DEFAULT_HOURS" FMIX_SESSION_TTL_HOURS
|
|
798
|
+
return 0
|
|
799
|
+
fi
|
|
800
|
+
if [[ -n "$legacy_days" ]]; then
|
|
801
|
+
hours="$(fmix_nonnegative_number_or_default \
|
|
802
|
+
"$legacy_days" "$FMIX_SESSION_TTL_DEFAULT" FMIX_SESSION_TTL_DAYS)"
|
|
803
|
+
fmix_session_ttl_hours_from_days "$hours"
|
|
804
|
+
return 0
|
|
805
|
+
fi
|
|
806
|
+
printf '%s\n' "$FMIX_SESSION_TTL_DEFAULT_HOURS"
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
fmix_session_ttl_hours_from_days() {
|
|
810
|
+
local days="$1" py_bin
|
|
811
|
+
if [[ "$days" =~ ^[0-9]+$ ]]; then
|
|
812
|
+
printf '%s\n' "$(( days * 24 ))"
|
|
813
|
+
return 0
|
|
814
|
+
fi
|
|
815
|
+
py_bin="$(fmix_python_bin)"
|
|
816
|
+
"$py_bin" -c 'import sys; print(float(sys.argv[1]) * 24)' \
|
|
817
|
+
"$days" 2>/dev/null || printf '4\n'
|
|
818
|
+
}
|
|
819
|
+
|
|
790
820
|
fmix_session_ttl_seconds() {
|
|
791
|
-
local
|
|
792
|
-
if [[ "$
|
|
793
|
-
printf '%s\n' "$((
|
|
821
|
+
local ttl_hours="${1:-$(fmix_effective_session_ttl_hours)}" py_bin
|
|
822
|
+
if [[ "$ttl_hours" =~ ^[0-9]+$ ]]; then
|
|
823
|
+
printf '%s\n' "$(( ttl_hours * 3600 ))"
|
|
794
824
|
return 0
|
|
795
825
|
fi
|
|
796
826
|
py_bin="$(fmix_python_bin)"
|
|
797
|
-
"$py_bin" -c 'import sys; print(int(float(sys.argv[1]) *
|
|
798
|
-
"$
|
|
827
|
+
"$py_bin" -c 'import sys; print(int(float(sys.argv[1]) * 3600))' \
|
|
828
|
+
"$ttl_hours" 2>/dev/null || printf '14400\n'
|
|
799
829
|
}
|
|
800
830
|
|
|
801
831
|
fmix_control_psql() {
|
|
@@ -900,7 +930,7 @@ fmix_resolve_session_identity() {
|
|
|
900
930
|
# Opt-in only: default ignores CODEX_THREAD_ID (2.2.0 super-hot).
|
|
901
931
|
candidate="codex:${CODEX_THREAD_ID}"
|
|
902
932
|
source="codex-thread"
|
|
903
|
-
elif
|
|
933
|
+
elif [[ "${GITHUB_ACTIONS:-}" == "true" ]] && [[ -n "${GITHUB_RUN_ID:-}" ]]; then
|
|
904
934
|
candidate="github:${GITHUB_RUN_ID}:${GITHUB_JOB:-job}:${GITHUB_RUN_ATTEMPT:-1}"
|
|
905
935
|
source="github-actions"
|
|
906
936
|
else
|
|
@@ -935,10 +965,11 @@ fmix_session_meta_file() {
|
|
|
935
965
|
}
|
|
936
966
|
|
|
937
967
|
fmix_create_or_touch_meta_json() {
|
|
938
|
-
local worktree="$1" meta created lockfile_hash app_name ttl_days tmp
|
|
968
|
+
local worktree="$1" meta created lockfile_hash app_name ttl_days ttl_hours tmp
|
|
939
969
|
meta="$(fmix_session_meta_file)" || return 1
|
|
940
970
|
|
|
941
971
|
ttl_days="$(fmix_effective_session_ttl_days)"
|
|
972
|
+
ttl_hours="$(fmix_effective_session_ttl_hours)"
|
|
942
973
|
|
|
943
974
|
created=""
|
|
944
975
|
if [[ -f "$meta" ]]; then
|
|
@@ -984,6 +1015,7 @@ fmix_create_or_touch_meta_json() {
|
|
|
984
1015
|
"last_accessed": "$(fmix_now)",
|
|
985
1016
|
"last_used": "$(fmix_now)",
|
|
986
1017
|
"ttl_days": $ttl_days,
|
|
1018
|
+
"ttl_hours": $ttl_hours,
|
|
987
1019
|
"lockfile_hash": $(fmix_json_escape "$lockfile_hash"),
|
|
988
1020
|
"status": "active"
|
|
989
1021
|
}
|
|
@@ -1206,9 +1238,9 @@ fmix_drop_orphan_session_db() {
|
|
|
1206
1238
|
|
|
1207
1239
|
fmix_purge_expired_sessions() {
|
|
1208
1240
|
local quiet="${1:-0}"
|
|
1209
|
-
local
|
|
1210
|
-
|
|
1211
|
-
ttl_seconds="$(fmix_session_ttl_seconds "$
|
|
1241
|
+
local ttl_hours ttl_seconds
|
|
1242
|
+
ttl_hours="$(fmix_effective_session_ttl_hours)"
|
|
1243
|
+
ttl_seconds="$(fmix_session_ttl_seconds "$ttl_hours")"
|
|
1212
1244
|
local now session_meta session_root session_hash session_last session_epoch session_age session_lock session_db
|
|
1213
1245
|
local dir_mtime dir_age session_meta_paths empty_dir_paths
|
|
1214
1246
|
now="$(fmix_epoch)"
|
|
@@ -1310,7 +1342,7 @@ fmix_purge_expired_sessions() {
|
|
|
1310
1342
|
fi
|
|
1311
1343
|
|
|
1312
1344
|
if (( quiet == 0 && purged_count > 0 )); then
|
|
1313
|
-
fmix_info "Purged $purged_count expired session build artifact(s) (TTL: ${
|
|
1345
|
+
fmix_info "Purged $purged_count expired session build artifact(s) (TTL: ${ttl_hours}h)."
|
|
1314
1346
|
fi
|
|
1315
1347
|
return 0
|
|
1316
1348
|
}
|
|
@@ -7322,7 +7354,8 @@ EOF
|
|
|
7322
7354
|
# Warm-path short-circuit: accept an existing stamp when the cheap invalidator
|
|
7323
7355
|
# matches and beams still exist. Skips full content fingerprint + deps walk.
|
|
7324
7356
|
fmix_try_compile_stamp_quick_hit() {
|
|
7325
|
-
local worktree="$1" real build_root stamp
|
|
7357
|
+
local worktree="$1" real build_root stamp dependency_stamp dependency_fingerprint dependency_guard
|
|
7358
|
+
local recorded_path recorded_build recorded_quick current_quick
|
|
7326
7359
|
local app_ebin
|
|
7327
7360
|
real="$(fmix_realpath "$worktree")" || return 1
|
|
7328
7361
|
build_root="$(fmix_compile_build_root "$real")" || return 1
|
|
@@ -7339,8 +7372,15 @@ fmix_try_compile_stamp_quick_hit() {
|
|
|
7339
7372
|
[[ -n "$(find "$app_ebin" -maxdepth 1 -type f -name '*.beam' -print -quit 2>/dev/null)" ]] || return 1
|
|
7340
7373
|
current_quick="$(fmix_compile_quick_guard "$real")" || return 1
|
|
7341
7374
|
[[ "$recorded_quick" == "$current_quick" ]] || return 1
|
|
7342
|
-
#
|
|
7343
|
-
|
|
7375
|
+
# A quick hit must not accept a stale or partial dependency checkpoint.
|
|
7376
|
+
# Validate the cheap structural fields here; the full dependency/source
|
|
7377
|
+
# guard remains the responsibility of fmix_ensure_compile on a miss.
|
|
7378
|
+
dependency_stamp="$(fmix_dependency_stamp_file "$real")"
|
|
7379
|
+
[[ -f "$dependency_stamp" ]] || return 1
|
|
7380
|
+
dependency_fingerprint="$(fmix_read_state "$dependency_stamp" dependency_fingerprint)"
|
|
7381
|
+
dependency_guard="$(fmix_read_state "$dependency_stamp" source_guard)"
|
|
7382
|
+
[[ "$dependency_fingerprint" =~ ^[0-9a-f]{64}$ ]] || return 1
|
|
7383
|
+
[[ -n "$dependency_guard" ]] || return 1
|
|
7344
7384
|
return 0
|
|
7345
7385
|
}
|
|
7346
7386
|
|
|
@@ -8423,7 +8463,7 @@ cmd_test() {
|
|
|
8423
8463
|
local worktree_arg="auto"
|
|
8424
8464
|
local cache_base="${FMIX_STABLE_BASE:-}"
|
|
8425
8465
|
local session_arg=""
|
|
8426
|
-
local mix_args=()
|
|
8466
|
+
local mix_args=() mix_args_present=0
|
|
8427
8467
|
local found_sep=0
|
|
8428
8468
|
local coverage_base=""
|
|
8429
8469
|
local coverage_threshold="80"
|
|
@@ -8521,7 +8561,10 @@ cmd_test() {
|
|
|
8521
8561
|
esac
|
|
8522
8562
|
done
|
|
8523
8563
|
if (( found_sep == 1 )); then
|
|
8524
|
-
|
|
8564
|
+
if (( $# > 0 )); then
|
|
8565
|
+
mix_args=("$@")
|
|
8566
|
+
mix_args_present=1
|
|
8567
|
+
fi
|
|
8525
8568
|
fi
|
|
8526
8569
|
|
|
8527
8570
|
if [[ "$run_mode" == "coverage" ]]; then
|
|
@@ -8533,17 +8576,19 @@ cmd_test() {
|
|
|
8533
8576
|
fmix_error "--threshold must be a non-negative number."
|
|
8534
8577
|
return 2
|
|
8535
8578
|
fi
|
|
8536
|
-
if ((
|
|
8579
|
+
if (( mix_args_present == 0 )); then
|
|
8537
8580
|
fmix_error "'fmix coverage' requires one or more explicit test paths after --."
|
|
8538
8581
|
return 2
|
|
8539
8582
|
fi
|
|
8540
8583
|
local coverage_target
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8584
|
+
if (( mix_args_present == 1 )); then
|
|
8585
|
+
for coverage_target in "${mix_args[@]}"; do
|
|
8586
|
+
if [[ "$coverage_target" == -* ]]; then
|
|
8587
|
+
fmix_error "'fmix coverage' accepts test paths only after --; unsupported argument: $coverage_target"
|
|
8588
|
+
return 2
|
|
8589
|
+
fi
|
|
8590
|
+
done
|
|
8591
|
+
fi
|
|
8547
8592
|
local coverage_source
|
|
8548
8593
|
for coverage_source in "${coverage_sources[@]}"; do
|
|
8549
8594
|
if [[ "$coverage_source" != lib/*.ex ]]; then
|
|
@@ -8553,15 +8598,17 @@ cmd_test() {
|
|
|
8553
8598
|
done
|
|
8554
8599
|
else
|
|
8555
8600
|
local mix_arg
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8601
|
+
if (( mix_args_present == 1 )); then
|
|
8602
|
+
for mix_arg in "${mix_args[@]}"; do
|
|
8603
|
+
case "$mix_arg" in
|
|
8604
|
+
--cover|--cover=*)
|
|
8605
|
+
fmix_error "Raw mix --cover is disabled: it instruments the entire application and defeats FMix isolation."
|
|
8606
|
+
fmix_error "Use: fmix coverage --worktree <path> --base <git-ref> -- <test paths>"
|
|
8607
|
+
return 2
|
|
8608
|
+
;;
|
|
8609
|
+
esac
|
|
8610
|
+
done
|
|
8611
|
+
fi
|
|
8565
8612
|
fi
|
|
8566
8613
|
|
|
8567
8614
|
fmix_run_telemetry_begin "$run_mode"
|
|
@@ -8720,7 +8767,11 @@ cmd_test() {
|
|
|
8720
8767
|
# the per-worktree lock. Do not make Mix run the compiler pipeline again as
|
|
8721
8768
|
# the test task starts. User arguments remain last so test selection and
|
|
8722
8769
|
# formatter options retain their normal behavior.
|
|
8723
|
-
local -a run_args
|
|
8770
|
+
local -a run_args
|
|
8771
|
+
run_args=("--no-compile")
|
|
8772
|
+
if (( mix_args_present == 1 )); then
|
|
8773
|
+
run_args+=("${mix_args[@]}")
|
|
8774
|
+
fi
|
|
8724
8775
|
if [[ "$run_mode" == "coverage" ]]; then
|
|
8725
8776
|
fmix_info "Running targeted diff coverage against $coverage_base (${#mix_args[@]} explicit test target(s), threshold ${coverage_threshold}%)."
|
|
8726
8777
|
if (( ${#coverage_sources[@]} > 0 )); then
|
|
@@ -8731,7 +8782,10 @@ cmd_test() {
|
|
|
8731
8782
|
fmix_info "Compilation is disabled; only scoped changed-module BEAMs will be cover-instrumented."
|
|
8732
8783
|
elif (( unit_mode == 1 )); then
|
|
8733
8784
|
mix_task="test.unit"
|
|
8734
|
-
run_args=("--no-start" "--no-compile"
|
|
8785
|
+
run_args=("--no-start" "--no-compile")
|
|
8786
|
+
if (( mix_args_present == 1 )); then
|
|
8787
|
+
run_args+=("${mix_args[@]}")
|
|
8788
|
+
fi
|
|
8735
8789
|
fmix_info "Running (pure-unit lane / CI parity): CT_TEST_PROFILE=unit mix ${mix_task} ${run_args[*]+"${run_args[*]}"}"
|
|
8736
8790
|
else
|
|
8737
8791
|
fmix_info "Running: mix ${mix_task} ${run_args[*]+"${run_args[*]}"}"
|
|
@@ -9105,6 +9159,12 @@ cmd_doctor() {
|
|
|
9105
9159
|
psql_loc="$(fmix_find_psql)"
|
|
9106
9160
|
if [[ -n "$psql_loc" ]]; then
|
|
9107
9161
|
echo " [OK] psql: $psql_loc"
|
|
9162
|
+
elif fmix_control_psql 5 -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" \
|
|
9163
|
+
-d postgres -c "SELECT 1" >/dev/null 2>&1; then
|
|
9164
|
+
# A configured control adapter (for example a test stub or a remote
|
|
9165
|
+
# container wrapper) is sufficient even when no host psql binary is
|
|
9166
|
+
# discoverable. The explicit auth probe below remains authoritative.
|
|
9167
|
+
echo " [OK] psql: configured control adapter"
|
|
9108
9168
|
else
|
|
9109
9169
|
echo " [FAIL] psql not found — install postgresql or ensure docker is running for fallback"
|
|
9110
9170
|
fail=1
|
|
@@ -9215,8 +9275,12 @@ cmd_doctor() {
|
|
|
9215
9275
|
fail=$(( fail + 1 ))
|
|
9216
9276
|
fi
|
|
9217
9277
|
else
|
|
9218
|
-
|
|
9219
|
-
|
|
9278
|
+
if ! command -v erl >/dev/null 2>&1; then
|
|
9279
|
+
echo " [WARN] exact repo toolchain ABI unavailable (erl not installed) — run asdf install for strict verification"
|
|
9280
|
+
else
|
|
9281
|
+
echo " [FAIL] active BEAM runtime does not match .tool-versions"
|
|
9282
|
+
fail=$(( fail + 1 ))
|
|
9283
|
+
fi
|
|
9220
9284
|
fi
|
|
9221
9285
|
local tk
|
|
9222
9286
|
if tk="$(fmix_compute_template_key "$real_wt")"; then
|
|
@@ -9256,8 +9320,8 @@ cmd_doctor() {
|
|
|
9256
9320
|
|
|
9257
9321
|
# Session metadata & TTL cache lifecycle inspection & purging
|
|
9258
9322
|
local ttl_val
|
|
9259
|
-
ttl_val="$(
|
|
9260
|
-
echo " Session metadata & TTL cache inspection (
|
|
9323
|
+
ttl_val="$(fmix_effective_session_ttl_hours)"
|
|
9324
|
+
echo " Session metadata & TTL cache inspection (FMIX_SESSION_TTL_HOURS=${ttl_val}h):"
|
|
9261
9325
|
local session_meta_paths="" session_scan_ok=1
|
|
9262
9326
|
if ! fmix_purge_expired_sessions 0; then
|
|
9263
9327
|
echo " [FAIL] session discovery failed; skipped orphan scratch DB cleanup"
|
|
@@ -10154,11 +10218,11 @@ cmd_gc() {
|
|
|
10154
10218
|
|
|
10155
10219
|
# 6. Expired session overlays. Reaping is lease-aware: the exact session
|
|
10156
10220
|
# lock must be acquired before its artifacts or scratch DB are touched.
|
|
10157
|
-
local
|
|
10158
|
-
|
|
10159
|
-
session_ttl_seconds="$(fmix_session_ttl_seconds "$
|
|
10221
|
+
local session_ttl_hours session_ttl_seconds
|
|
10222
|
+
session_ttl_hours="$(fmix_effective_session_ttl_hours)"
|
|
10223
|
+
session_ttl_seconds="$(fmix_session_ttl_seconds "$session_ttl_hours")"
|
|
10160
10224
|
echo ""
|
|
10161
|
-
echo "--- Sessions unused > ${
|
|
10225
|
+
echo "--- Sessions unused > ${session_ttl_hours} hours ---"
|
|
10162
10226
|
local session_meta session_root session_hash session_last session_epoch
|
|
10163
10227
|
local session_age session_lock session_db session_reap_ok
|
|
10164
10228
|
while IFS= read -r session_meta; do
|
|
@@ -10198,7 +10262,7 @@ cmd_gc() {
|
|
|
10198
10262
|
continue
|
|
10199
10263
|
fi
|
|
10200
10264
|
fi
|
|
10201
|
-
echo " STALE: $session_hash (last_used=$session_last, age=$(( session_age /
|
|
10265
|
+
echo " STALE: $session_hash (last_used=$session_last, age=$(( session_age / 3600 ))h)"
|
|
10202
10266
|
actions=$(( actions + 1 ))
|
|
10203
10267
|
if (( do_reap == 1 )); then
|
|
10204
10268
|
local confirm_session="y"
|
|
@@ -10280,6 +10344,16 @@ cmd_gc() {
|
|
|
10280
10344
|
cmd_self_test() {
|
|
10281
10345
|
local pass=0 fail=0 skip=0
|
|
10282
10346
|
|
|
10347
|
+
# Keep a pristine definition for the long self-test. Several fixtures
|
|
10348
|
+
# monkeypatch stamp writers to exercise rollback paths; restore the
|
|
10349
|
+
# production implementation before the independent compile-stamp lane so
|
|
10350
|
+
# one fixture cannot leak a stub into later assertions.
|
|
10351
|
+
local fmix_write_dependency_stamp_self_test_definition
|
|
10352
|
+
fmix_write_dependency_stamp_self_test_definition="$(
|
|
10353
|
+
declare -f fmix_write_dependency_stamp
|
|
10354
|
+
)"
|
|
10355
|
+
eval "${fmix_write_dependency_stamp_self_test_definition/fmix_write_dependency_stamp/fmix_write_dependency_stamp_self_test_orig}"
|
|
10356
|
+
|
|
10283
10357
|
st_pass() { echo " PASS: $*"; pass=$(( pass + 1 )); }
|
|
10284
10358
|
st_fail() { echo " FAIL: $*"; fail=$(( fail + 1 )); }
|
|
10285
10359
|
st_skip() { echo " SKIP: $*"; skip=$(( skip + 1 )); }
|
|
@@ -10289,7 +10363,7 @@ cmd_self_test() {
|
|
|
10289
10363
|
echo ""
|
|
10290
10364
|
|
|
10291
10365
|
echo "--- Session retention configuration ---"
|
|
10292
|
-
local self_script ttl_default ttl_legacy ttl_explicit ttl_fractional_seconds
|
|
10366
|
+
local self_script ttl_default ttl_legacy ttl_explicit ttl_hours_default ttl_hours_explicit ttl_fractional_seconds
|
|
10293
10367
|
self_script="$(fmix_realpath "${BASH_SOURCE[0]}")"
|
|
10294
10368
|
ttl_default="$(env -u FMIX_SESSION_TTL_DAYS -u FMIX_CACHE_TTL_DAYS \
|
|
10295
10369
|
/bin/bash -c 'source "$1"; fmix_effective_session_ttl_days' \
|
|
@@ -10300,12 +10374,19 @@ cmd_self_test() {
|
|
|
10300
10374
|
ttl_explicit="$(env FMIX_SESSION_TTL_DAYS=2 FMIX_CACHE_TTL_DAYS=3 \
|
|
10301
10375
|
/bin/bash -c 'source "$1"; fmix_effective_session_ttl_days' \
|
|
10302
10376
|
_ "$self_script")"
|
|
10377
|
+
ttl_hours_default="$(env -u FMIX_SESSION_TTL_HOURS -u FMIX_SESSION_TTL_DAYS -u FMIX_CACHE_TTL_DAYS \
|
|
10378
|
+
/bin/bash -c 'source "$1"; fmix_effective_session_ttl_hours' \
|
|
10379
|
+
_ "$self_script")"
|
|
10380
|
+
ttl_hours_explicit="$(env FMIX_SESSION_TTL_HOURS=2 FMIX_SESSION_TTL_DAYS=3 \
|
|
10381
|
+
/bin/bash -c 'source "$1"; fmix_effective_session_ttl_hours' \
|
|
10382
|
+
_ "$self_script")"
|
|
10303
10383
|
ttl_fractional_seconds="$(FMIX_SESSION_TTL_DAYS=0.5 fmix_session_ttl_seconds)"
|
|
10304
10384
|
if [[ "$ttl_default" == "1" && "$ttl_legacy" == "3" \
|
|
10305
|
-
&& "$ttl_explicit" == "2" && "$
|
|
10306
|
-
|
|
10385
|
+
&& "$ttl_explicit" == "2" && "$ttl_hours_default" == "4" \
|
|
10386
|
+
&& "$ttl_hours_explicit" == "2" && "$ttl_fractional_seconds" == "43200" ]]; then
|
|
10387
|
+
st_pass "session retention shares legacy compatibility, four-hour default, override precedence, and fractional conversion"
|
|
10307
10388
|
else
|
|
10308
|
-
st_fail "session retention config
|
|
10389
|
+
st_fail "session retention config days_default=$ttl_default days_legacy=$ttl_legacy days_explicit=$ttl_explicit hours_default=$ttl_hours_default hours_explicit=$ttl_hours_explicit fractional_seconds=$ttl_fractional_seconds"
|
|
10309
10390
|
fi
|
|
10310
10391
|
echo ""
|
|
10311
10392
|
|
|
@@ -11922,7 +12003,10 @@ EOF
|
|
|
11922
12003
|
| sed '1s/fmix_cow_clone/fmix_cow_clone_restore_orig/')"
|
|
11923
12004
|
interrupt_signal=TERM
|
|
11924
12005
|
fmix_cow_clone() {
|
|
11925
|
-
|
|
12006
|
+
# The interrupt fixture runs cmd_test in a subshell so a signal cannot
|
|
12007
|
+
# terminate the self-test parent. Bash 3.2 has no BASHPID, but that
|
|
12008
|
+
# branch skips these in-process signal assertions on macOS anyway.
|
|
12009
|
+
kill "-$interrupt_signal" "${BASHPID:-$$}"
|
|
11926
12010
|
return 1
|
|
11927
12011
|
}
|
|
11928
12012
|
if ! fmix_restore_stable_seed "$seed_consumer" 0.8.7-stable \
|
|
@@ -11967,7 +12051,26 @@ EOF
|
|
|
11967
12051
|
interrupt_signature_before="$(st_artifact_signature "$interrupt_session_root")"
|
|
11968
12052
|
interrupt_failed=0
|
|
11969
12053
|
interrupt_diag_file="$(mktemp)"
|
|
11970
|
-
|
|
12054
|
+
local interrupt_cases="" interrupt_case_count=0
|
|
12055
|
+
# Apple ships Bash 3.2, whose noninteractive signal/trap semantics can
|
|
12056
|
+
# terminate this in-process fixture before the restore handler records
|
|
12057
|
+
# its conventional status. Keep the full signal assertions on Linux and
|
|
12058
|
+
# modern Bash; report the legacy macOS shell gap as an explicit skip.
|
|
12059
|
+
if [[ "$FMIX_OS" == "Darwin" && "${BASH_VERSINFO[0]:-0}" -lt 4 ]]; then
|
|
12060
|
+
st_skip "restore interrupt assertions require Bash 4+ on macOS"
|
|
12061
|
+
else
|
|
12062
|
+
interrupt_cases="INT:130 TERM:143"
|
|
12063
|
+
interrupt_case_count=2
|
|
12064
|
+
# Bash on macOS can inherit an ignored SIGHUP disposition even on
|
|
12065
|
+
# newer installations. Keep HUP on Linux and skip only that case.
|
|
12066
|
+
if [[ "$FMIX_OS" != "Darwin" ]]; then
|
|
12067
|
+
interrupt_cases="$interrupt_cases HUP:129"
|
|
12068
|
+
interrupt_case_count=3
|
|
12069
|
+
else
|
|
12070
|
+
st_skip "HUP restore interrupt has non-deterministic semantics in macOS noninteractive Bash"
|
|
12071
|
+
fi
|
|
12072
|
+
fi
|
|
12073
|
+
for interrupt_case in $interrupt_cases; do
|
|
11971
12074
|
interrupt_signal="${interrupt_case%%:*}"
|
|
11972
12075
|
expected_interrupt_rc="${interrupt_case##*:}"
|
|
11973
12076
|
rm -f "$interrupt_v2_marker"
|
|
@@ -11976,8 +12079,8 @@ EOF
|
|
|
11976
12079
|
FMIX_ACTIVE_SESSION_ROOT=""
|
|
11977
12080
|
FMIX_ACTIVE_SESSION_SOURCE=""
|
|
11978
12081
|
interrupt_rc=0
|
|
11979
|
-
cmd_test --worktree "$seed_consumer" --session restore-interrupt-test \
|
|
11980
|
-
--cache-base 0.8.7-stable -- >"$interrupt_diag_file" 2>&1 \
|
|
12082
|
+
( cmd_test --worktree "$seed_consumer" --session restore-interrupt-test \
|
|
12083
|
+
--cache-base 0.8.7-stable -- ) >"$interrupt_diag_file" 2>&1 \
|
|
11981
12084
|
|| interrupt_rc=$?
|
|
11982
12085
|
if (( interrupt_rc != expected_interrupt_rc )) \
|
|
11983
12086
|
|| [[ -e "$interrupt_v2_marker" ]] \
|
|
@@ -11989,7 +12092,9 @@ EOF
|
|
|
11989
12092
|
interrupt_failure_detail="${interrupt_case}:rc=${interrupt_rc}:marker=$([[ -e "$interrupt_v2_marker" ]] && printf yes || printf no):signature=$([[ "$(st_artifact_signature "$interrupt_session_root")" == "$interrupt_signature_before" ]] && printf same || printf changed):dep=$([[ "$(cat "$interrupt_session_root/dependency-stamp.json" 2>/dev/null)" == "old consumer dependency stamp" ]] && printf same || printf changed):compile=$([[ "$(cat "$interrupt_session_root/compile-stamp.json" 2>/dev/null)" == "old consumer compile stamp" ]] && printf same || printf changed):lock=$([[ -e "$FMIX_HOME/locks/session-$interrupt_session_hash" ]] && printf present || printf clear):diag=$(tail -1 "$interrupt_diag_file")"
|
|
11990
12093
|
fi
|
|
11991
12094
|
done
|
|
11992
|
-
if ((
|
|
12095
|
+
if (( interrupt_case_count == 0 )); then
|
|
12096
|
+
:
|
|
12097
|
+
elif (( interrupt_failed == 0 )); then
|
|
11993
12098
|
st_pass "INT TERM and HUP abort cmd_test after rollback without V2 fallback"
|
|
11994
12099
|
else
|
|
11995
12100
|
st_fail "a restore interrupt became a cmd_test cold miss or leaked state ($interrupt_failure_detail)"
|
|
@@ -12050,8 +12155,7 @@ EOF
|
|
|
12050
12155
|
fi
|
|
12051
12156
|
git -C "$seed_repo" worktree remove --force "$late_interrupt_consumer"
|
|
12052
12157
|
|
|
12053
|
-
eval "$
|
|
12054
|
-
| sed '1s/fmix_write_dependency_stamp/fmix_write_dependency_stamp_restore_orig/')"
|
|
12158
|
+
eval "${fmix_write_dependency_stamp_self_test_definition/fmix_write_dependency_stamp/fmix_write_dependency_stamp_restore_orig}"
|
|
12055
12159
|
fmix_write_dependency_stamp() { return 1; }
|
|
12056
12160
|
if ! fmix_restore_stable_seed "$seed_consumer" 0.8.7-stable \
|
|
12057
12161
|
>/dev/null 2>&1 \
|
|
@@ -12062,8 +12166,7 @@ EOF
|
|
|
12062
12166
|
else
|
|
12063
12167
|
st_fail "failed post-selection restore left partial artifacts or stamp changes"
|
|
12064
12168
|
fi
|
|
12065
|
-
eval "$
|
|
12066
|
-
| sed '1s/fmix_write_dependency_stamp_restore_orig/fmix_write_dependency_stamp/')"
|
|
12169
|
+
eval "$fmix_write_dependency_stamp_self_test_definition"
|
|
12067
12170
|
rm -f "$(fmix_dependency_stamp_file "$seed_consumer")" \
|
|
12068
12171
|
"$(fmix_compile_stamp_file "$seed_consumer")"
|
|
12069
12172
|
|
|
@@ -12093,8 +12196,7 @@ EOF
|
|
|
12093
12196
|
printf 'old rollback compile stamp\n' \
|
|
12094
12197
|
>"$rollback_session_root/compile-stamp.json"
|
|
12095
12198
|
|
|
12096
|
-
eval "$
|
|
12097
|
-
| sed '1s/fmix_write_dependency_stamp/fmix_write_dependency_stamp_rollback_failure_orig/')"
|
|
12199
|
+
eval "${fmix_write_dependency_stamp_self_test_definition/fmix_write_dependency_stamp/fmix_write_dependency_stamp_rollback_failure_orig}"
|
|
12098
12200
|
eval "$(declare -f fmix_preflight \
|
|
12099
12201
|
| sed '1s/fmix_preflight/fmix_preflight_rollback_failure_orig/')"
|
|
12100
12202
|
eval "$(declare -f fmix_check_pg_connections \
|
|
@@ -12123,8 +12225,8 @@ EOF
|
|
|
12123
12225
|
local rollback_diag_file
|
|
12124
12226
|
rollback_diag_file="$(mktemp)"
|
|
12125
12227
|
rollback_rc=0
|
|
12126
|
-
if cmd_test --worktree "$rollback_consumer" --session rollback-failure-test \
|
|
12127
|
-
--cache-base 0.8.7-stable -- >"$rollback_diag_file" 2>&1; then
|
|
12228
|
+
if ( cmd_test --worktree "$rollback_consumer" --session rollback-failure-test \
|
|
12229
|
+
--cache-base 0.8.7-stable -- ) >"$rollback_diag_file" 2>&1; then
|
|
12128
12230
|
rollback_rc=0
|
|
12129
12231
|
else
|
|
12130
12232
|
rollback_rc=$?
|
|
@@ -12140,8 +12242,7 @@ EOF
|
|
|
12140
12242
|
fi
|
|
12141
12243
|
|
|
12142
12244
|
unset -f mv
|
|
12143
|
-
eval "$
|
|
12144
|
-
| sed '1s/fmix_write_dependency_stamp_rollback_failure_orig/fmix_write_dependency_stamp/')"
|
|
12245
|
+
eval "$fmix_write_dependency_stamp_self_test_definition"
|
|
12145
12246
|
eval "$(declare -f fmix_preflight_rollback_failure_orig \
|
|
12146
12247
|
| sed '1s/fmix_preflight_rollback_failure_orig/fmix_preflight/')"
|
|
12147
12248
|
eval "$(declare -f fmix_check_pg_connections_rollback_failure_orig \
|
|
@@ -12251,7 +12352,11 @@ EOF
|
|
|
12251
12352
|
git -C "$seed_repo" worktree remove --force "$seed_peer"
|
|
12252
12353
|
rm -rf "$seed_repo" "$seed_outside" "$fake_seed"
|
|
12253
12354
|
FMIX_HOME="$self_test_old_home"
|
|
12254
|
-
|
|
12355
|
+
# Published dependency artifacts are intentionally sealed read-only. Make
|
|
12356
|
+
# the fixture tree writable before cleanup so macOS `rm -rf` under the
|
|
12357
|
+
# CI shell's inherited `errexit` cannot abort the self-test on teardown.
|
|
12358
|
+
chmod -R u+w "$self_test_seed_home" 2>/dev/null || true
|
|
12359
|
+
rm -rf "$self_test_seed_home" 2>/dev/null || true
|
|
12255
12360
|
|
|
12256
12361
|
# 3. DB name guard (ct_fmix_ prefix enforcement)
|
|
12257
12362
|
echo ""
|
|
@@ -12599,13 +12704,14 @@ EOF
|
|
|
12599
12704
|
"$FMIX_HOME/lock-metadata/released/old-lock" \
|
|
12600
12705
|
"$FMIX_HOME/lock-metadata/stale/old-lock"
|
|
12601
12706
|
FMIX_LOCK_METADATA_TTL_DAYS=7
|
|
12602
|
-
|
|
12707
|
+
local gc_cleanup_rc=0
|
|
12708
|
+
cmd_gc --reap --yes >/dev/null 2>&1 || gc_cleanup_rc=$?
|
|
12603
12709
|
if [[ ! -e "$FMIX_HOME/lock-metadata/released/old-lock" \
|
|
12604
12710
|
&& ! -e "$FMIX_HOME/lock-metadata/stale/old-lock" \
|
|
12605
12711
|
&& -d "$FMIX_HOME/lock-metadata/released/new-lock" ]]; then
|
|
12606
12712
|
st_pass "GC bounds released and stale lock-metadata retention"
|
|
12607
12713
|
else
|
|
12608
|
-
st_fail "GC retained expired lock metadata or removed a fresh record"
|
|
12714
|
+
st_fail "GC retained expired lock metadata or removed a fresh record (rc=$gc_cleanup_rc)"
|
|
12609
12715
|
fi
|
|
12610
12716
|
eval "$(declare -f fmix_control_psql_gc_orig \
|
|
12611
12717
|
| sed '1s/fmix_control_psql_gc_orig/fmix_control_psql/')"
|
|
@@ -12897,6 +13003,7 @@ EOF
|
|
|
12897
13003
|
|
|
12898
13004
|
echo ""
|
|
12899
13005
|
echo "--- Compile content/config stamp ---"
|
|
13006
|
+
eval "$fmix_write_dependency_stamp_self_test_definition"
|
|
12900
13007
|
local compile_root compile_copy compile_home compile_external fp_before fp_after fp_changed fp_other gitfile_repo
|
|
12901
13008
|
local dep_before dep_after source_deps_marker source_compile_marker source_compile_out
|
|
12902
13009
|
local dependency_env_out dependency_env_before dependency_env_after space_root no_deps_root old_db_password
|
|
@@ -13514,7 +13621,9 @@ EOF
|
|
|
13514
13621
|
st_fail "deps.get timeout was not enforced: rc=$deps_timeout_rc out='$deps_timeout_out'"
|
|
13515
13622
|
fi
|
|
13516
13623
|
|
|
13517
|
-
|
|
13624
|
+
# Leave one full sampling interval of slack: a printf followed by
|
|
13625
|
+
# `sleep 1` can land on the same epoch-second as the watchdog on macOS.
|
|
13626
|
+
FMIX_DEPS_STALL_TIMEOUT=2
|
|
13518
13627
|
FMIX_DEPS_TIMEOUT=5
|
|
13519
13628
|
_fmix_run_deps_get() {
|
|
13520
13629
|
local i
|
|
@@ -13794,7 +13903,10 @@ EOF
|
|
|
13794
13903
|
fi
|
|
13795
13904
|
FMIX_STRUCTURE_LOAD_TIMEOUT=1
|
|
13796
13905
|
FMIX_STRUCTURE_LOAD_HEARTBEAT=1
|
|
13797
|
-
fmix_psql() {
|
|
13906
|
+
fmix_psql() {
|
|
13907
|
+
printf '%s\n' "${BASHPID:-$$}" >"$structure_pid_file"
|
|
13908
|
+
sleep 10
|
|
13909
|
+
}
|
|
13798
13910
|
fmix_structure_load_activity() {
|
|
13799
13911
|
if [[ -s "$structure_pid_file" ]] && kill -0 "$(cat "$structure_pid_file")" 2>/dev/null; then
|
|
13800
13912
|
printf 'pid=42 wait=IO/DataFileImmediateSync age=90s sql=CREATE TABLE curri_events_20251117\n'
|
|
@@ -14211,8 +14323,13 @@ PY
|
|
|
14211
14323
|
first_snapshot="$(FMIX_HOME="$install_home" fmix_install_snapshot "$install_source" "$install_bin" 2>/dev/null)" || first_snapshot=""
|
|
14212
14324
|
first_hash="$(fmix_hash_files "$install_source" 2>/dev/null | awk 'NR == 1 {print $1}')"
|
|
14213
14325
|
first_mode=""
|
|
14214
|
-
[[ -n "$first_snapshot" && -f "$first_snapshot" ]]
|
|
14215
|
-
|
|
14326
|
+
if [[ -n "$first_snapshot" && -f "$first_snapshot" ]]; then
|
|
14327
|
+
if [[ "$FMIX_OS" == "Darwin" ]]; then
|
|
14328
|
+
first_mode="$(stat -f '%Lp' "$first_snapshot" 2>/dev/null || true)"
|
|
14329
|
+
else
|
|
14330
|
+
first_mode="$(stat -c '%a' "$first_snapshot" 2>/dev/null || true)"
|
|
14331
|
+
fi
|
|
14332
|
+
fi
|
|
14216
14333
|
if [[ -n "$first_snapshot" \
|
|
14217
14334
|
&& "$first_snapshot" == "$install_home/runtime/fmix-$first_hash" \
|
|
14218
14335
|
&& -L "$install_link" \
|
|
@@ -14447,8 +14564,9 @@ Environment overrides:
|
|
|
14447
14564
|
FMIX_HOT_PATH_BUDGET_S hot_path overhead budget seconds excl mix_test (default: 25)
|
|
14448
14565
|
FMIX_SCHEMA_READY_TTL_S Schema-ready stamp TTL; auto-expire ledger skip (default: 300)
|
|
14449
14566
|
OBAN_LICENSE_KEY Oban Pro license key override (or from ~/.config/calltelemetry/fmix.env / Doppler)
|
|
14450
|
-
|
|
14451
|
-
|
|
14567
|
+
FMIX_SESSION_TTL_HOURS Inactive-session auto-purge and GC threshold (default: 4)
|
|
14568
|
+
FMIX_SESSION_TTL_DAYS Legacy compatibility override, converted to hours when FMIX_SESSION_TTL_HOURS is unset
|
|
14569
|
+
FMIX_CACHE_TTL_DAYS Legacy compatibility fallback used when the hour/day overrides are unset
|
|
14452
14570
|
FMIX_CONFIG_HOME Private configuration directory (default: ~/.config/calltelemetry)
|
|
14453
14571
|
FMIX_ENV_FILE Explicit credential file (default: <config-home>/fmix.env)
|
|
14454
14572
|
FMIX_DOPPLER_PROJECT Doppler project for credential fallback (default: ai-workspace)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calltelemetry/fmix",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"description": "Verified native FMix runner for CallTelemetry workspaces",
|
|
5
5
|
"bin": {
|
|
6
6
|
"fmix": "bin/fmix"
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "https://github.com/calltelemetry/
|
|
24
|
-
"directory": "packages/
|
|
23
|
+
"url": "https://github.com/calltelemetry/fmix.git",
|
|
24
|
+
"directory": "packages/npm"
|
|
25
25
|
},
|
|
26
26
|
"fmix": {
|
|
27
|
-
"runnerSha256": "
|
|
28
|
-
"sourceTag": "fmix-v2.4.
|
|
27
|
+
"runnerSha256": "e33e6c5f707742722286eb263d2528213b7686b25affea79171715c25b85e70b",
|
|
28
|
+
"sourceTag": "fmix-v2.4.3"
|
|
29
29
|
}
|
|
30
30
|
}
|