@calltelemetry/fmix 2.5.0 → 2.7.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/bin/fmix +109 -3
- package/package.json +3 -3
package/bin/fmix
CHANGED
|
@@ -23,7 +23,7 @@ set -uo pipefail
|
|
|
23
23
|
# ---------------------------------------------------------------------------
|
|
24
24
|
# Constants & config
|
|
25
25
|
# ---------------------------------------------------------------------------
|
|
26
|
-
FMIX_VERSION="2.
|
|
26
|
+
FMIX_VERSION="2.7.0"
|
|
27
27
|
FMIX_HOME="${FMIX_HOME:-${HOME}/.ct-fmix}"
|
|
28
28
|
FMIX_OS="$(uname -s)"
|
|
29
29
|
FMIX_ARCH="$(uname -m)"
|
|
@@ -1529,6 +1529,38 @@ fmix_run_telemetry_phase() {
|
|
|
1529
1529
|
fmix_run_telemetry_exclude_observability_elapsed "$observability_started"
|
|
1530
1530
|
}
|
|
1531
1531
|
|
|
1532
|
+
# Emit a bounded NDJSON phase-change record to FMIX_EVENT_FD.
|
|
1533
|
+
#
|
|
1534
|
+
# No-op unless FMIX_EVENT_FD names a numeric descriptor, so an ordinary run is
|
|
1535
|
+
# unaffected. The write is guarded against a closed pipe, a missing descriptor,
|
|
1536
|
+
# and SIGPIPE, and never leaks to stderr: a consumer that dies must not take
|
|
1537
|
+
# the test run down with it.
|
|
1538
|
+
fmix_emit_phase_change() {
|
|
1539
|
+
local phase="$1"
|
|
1540
|
+
local status="$2"
|
|
1541
|
+
local duration_ms="${3:-}"
|
|
1542
|
+
local fd="${FMIX_EVENT_FD:-}"
|
|
1543
|
+
[[ -n "$fd" && "$fd" =~ ^[0-9]+$ ]] || return 0
|
|
1544
|
+
|
|
1545
|
+
local now_iso run_id rec
|
|
1546
|
+
now_iso="$(fmix_now 2>/dev/null || date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || echo "")"
|
|
1547
|
+
run_id="${FMIX_RUN_ID:-}"
|
|
1548
|
+
run_id="${run_id//\\/\\\\}"
|
|
1549
|
+
run_id="${run_id//\"/\\\"}"
|
|
1550
|
+
|
|
1551
|
+
if [[ -n "$duration_ms" && "$duration_ms" =~ ^[0-9]+$ ]]; then
|
|
1552
|
+
rec="{\"schemaVersion\":\"1.0.0\",\"runId\":\"$run_id\",\"timestamp\":\"$now_iso\",\"event\":\"phase:change\",\"phase\":\"$phase\",\"status\":\"$status\",\"durationMs\":$duration_ms}"
|
|
1553
|
+
else
|
|
1554
|
+
rec="{\"schemaVersion\":\"1.0.0\",\"runId\":\"$run_id\",\"timestamp\":\"$now_iso\",\"event\":\"phase:change\",\"phase\":\"$phase\",\"status\":\"$status\"}"
|
|
1555
|
+
fi
|
|
1556
|
+
|
|
1557
|
+
# Bounded <= 512 bytes NDJSON record to designated FD
|
|
1558
|
+
# Non-blocking and safe against closed pipe / missing descriptor / stderr leaks / SIGPIPE
|
|
1559
|
+
if (( ${#rec} <= 512 )); then
|
|
1560
|
+
{ ( trap '' PIPE; printf '%s\n' "$rec" >&"$fd" ) 2>/dev/null; } >/dev/null 2>&1 || true
|
|
1561
|
+
fi
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1532
1564
|
fmix_run_telemetry_jsonl_path() {
|
|
1533
1565
|
printf '%s/logs/runs.jsonl\n' "$FMIX_HOME"
|
|
1534
1566
|
}
|
|
@@ -9750,6 +9782,7 @@ cmd_test() {
|
|
|
9750
9782
|
local worktree_arg="auto"
|
|
9751
9783
|
local cache_base="${FMIX_STABLE_BASE:-}"
|
|
9752
9784
|
local session_arg=""
|
|
9785
|
+
local event_fd="${FMIX_EVENT_FD:-}"
|
|
9753
9786
|
local mix_args=() mix_args_present=0
|
|
9754
9787
|
local found_sep=0
|
|
9755
9788
|
local coverage_base=""
|
|
@@ -9773,6 +9806,15 @@ cmd_test() {
|
|
|
9773
9806
|
--cache-base=*) cache_base="${1#--cache-base=}"; shift ;;
|
|
9774
9807
|
--session) [[ $# -ge 2 ]] || { fmix_error "--session requires an identifier."; return 2; }; session_arg="$2"; shift 2 ;;
|
|
9775
9808
|
--session=*) session_arg="${1#--session=}"; shift ;;
|
|
9809
|
+
--event-fd)
|
|
9810
|
+
[[ $# -ge 2 ]] || { fmix_error "--event-fd requires a file descriptor integer (e.g. 3)."; return 2; }
|
|
9811
|
+
event_fd="$2"
|
|
9812
|
+
shift 2
|
|
9813
|
+
;;
|
|
9814
|
+
--event-fd=*)
|
|
9815
|
+
event_fd="${1#--event-fd=}"
|
|
9816
|
+
shift
|
|
9817
|
+
;;
|
|
9776
9818
|
--isolate)
|
|
9777
9819
|
isolate_mode=1
|
|
9778
9820
|
shift
|
|
@@ -9847,6 +9889,13 @@ cmd_test() {
|
|
|
9847
9889
|
;;
|
|
9848
9890
|
esac
|
|
9849
9891
|
done
|
|
9892
|
+
if [[ -n "$event_fd" ]]; then
|
|
9893
|
+
if [[ ! "$event_fd" =~ ^[0-9]+$ ]]; then
|
|
9894
|
+
fmix_error "--event-fd must be a valid integer file descriptor (e.g. 3)."
|
|
9895
|
+
return 2
|
|
9896
|
+
fi
|
|
9897
|
+
export FMIX_EVENT_FD="$event_fd"
|
|
9898
|
+
fi
|
|
9850
9899
|
if (( found_sep == 1 )); then
|
|
9851
9900
|
if (( $# > 0 )); then
|
|
9852
9901
|
mix_args=("$@")
|
|
@@ -9921,11 +9970,14 @@ cmd_test() {
|
|
|
9921
9970
|
fmix_run_telemetry_finish 1
|
|
9922
9971
|
return 1
|
|
9923
9972
|
}
|
|
9973
|
+
fmix_emit_phase_change "session" "started"
|
|
9924
9974
|
fmix_activate_session "$real_worktree" "$session_arg" || {
|
|
9975
|
+
fmix_emit_phase_change "session" "failed"
|
|
9925
9976
|
fmix_run_telemetry_finish 1
|
|
9926
9977
|
return 1
|
|
9927
9978
|
}
|
|
9928
9979
|
fmix_run_telemetry_phase "session"
|
|
9980
|
+
fmix_emit_phase_change "session" "completed"
|
|
9929
9981
|
local template_key
|
|
9930
9982
|
template_key="$(fmix_compute_template_key "$real_worktree")" || {
|
|
9931
9983
|
fmix_run_telemetry_finish 1
|
|
@@ -9949,25 +10001,32 @@ cmd_test() {
|
|
|
9949
10001
|
fmix_info "DB: $db_name"
|
|
9950
10002
|
|
|
9951
10003
|
# Cheap preflight on every run
|
|
10004
|
+
fmix_emit_phase_change "preflight" "started"
|
|
9952
10005
|
fmix_preflight "$real_worktree" || {
|
|
10006
|
+
fmix_emit_phase_change "preflight" "failed"
|
|
9953
10007
|
fmix_run_telemetry_finish 1
|
|
9954
10008
|
return 1
|
|
9955
10009
|
}
|
|
9956
10010
|
fmix_check_pg_connections
|
|
9957
10011
|
fmix_run_telemetry_phase "preflight"
|
|
10012
|
+
fmix_emit_phase_change "preflight" "completed"
|
|
9958
10013
|
|
|
9959
10014
|
# Per-worktree lock (serializes concurrent runs in same worktree)
|
|
9960
10015
|
local lock_name
|
|
9961
10016
|
lock_name="$(fmix_execution_lock_name "$real_worktree")"
|
|
10017
|
+
fmix_emit_phase_change "lock" "started"
|
|
9962
10018
|
fmix_lock_acquire "$lock_name" "$FMIX_WORKTREE_LOCK_TIMEOUT" || {
|
|
10019
|
+
fmix_emit_phase_change "lock" "failed"
|
|
9963
10020
|
fmix_run_telemetry_finish 1
|
|
9964
10021
|
return 1
|
|
9965
10022
|
}
|
|
9966
10023
|
fmix_run_telemetry_phase "lock"
|
|
10024
|
+
fmix_emit_phase_change "lock" "completed"
|
|
9967
10025
|
|
|
9968
10026
|
# An explicitly selected stable base may seed dependency artifacts. A
|
|
9969
10027
|
# selector or restore miss is intentionally cold: the unchanged V2
|
|
9970
10028
|
# artifact path below remains authoritative.
|
|
10029
|
+
fmix_emit_phase_change "artifacts" "started"
|
|
9971
10030
|
local stable_seed_restored=0 stable_seed_restore_rc=1
|
|
9972
10031
|
if [[ -n "$cache_base" ]]; then
|
|
9973
10032
|
if fmix_restore_stable_seed "$real_worktree" "$cache_base"; then
|
|
@@ -9982,6 +10041,7 @@ cmd_test() {
|
|
|
9982
10041
|
fmix_error "Stable seed restore was interrupted; refusing V2 artifact fallback."
|
|
9983
10042
|
fi
|
|
9984
10043
|
fmix_lock_release "$lock_name"
|
|
10044
|
+
fmix_emit_phase_change "artifacts" "failed"
|
|
9985
10045
|
fmix_run_telemetry_finish "$stable_seed_restore_rc"
|
|
9986
10046
|
return "$stable_seed_restore_rc"
|
|
9987
10047
|
fi
|
|
@@ -9991,38 +10051,49 @@ cmd_test() {
|
|
|
9991
10051
|
fmix_ensure_artifacts "$real_worktree" "$template_key" 0 || {
|
|
9992
10052
|
fmix_lock_release "$lock_name"
|
|
9993
10053
|
FMIX_LAST_ARTIFACTS_OUTCOME="${FMIX_LAST_ARTIFACTS_OUTCOME:-error}"
|
|
10054
|
+
fmix_emit_phase_change "artifacts" "failed"
|
|
9994
10055
|
fmix_run_telemetry_finish 1
|
|
9995
10056
|
return 1
|
|
9996
10057
|
}
|
|
9997
10058
|
FMIX_LAST_ARTIFACTS_OUTCOME="${FMIX_LAST_ARTIFACTS_OUTCOME:-ready}"
|
|
9998
10059
|
fi
|
|
9999
10060
|
fmix_run_telemetry_phase "artifacts"
|
|
10061
|
+
fmix_emit_phase_change "artifacts" "completed"
|
|
10000
10062
|
|
|
10001
10063
|
# Compile (incremental)
|
|
10064
|
+
fmix_emit_phase_change "compile" "started"
|
|
10002
10065
|
local compile_rc=0
|
|
10003
10066
|
fmix_ensure_compile "$real_worktree" "$db_name" || compile_rc=$?
|
|
10004
10067
|
if (( compile_rc != 0 )); then
|
|
10005
10068
|
fmix_lock_release "$lock_name"
|
|
10069
|
+
fmix_emit_phase_change "compile" "failed"
|
|
10006
10070
|
fmix_run_telemetry_finish "$compile_rc"
|
|
10007
10071
|
return "$compile_rc"
|
|
10008
10072
|
fi
|
|
10009
10073
|
fmix_run_telemetry_phase "compile"
|
|
10074
|
+
fmix_emit_phase_change "compile" "completed"
|
|
10010
10075
|
|
|
10011
10076
|
# Ensure DB exists
|
|
10077
|
+
fmix_emit_phase_change "db" "started"
|
|
10012
10078
|
fmix_ensure_db "$real_worktree" "$db_name" 0 0 0 || {
|
|
10013
10079
|
fmix_lock_release "$lock_name"
|
|
10080
|
+
fmix_emit_phase_change "db" "failed"
|
|
10014
10081
|
fmix_run_telemetry_finish 1
|
|
10015
10082
|
return 1
|
|
10016
10083
|
}
|
|
10017
10084
|
fmix_run_telemetry_phase "db"
|
|
10085
|
+
fmix_emit_phase_change "db" "completed"
|
|
10018
10086
|
|
|
10019
10087
|
# Migration drift check (compares current stamp against what is in the state file)
|
|
10088
|
+
fmix_emit_phase_change "migrate" "started"
|
|
10020
10089
|
fmix_ensure_migrations "$real_worktree" "$db_name" "$state_file" || {
|
|
10021
10090
|
fmix_lock_release "$lock_name"
|
|
10091
|
+
fmix_emit_phase_change "migrate" "failed"
|
|
10022
10092
|
fmix_run_telemetry_finish 1
|
|
10023
10093
|
return 1
|
|
10024
10094
|
}
|
|
10025
10095
|
fmix_run_telemetry_phase "migrate"
|
|
10096
|
+
fmix_emit_phase_change "migrate" "completed"
|
|
10026
10097
|
|
|
10027
10098
|
local mig_stamp schema_key
|
|
10028
10099
|
schema_key="$FMIX_ACTIVE_DB_SCHEMA_KEY"
|
|
@@ -10103,6 +10174,7 @@ cmd_test() {
|
|
|
10103
10174
|
[[ -n "${MIX_BUILD_PATH:-}" ]] && build_env+=("MIX_BUILD_PATH=$MIX_BUILD_PATH")
|
|
10104
10175
|
[[ -n "${MIX_DEPS_PATH:-}" ]] && build_env+=("MIX_DEPS_PATH=$MIX_DEPS_PATH")
|
|
10105
10176
|
|
|
10177
|
+
fmix_emit_phase_change "mix_test" "started"
|
|
10106
10178
|
local test_rc=0
|
|
10107
10179
|
(
|
|
10108
10180
|
cd "$real_worktree" || exit 1
|
|
@@ -10126,6 +10198,13 @@ cmd_test() {
|
|
|
10126
10198
|
MEESEEKS_HTML5EVER_BUILD=0
|
|
10127
10199
|
CT_SKIP_MIGRATION_TIMING=1
|
|
10128
10200
|
)
|
|
10201
|
+
[[ -n "$event_fd" ]] && common_env+=("FMIX_EVENT_FD=$event_fd")
|
|
10202
|
+
# The child must observe the same run and session identity that
|
|
10203
|
+
# fmix_emit_phase_change stamps into each NDJSON record, or a consumer
|
|
10204
|
+
# cannot correlate the child's output with the phase stream.
|
|
10205
|
+
local pass_session_id="${FMIX_SESSION_ID:-${session_arg:-${FMIX_ACTIVE_SESSION_HASH:-}}}"
|
|
10206
|
+
[[ -n "$pass_session_id" ]] && common_env+=("FMIX_SESSION_ID=$pass_session_id")
|
|
10207
|
+
[[ -n "${FMIX_RUN_ID:-}" ]] && common_env+=("FMIX_RUN_ID=$FMIX_RUN_ID")
|
|
10129
10208
|
if [[ "$run_mode" == "coverage" ]]; then
|
|
10130
10209
|
local coverage_targets="${mix_args[*]}"
|
|
10131
10210
|
local coverage_bootstrap
|
|
@@ -10196,7 +10275,14 @@ end
|
|
|
10196
10275
|
test_rc=$?
|
|
10197
10276
|
|
|
10198
10277
|
t1=$(fmix_epoch)
|
|
10278
|
+
local test_duration_ms=$(( (t1 - t0) * 1000 ))
|
|
10279
|
+
(( test_duration_ms < 0 )) && test_duration_ms=0
|
|
10199
10280
|
fmix_run_telemetry_phase "mix_test"
|
|
10281
|
+
if (( test_rc == 0 )); then
|
|
10282
|
+
fmix_emit_phase_change "mix_test" "completed" "$test_duration_ms"
|
|
10283
|
+
else
|
|
10284
|
+
fmix_emit_phase_change "mix_test" "failed" "$test_duration_ms"
|
|
10285
|
+
fi
|
|
10200
10286
|
|
|
10201
10287
|
# Update last_used after test run
|
|
10202
10288
|
fmix_update_last_used "$state_file"
|
|
@@ -15157,8 +15243,14 @@ EOF
|
|
|
15157
15243
|
|
|
15158
15244
|
# Leave one full sampling interval of slack: a printf followed by
|
|
15159
15245
|
# `sleep 1` can land on the same epoch-second as the watchdog on macOS.
|
|
15246
|
+
#
|
|
15247
|
+
# The stall timeout is what is under test: progress every second must keep
|
|
15248
|
+
# extending it. The hard limit is incidental scaffolding and must stay well
|
|
15249
|
+
# clear of the fixture's ~4s runtime, or a loaded runner trips the hard
|
|
15250
|
+
# limit and the case fails for a reason it is not testing. It was 5s, which
|
|
15251
|
+
# left one second of headroom for four sleeps, and it failed on macOS CI.
|
|
15160
15252
|
FMIX_DEPS_STALL_TIMEOUT=2
|
|
15161
|
-
FMIX_DEPS_TIMEOUT=
|
|
15253
|
+
FMIX_DEPS_TIMEOUT=30
|
|
15162
15254
|
_fmix_run_deps_get() {
|
|
15163
15255
|
local i
|
|
15164
15256
|
for i in 1 2 3 4; do
|
|
@@ -16036,7 +16128,7 @@ fmix_usage() {
|
|
|
16036
16128
|
fmix — fast native Elixir test runner for cisco-cdr
|
|
16037
16129
|
|
|
16038
16130
|
Usage:
|
|
16039
|
-
./fmix test [--worktree <path>] [--session <id>] [--cache-base <N.N.N-stable>] [--unit] -- <mix test args>
|
|
16131
|
+
./fmix test [--worktree <path>] [--session <id>] [--cache-base <N.N.N-stable>] [--event-fd <fd>] [--unit] -- <mix test args>
|
|
16040
16132
|
./fmix coverage [--worktree <path>] [--session <id>] --base <git-ref> [--source <lib/**/*.ex>] [--threshold 80] -- <test paths>
|
|
16041
16133
|
./fmix task [--worktree <path>] [--session <id>] [--database <name>] [--mix-env <env>] [--allow-run] -- <mix task> [args]
|
|
16042
16134
|
./fmix setup [--worktree <path>] [--session <id>] [--rebuild-db|--cold-db|--from-zero]
|
|
@@ -18301,6 +18393,20 @@ main() {
|
|
|
18301
18393
|
return 0
|
|
18302
18394
|
;;
|
|
18303
18395
|
version|--version)
|
|
18396
|
+
# `version --json` reports identity a caller can verify: the version
|
|
18397
|
+
# string alone cannot distinguish two different runners, which is
|
|
18398
|
+
# exactly how a 15k-line workspace copy and the published release
|
|
18399
|
+
# both claimed 2.5.0. Installers compare the digest, not the path,
|
|
18400
|
+
# because any version manager (mise, asdf, nvm, volta) legitimately
|
|
18401
|
+
# interposes a shim that no path comparison can see through.
|
|
18402
|
+
if [[ "${1:-}" == "--json" ]]; then
|
|
18403
|
+
local self_path self_sha
|
|
18404
|
+
self_path="$(fmix_realpath "${BASH_SOURCE[0]}" 2>/dev/null || printf '%s' "${BASH_SOURCE[0]}")"
|
|
18405
|
+
self_sha="$(fmix_hash_stdin < "$self_path" 2>/dev/null || printf '')"
|
|
18406
|
+
printf '{"version":"%s","runnerSha256":"%s","runnerPath":"%s"}\n' \
|
|
18407
|
+
"$FMIX_VERSION" "$self_sha" "$self_path"
|
|
18408
|
+
return 0
|
|
18409
|
+
fi
|
|
18304
18410
|
echo "fmix $FMIX_VERSION"
|
|
18305
18411
|
return 0
|
|
18306
18412
|
;;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calltelemetry/fmix",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Verified native FMix runner for CallTelemetry workspaces",
|
|
5
5
|
"bin": {
|
|
6
6
|
"fmix": "bin/fmix"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"directory": "packages/npm"
|
|
25
25
|
},
|
|
26
26
|
"fmix": {
|
|
27
|
-
"runnerSha256": "
|
|
28
|
-
"sourceTag": "fmix-v2.
|
|
27
|
+
"runnerSha256": "becc32a47794140cdc7ee60e6204aff47f113ce41292c4a3e4f9a078518c6c2b",
|
|
28
|
+
"sourceTag": "fmix-v2.7.0"
|
|
29
29
|
}
|
|
30
30
|
}
|