@calltelemetry/fmix 2.7.7 → 2.7.8
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 +461 -8
- package/package.json +3 -3
package/bin/fmix
CHANGED
|
@@ -24,7 +24,7 @@ set -uo pipefail
|
|
|
24
24
|
# ---------------------------------------------------------------------------
|
|
25
25
|
# Constants & config
|
|
26
26
|
# ---------------------------------------------------------------------------
|
|
27
|
-
FMIX_VERSION="2.7.
|
|
27
|
+
FMIX_VERSION="2.7.8"
|
|
28
28
|
FMIX_HOME="${FMIX_HOME:-${HOME}/.ct-fmix}"
|
|
29
29
|
FMIX_OS="$(uname -s)"
|
|
30
30
|
FMIX_ARCH="$(uname -m)"
|
|
@@ -754,7 +754,7 @@ try:
|
|
|
754
754
|
output.write(digest + b"\n")
|
|
755
755
|
else:
|
|
756
756
|
output.write(b"missing\n")
|
|
757
|
-
|
|
757
|
+
output.flush()
|
|
758
758
|
except OSError:
|
|
759
759
|
report_error(b"Could not read tracked compiler input records")
|
|
760
760
|
raise SystemExit(1)
|
|
@@ -1676,13 +1676,21 @@ fmix_run_telemetry_finish() {
|
|
|
1676
1676
|
local hot_path="no" cache_hot="no" hot_budget overhead=0 phase_pair pname pval
|
|
1677
1677
|
hot_budget="$(fmix_uint_or_default "${FMIX_HOT_PATH_BUDGET_S:-25}" 25 FMIX_HOT_PATH_BUDGET_S)"
|
|
1678
1678
|
case "${FMIX_LAST_COMPILE_OUTCOME:-}" in
|
|
1679
|
-
stamp_hit|stamp_hit_repaired|stamp_hit_after_deps|stamp_hit_quick)
|
|
1679
|
+
stamp_hit|stamp_hit_repaired|stamp_hit_after_deps|stamp_hit_quick|noop_compile)
|
|
1680
1680
|
case "${FMIX_LAST_ARTIFACTS_OUTCOME:-}" in
|
|
1681
|
-
session_hit|adopt_stamps|adopt_compatible|ready|stable_seed|donor_clone)
|
|
1681
|
+
session_hit|adopt_stamps|adopt_compatible|dependency_reconcile|ready|stable_seed|donor_clone)
|
|
1682
1682
|
cache_hot="yes"
|
|
1683
1683
|
;;
|
|
1684
1684
|
esac
|
|
1685
1685
|
;;
|
|
1686
|
+
incremental)
|
|
1687
|
+
# A same-toolchain dependency change deliberately keeps the
|
|
1688
|
+
# proven application build and lets Mix compile only the affected
|
|
1689
|
+
# dependency/app delta. That is still a cache hit; a near-full
|
|
1690
|
+
# compile is classified separately as full_recompile.
|
|
1691
|
+
[[ "${FMIX_LAST_ARTIFACTS_OUTCOME:-}" == "dependency_reconcile" ]] \
|
|
1692
|
+
&& cache_hot="yes"
|
|
1693
|
+
;;
|
|
1686
1694
|
esac
|
|
1687
1695
|
if [[ -n "$FMIX_RUN_PHASES" ]]; then
|
|
1688
1696
|
for phase_pair in $FMIX_RUN_PHASES; do
|
|
@@ -6362,6 +6370,12 @@ fmix_ensure_artifacts() {
|
|
|
6362
6370
|
FMIX_LAST_ARTIFACTS_OUTCOME="adopt_compatible"
|
|
6363
6371
|
return 0
|
|
6364
6372
|
fi
|
|
6373
|
+
if fmix_reconcile_same_toolchain_dependency_change \
|
|
6374
|
+
"$worktree" "$recorded_key" "$template_key"; then
|
|
6375
|
+
fmix_info "Dependency change adopted under template key $template_key — preserving the app cache for incremental compile."
|
|
6376
|
+
FMIX_LAST_ARTIFACTS_OUTCOME="dependency_reconcile"
|
|
6377
|
+
return 0
|
|
6378
|
+
fi
|
|
6365
6379
|
fmix_info "Artifact compatibility proof failed; a verified template clone is required."
|
|
6366
6380
|
fi
|
|
6367
6381
|
fi
|
|
@@ -8421,6 +8435,115 @@ fmix_compute_dependency_fingerprint() {
|
|
|
8421
8435
|
printf '%s\n' "$fingerprint"
|
|
8422
8436
|
}
|
|
8423
8437
|
|
|
8438
|
+
fmix_compute_mix_project_reconciliation_guard() {
|
|
8439
|
+
# Normalize mix.exs while replacing exactly one ordinary deps/0 body. This
|
|
8440
|
+
# permits dependency declaration/constraint edits but keeps application,
|
|
8441
|
+
# compiler, path-layout, and every helper definition bound to the retained
|
|
8442
|
+
# app build. Path deps and referenced environment are guarded separately.
|
|
8443
|
+
local worktree="$1" real guard
|
|
8444
|
+
real="$(fmix_realpath "$worktree")" || return 1
|
|
8445
|
+
[[ -f "$real/mix.exs" ]] || return 1
|
|
8446
|
+
if ! command -v elixir >/dev/null 2>&1; then
|
|
8447
|
+
# Stamp helpers are intentionally portable before toolchain activation.
|
|
8448
|
+
# Bind the full project file in that mode: this keeps ordinary stamp
|
|
8449
|
+
# round-trips usable but deliberately prevents dependency-only reuse
|
|
8450
|
+
# until Elixir can produce the narrower AST-backed proof.
|
|
8451
|
+
(
|
|
8452
|
+
printf 'fmix-raw-mix-project-v1\n'
|
|
8453
|
+
cat "$real/mix.exs"
|
|
8454
|
+
) | fmix_hash_stdin
|
|
8455
|
+
return $?
|
|
8456
|
+
fi
|
|
8457
|
+
guard="$(cd "$real" && elixir -e '
|
|
8458
|
+
path = List.first(System.argv())
|
|
8459
|
+
|
|
8460
|
+
with {:ok, source} <- File.read(path) do
|
|
8461
|
+
quoted = Code.string_to_quoted(source)
|
|
8462
|
+
|
|
8463
|
+
if match?({:ok, _}, quoted) do
|
|
8464
|
+
{:ok, quoted} = quoted
|
|
8465
|
+
{normalized, count} =
|
|
8466
|
+
Macro.prewalk(quoted, 0, fn
|
|
8467
|
+
{kind, meta, [{:deps, call_meta, args}, body]} = node, count
|
|
8468
|
+
when kind in [:def, :defp] and args in [nil, []] and is_list(body) ->
|
|
8469
|
+
if Keyword.keyword?(body) and Keyword.has_key?(body, :do) do
|
|
8470
|
+
replacement =
|
|
8471
|
+
{kind, meta,
|
|
8472
|
+
[
|
|
8473
|
+
{:deps, call_meta, args},
|
|
8474
|
+
Keyword.put(body, :do, :__fmix_dependency_declarations__)
|
|
8475
|
+
]}
|
|
8476
|
+
|
|
8477
|
+
{replacement, count + 1}
|
|
8478
|
+
else
|
|
8479
|
+
{node, count}
|
|
8480
|
+
end
|
|
8481
|
+
|
|
8482
|
+
node, count ->
|
|
8483
|
+
{node, count}
|
|
8484
|
+
end)
|
|
8485
|
+
|
|
8486
|
+
if count == 1 do
|
|
8487
|
+
IO.write("fmix-normalized-deps-v1\n" <> Macro.to_string(normalized))
|
|
8488
|
+
else
|
|
8489
|
+
IO.write("fmix-raw-mix-project-v1\n" <> source)
|
|
8490
|
+
end
|
|
8491
|
+
else
|
|
8492
|
+
IO.write("fmix-raw-mix-project-v1\n" <> source)
|
|
8493
|
+
end
|
|
8494
|
+
end
|
|
8495
|
+
' mix.exs)" || return 1
|
|
8496
|
+
[[ -n "$guard" ]] || return 1
|
|
8497
|
+
printf '%s' "$guard" | fmix_hash_stdin
|
|
8498
|
+
}
|
|
8499
|
+
|
|
8500
|
+
fmix_compute_dependency_reconciliation_guard() {
|
|
8501
|
+
# Identity for dependency-resolution inputs that must remain stable while
|
|
8502
|
+
# reusing an app build across an ordinary deps/0 + mix.lock transition.
|
|
8503
|
+
# Those two dependency declarations are intentionally excluded; every
|
|
8504
|
+
# other dependency/compile-shaping input remains bound to the stamp.
|
|
8505
|
+
local worktree="$1" real toolchain_identity manifest guard rc
|
|
8506
|
+
real="$(fmix_realpath "$worktree")" || return 1
|
|
8507
|
+
toolchain_identity="${FMIX_TOOLCHAIN_IDENTITY:-}"
|
|
8508
|
+
if [[ -z "$toolchain_identity" ]]; then
|
|
8509
|
+
toolchain_identity="$(fmix_resolved_toolchain_identity "$real")" \
|
|
8510
|
+
|| return 1
|
|
8511
|
+
fi
|
|
8512
|
+
local -a guarded_paths=(
|
|
8513
|
+
.tool-versions vendor dev_tools
|
|
8514
|
+
)
|
|
8515
|
+
manifest="$(mktemp)" || return 1
|
|
8516
|
+
(
|
|
8517
|
+
printf 'fmix-dependency-reconciliation-guard-v1\n'
|
|
8518
|
+
printf 'os_arch=%s %s\n' "$FMIX_OS" "$FMIX_ARCH"
|
|
8519
|
+
printf '%s\n' "$toolchain_identity"
|
|
8520
|
+
fmix_hash_compile_paths "$real" "${guarded_paths[@]}" || return 1
|
|
8521
|
+
fmix_compute_mix_project_reconciliation_guard "$real" || return 1
|
|
8522
|
+
fmix_declared_path_dependency_resolution_guard "$real" || return 1
|
|
8523
|
+
fmix_dependency_environment "$real" || return 1
|
|
8524
|
+
) >"$manifest"
|
|
8525
|
+
rc=$?
|
|
8526
|
+
if (( rc != 0 )); then
|
|
8527
|
+
rm -f "$manifest"
|
|
8528
|
+
return "$rc"
|
|
8529
|
+
fi
|
|
8530
|
+
guard="$(fmix_hash_stdin <"$manifest")"
|
|
8531
|
+
rc=$?
|
|
8532
|
+
rm -f "$manifest"
|
|
8533
|
+
(( rc == 0 )) || return "$rc"
|
|
8534
|
+
[[ "$guard" =~ ^[0-9a-f]{64}$ ]] || return 1
|
|
8535
|
+
printf '%s\n' "$guard"
|
|
8536
|
+
}
|
|
8537
|
+
|
|
8538
|
+
fmix_compute_dependency_lock_identity() {
|
|
8539
|
+
local worktree="$1" real
|
|
8540
|
+
real="$(fmix_realpath "$worktree")" || return 1
|
|
8541
|
+
(
|
|
8542
|
+
printf 'fmix-dependency-lock-v1\n'
|
|
8543
|
+
fmix_hash_compile_paths "$real" mix.lock || return 1
|
|
8544
|
+
) | fmix_hash_stdin
|
|
8545
|
+
}
|
|
8546
|
+
|
|
8424
8547
|
fmix_compute_legacy_compile_fingerprint_v2() {
|
|
8425
8548
|
local worktree="$1" real build_root
|
|
8426
8549
|
real="$(fmix_realpath "$worktree")"
|
|
@@ -8874,9 +8997,14 @@ fmix_dependency_stamp_file() {
|
|
|
8874
8997
|
|
|
8875
8998
|
fmix_write_dependency_stamp() {
|
|
8876
8999
|
local worktree="$1" dependency_fingerprint="$2" real build_root guard stamp tmp
|
|
9000
|
+
local reconciliation_guard lock_identity
|
|
8877
9001
|
real="$(fmix_realpath "$worktree")"
|
|
8878
9002
|
build_root="$(fmix_compile_build_root "$real")"
|
|
8879
9003
|
guard="$(fmix_dependency_source_guard "$real")" || return 1
|
|
9004
|
+
reconciliation_guard="$(
|
|
9005
|
+
fmix_compute_dependency_reconciliation_guard "$real"
|
|
9006
|
+
)" || return 1
|
|
9007
|
+
lock_identity="$(fmix_compute_dependency_lock_identity "$real")" || return 1
|
|
8880
9008
|
stamp="$(fmix_dependency_stamp_file "$real")"
|
|
8881
9009
|
mkdir -p "$(dirname "$stamp")"
|
|
8882
9010
|
tmp="$(mktemp "${stamp}.tmp.XXXXXX")" || return 1
|
|
@@ -8885,6 +9013,8 @@ fmix_write_dependency_stamp() {
|
|
|
8885
9013
|
"path": $(fmix_json_escape "$real"),
|
|
8886
9014
|
"build_root": $(fmix_json_escape "$build_root"),
|
|
8887
9015
|
"dependency_fingerprint": $(fmix_json_escape "$dependency_fingerprint"),
|
|
9016
|
+
"reconciliation_guard": $(fmix_json_escape "$reconciliation_guard"),
|
|
9017
|
+
"lock_identity": $(fmix_json_escape "$lock_identity"),
|
|
8888
9018
|
"source_guard": $(fmix_json_escape "$guard"),
|
|
8889
9019
|
"resolved_at": $(fmix_json_escape "$(fmix_now)")
|
|
8890
9020
|
}
|
|
@@ -9021,6 +9151,15 @@ fmix_compute_dirty_hash() {
|
|
|
9021
9151
|
local worktree="$1" real status manifest hash rc file
|
|
9022
9152
|
local untracked_file diff_file staged_file
|
|
9023
9153
|
local -a untracked=()
|
|
9154
|
+
shift
|
|
9155
|
+
local -a target_paths=("$@")
|
|
9156
|
+
if (( ${#target_paths[@]} == 0 )); then
|
|
9157
|
+
target_paths=(
|
|
9158
|
+
.tool-versions mix.exs mix.lock
|
|
9159
|
+
config lib test/support test/cdrcisco/policies/reputation_signals/shared
|
|
9160
|
+
vendor dev_tools priv/repo
|
|
9161
|
+
)
|
|
9162
|
+
fi
|
|
9024
9163
|
real="$(fmix_realpath "$worktree" 2>/dev/null)" || return 1
|
|
9025
9164
|
if [[ ! -d "$real/.git" && ! -f "$real/.git" ]]; then
|
|
9026
9165
|
printf 'clean\n'
|
|
@@ -9029,7 +9168,7 @@ fmix_compute_dirty_hash() {
|
|
|
9029
9168
|
command -v git >/dev/null 2>&1 || return 1
|
|
9030
9169
|
git -C "$real" rev-parse --is-inside-work-tree >/dev/null 2>&1 \
|
|
9031
9170
|
|| return 1
|
|
9032
|
-
status="$(git -C "$real" status --porcelain=v1 2>/dev/null)" || return 1
|
|
9171
|
+
status="$(git -C "$real" status --porcelain=v1 -- "${target_paths[@]}" 2>/dev/null)" || return 1
|
|
9033
9172
|
if [[ -z "$status" ]]; then
|
|
9034
9173
|
printf 'clean\n'
|
|
9035
9174
|
return 0
|
|
@@ -9040,17 +9179,17 @@ fmix_compute_dirty_hash() {
|
|
|
9040
9179
|
|| { rm -f "$manifest" "$untracked_file"; return 1; }
|
|
9041
9180
|
staged_file="$(mktemp)" \
|
|
9042
9181
|
|| { rm -f "$manifest" "$untracked_file" "$diff_file"; return 1; }
|
|
9043
|
-
if ! git -C "$real" ls-files --others --exclude-standard -z \
|
|
9182
|
+
if ! git -C "$real" ls-files --others --exclude-standard -z -- "${target_paths[@]}" \
|
|
9044
9183
|
>"$untracked_file" 2>/dev/null; then
|
|
9045
9184
|
rm -f "$manifest" "$untracked_file" "$diff_file" "$staged_file"
|
|
9046
9185
|
return 1
|
|
9047
9186
|
fi
|
|
9048
|
-
if ! git -C "$real" diff --no-ext-diff --binary --
|
|
9187
|
+
if ! git -C "$real" diff --no-ext-diff --binary -- "${target_paths[@]}" \
|
|
9049
9188
|
>"$diff_file" 2>/dev/null; then
|
|
9050
9189
|
rm -f "$manifest" "$untracked_file" "$diff_file" "$staged_file"
|
|
9051
9190
|
return 1
|
|
9052
9191
|
fi
|
|
9053
|
-
if ! git -C "$real" diff --cached --no-ext-diff --binary --
|
|
9192
|
+
if ! git -C "$real" diff --cached --no-ext-diff --binary -- "${target_paths[@]}" \
|
|
9054
9193
|
>"$staged_file" 2>/dev/null; then
|
|
9055
9194
|
rm -f "$manifest" "$untracked_file" "$diff_file" "$staged_file"
|
|
9056
9195
|
return 1
|
|
@@ -9373,6 +9512,129 @@ fmix_update_worktree_template_key() {
|
|
|
9373
9512
|
mv "$tmp" "$key_state_file" || { rm -f "$tmp"; return 1; }
|
|
9374
9513
|
}
|
|
9375
9514
|
|
|
9515
|
+
fmix_reconcile_same_toolchain_dependency_change() {
|
|
9516
|
+
# A dependency-only template-key change must not throw away a proven app
|
|
9517
|
+
# build. Prove that the existing session was compiled at the same ABI and
|
|
9518
|
+
# that its dependency/build guards are intact, advance only its storage
|
|
9519
|
+
# key, then let the split dependency lane install an exact/ancestor
|
|
9520
|
+
# artifact when available. With no shared artifact, the current session is
|
|
9521
|
+
# itself the reconciliation seed: clear its exact-hit claims so deps.get +
|
|
9522
|
+
# Mix perform an ordinary incremental repair in place.
|
|
9523
|
+
local worktree="$1" recorded_key="$2" template_key="$3"
|
|
9524
|
+
local real deps_root build_root state_file artifact_state_file key_state_file
|
|
9525
|
+
local dependency_stamp compile_stamp recorded_dependency current_dependency
|
|
9526
|
+
local recorded_dependency_guard current_dependency_guard
|
|
9527
|
+
local recorded_reconciliation_guard current_reconciliation_guard
|
|
9528
|
+
local recorded_lock_identity current_lock_identity
|
|
9529
|
+
local recorded_manifest_guard current_manifest_guard
|
|
9530
|
+
local recorded_env_hash current_env_hash recorded_stamp_key recorded_schema
|
|
9531
|
+
local app_ebin preparation_rc=0
|
|
9532
|
+
real="$(fmix_realpath "$worktree")" || return 1
|
|
9533
|
+
deps_root="$(fmix_session_deps_root "$real")" || return 1
|
|
9534
|
+
build_root="$(fmix_compile_build_root "$real")" || return 1
|
|
9535
|
+
state_file="$(fmix_worktree_state_file "$real")"
|
|
9536
|
+
artifact_state_file="$(fmix_artifact_state_file "$real")"
|
|
9537
|
+
if [[ -f "$artifact_state_file" ]]; then
|
|
9538
|
+
key_state_file="$artifact_state_file"
|
|
9539
|
+
else
|
|
9540
|
+
key_state_file="$state_file"
|
|
9541
|
+
fi
|
|
9542
|
+
dependency_stamp="$(fmix_dependency_stamp_file "$real")"
|
|
9543
|
+
compile_stamp="$(fmix_compile_stamp_file "$real")"
|
|
9544
|
+
app_ebin="$build_root/test/lib/cdrcisco/ebin"
|
|
9545
|
+
|
|
9546
|
+
[[ -d "$deps_root" && -d "$build_root" \
|
|
9547
|
+
&& -f "$key_state_file" \
|
|
9548
|
+
&& -f "$dependency_stamp" && -f "$compile_stamp" \
|
|
9549
|
+
&& -d "$app_ebin" \
|
|
9550
|
+
&& -n "$(find "$app_ebin" -maxdepth 1 -type f -name '*.beam' -print -quit 2>/dev/null)" ]] \
|
|
9551
|
+
|| return 1
|
|
9552
|
+
[[ "$(fmix_read_state "$key_state_file" path)" == "$real" \
|
|
9553
|
+
&& "$(fmix_read_state "$key_state_file" template_key)" == "$recorded_key" ]] \
|
|
9554
|
+
|| return 1
|
|
9555
|
+
|
|
9556
|
+
recorded_schema="$(fmix_read_state "$compile_stamp" schema_version)"
|
|
9557
|
+
recorded_stamp_key="$(fmix_read_state "$compile_stamp" template_key)"
|
|
9558
|
+
recorded_env_hash="$(fmix_read_state "$compile_stamp" compile_env_hash)"
|
|
9559
|
+
current_env_hash="$(fmix_compute_compile_env_hash "$real" 2>/dev/null)" \
|
|
9560
|
+
|| return 1
|
|
9561
|
+
[[ "$recorded_schema" == "2" \
|
|
9562
|
+
&& "$recorded_stamp_key" == "$recorded_key" \
|
|
9563
|
+
&& -n "$recorded_env_hash" \
|
|
9564
|
+
&& "$recorded_env_hash" == "$current_env_hash" ]] || return 1
|
|
9565
|
+
[[ "$(fmix_read_state "$dependency_stamp" path)" == "$real" \
|
|
9566
|
+
&& "$(fmix_read_state "$dependency_stamp" build_root)" == "$build_root" \
|
|
9567
|
+
&& "$(fmix_read_state "$compile_stamp" path)" == "$real" \
|
|
9568
|
+
&& "$(fmix_read_state "$compile_stamp" build_root)" == "$build_root" ]] \
|
|
9569
|
+
|| return 1
|
|
9570
|
+
|
|
9571
|
+
recorded_dependency="$(
|
|
9572
|
+
fmix_read_state "$dependency_stamp" dependency_fingerprint
|
|
9573
|
+
)"
|
|
9574
|
+
current_dependency="$(fmix_compute_dependency_fingerprint "$real")" \
|
|
9575
|
+
|| return 1
|
|
9576
|
+
[[ "$recorded_dependency" =~ ^[0-9a-f]{64}$ \
|
|
9577
|
+
&& "$current_dependency" =~ ^[0-9a-f]{64}$ \
|
|
9578
|
+
&& "$recorded_dependency" != "$current_dependency" ]] || return 1
|
|
9579
|
+
|
|
9580
|
+
recorded_reconciliation_guard="$(
|
|
9581
|
+
fmix_read_state "$dependency_stamp" reconciliation_guard
|
|
9582
|
+
)"
|
|
9583
|
+
current_reconciliation_guard="$(
|
|
9584
|
+
fmix_compute_dependency_reconciliation_guard "$real" 2>/dev/null
|
|
9585
|
+
)" || return 1
|
|
9586
|
+
recorded_lock_identity="$(
|
|
9587
|
+
fmix_read_state "$dependency_stamp" lock_identity
|
|
9588
|
+
)"
|
|
9589
|
+
current_lock_identity="$(
|
|
9590
|
+
fmix_compute_dependency_lock_identity "$real" 2>/dev/null
|
|
9591
|
+
)" || return 1
|
|
9592
|
+
[[ "$recorded_reconciliation_guard" =~ ^[0-9a-f]{64}$ \
|
|
9593
|
+
&& "$current_reconciliation_guard" == "$recorded_reconciliation_guard" \
|
|
9594
|
+
&& "$recorded_lock_identity" =~ ^[0-9a-f]{64}$ \
|
|
9595
|
+
&& "$current_lock_identity" =~ ^[0-9a-f]{64}$ \
|
|
9596
|
+
&& "$current_lock_identity" != "$recorded_lock_identity" ]] || return 1
|
|
9597
|
+
|
|
9598
|
+
recorded_dependency_guard="$(fmix_read_state "$dependency_stamp" source_guard)"
|
|
9599
|
+
current_dependency_guard="$(fmix_dependency_source_guard "$real")" \
|
|
9600
|
+
|| return 1
|
|
9601
|
+
[[ -n "$recorded_dependency_guard" \
|
|
9602
|
+
&& "$recorded_dependency_guard" == "$current_dependency_guard" ]] \
|
|
9603
|
+
|| return 1
|
|
9604
|
+
recorded_manifest_guard="$(fmix_read_state "$compile_stamp" manifest_guard)"
|
|
9605
|
+
current_manifest_guard="$(fmix_compile_manifest_guard "$real")" \
|
|
9606
|
+
|| return 1
|
|
9607
|
+
[[ -n "$recorded_manifest_guard" \
|
|
9608
|
+
&& "$recorded_manifest_guard" == "$current_manifest_guard" ]] \
|
|
9609
|
+
|| return 1
|
|
9610
|
+
|
|
9611
|
+
# Move the cheap metadata first. Dependency installation is transactional;
|
|
9612
|
+
# if preparation rejects the candidate, restore the old key and leave the
|
|
9613
|
+
# prior session claims untouched.
|
|
9614
|
+
fmix_update_worktree_template_key \
|
|
9615
|
+
"$real" "$recorded_key" "$template_key" || return 1
|
|
9616
|
+
fmix_prepare_dependency_artifacts "$real" || preparation_rc=$?
|
|
9617
|
+
if (( preparation_rc != 0 )); then
|
|
9618
|
+
fmix_update_worktree_template_key \
|
|
9619
|
+
"$real" "$template_key" "$recorded_key" >/dev/null 2>&1 || true
|
|
9620
|
+
return "$preparation_rc"
|
|
9621
|
+
fi
|
|
9622
|
+
|
|
9623
|
+
if ! fmix_dependency_stamp_matches "$real" "$current_dependency"; then
|
|
9624
|
+
# No exact artifact was installed (an ancestor artifact may already
|
|
9625
|
+
# have replaced the dependency tree). Remove both exact claims so the
|
|
9626
|
+
# next compile resolves and incrementally repairs this retained build.
|
|
9627
|
+
rm -f "$dependency_stamp" "$compile_stamp" || return 1
|
|
9628
|
+
fi
|
|
9629
|
+
[[ -d "$deps_root" && -d "$build_root" \
|
|
9630
|
+
&& -d "$app_ebin" \
|
|
9631
|
+
&& -n "$(find "$app_ebin" -maxdepth 1 -type f -name '*.beam' -print -quit 2>/dev/null)" \
|
|
9632
|
+
&& "$(fmix_read_state "$key_state_file" template_key)" == "$template_key" ]] \
|
|
9633
|
+
|| return 1
|
|
9634
|
+
fmix_info "Same-toolchain dependency change retained the proven app build for incremental reconciliation."
|
|
9635
|
+
return 0
|
|
9636
|
+
}
|
|
9637
|
+
|
|
9376
9638
|
fmix_adopt_compatible_worktree_artifacts() {
|
|
9377
9639
|
local worktree="$1" recorded_key="$2" template_key="$3"
|
|
9378
9640
|
local real state_file artifact_state_file key_state_file
|
|
@@ -15804,6 +16066,197 @@ EOF
|
|
|
15804
16066
|
fmix_update_worktree_template_key \
|
|
15805
16067
|
"$compile_root" "$legacy_template_key" "$current_template_key"
|
|
15806
16068
|
|
|
16069
|
+
if command -v elixir >/dev/null 2>&1; then
|
|
16070
|
+
local dep_change_old_key dep_change_new_key dep_change_output dep_change_log dep_change_rc=0
|
|
16071
|
+
local dep_change_saved_env="${FMIX_SELF_TEST_DEP_TOKEN-__unset__}"
|
|
16072
|
+
local dep_change_saved_active="${FMIX_ACTIVE_SESSION_ROOT-__unset__}"
|
|
16073
|
+
local dep_change_saved_deps="${MIX_DEPS_PATH-__unset__}"
|
|
16074
|
+
local dep_change_saved_build="${MIX_BUILD_PATH-__unset__}"
|
|
16075
|
+
FMIX_ACTIVE_SESSION_ROOT="$compile_root"
|
|
16076
|
+
MIX_DEPS_PATH="$compile_root/deps"
|
|
16077
|
+
MIX_BUILD_PATH="$compile_root/_build/test"
|
|
16078
|
+
FMIX_SELF_TEST_DEP_TOKEN="stable"
|
|
16079
|
+
cp "$compile_root/mix.exs" "$compile_root/mix.exs.dependency-change-fixture"
|
|
16080
|
+
printf 'defmodule Demo.MixProject do\n @dep_token System.get_env("FMIX_SELF_TEST_DEP_TOKEN")\n def project, do: [app: :demo, version: "0.1.0", build_path: "_build", deps_path: "deps", deps: deps()]\n defp deps, do: [{:demo_dep, "~> 1.0"}]\nend\n' \
|
|
16081
|
+
>"$compile_root/mix.exs"
|
|
16082
|
+
mkdir -p "$compile_root/vendor/reconciliation-fixture"
|
|
16083
|
+
printf 'stable vendor input\n' \
|
|
16084
|
+
>"$compile_root/vendor/reconciliation-fixture/input.txt"
|
|
16085
|
+
printf 'lock\n' >"$compile_root/mix.lock"
|
|
16086
|
+
dep_change_old_key="$(fmix_compute_template_key "$compile_root")"
|
|
16087
|
+
dep_before="$(fmix_compute_dependency_fingerprint "$compile_root")"
|
|
16088
|
+
fp_before="$(fmix_compute_compile_fingerprint "$compile_root")"
|
|
16089
|
+
fmix_write_dependency_stamp "$compile_root" "$dep_before"
|
|
16090
|
+
fmix_write_compile_stamp "$compile_root" "$fp_before"
|
|
16091
|
+
fmix_write_artifact_state "$compile_root" "$dep_change_old_key"
|
|
16092
|
+
sed 's/~> 1\.0/~> 1.1/' "$compile_root/mix.exs" \
|
|
16093
|
+
>"$compile_home/dependency-change-mix.exs"
|
|
16094
|
+
mv "$compile_home/dependency-change-mix.exs" "$compile_root/mix.exs"
|
|
16095
|
+
printf 'lock with one stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16096
|
+
dep_change_new_key="$(fmix_compute_template_key "$compile_root")"
|
|
16097
|
+
dep_change_log="$compile_home/dependency-change-reconcile.log"
|
|
16098
|
+
fmix_ensure_artifacts "$compile_root" "$dep_change_new_key" 0 \
|
|
16099
|
+
>"$dep_change_log" 2>&1 || dep_change_rc=$?
|
|
16100
|
+
dep_change_output="$(cat "$dep_change_log")"
|
|
16101
|
+
if (( dep_change_rc == 0 )) \
|
|
16102
|
+
&& [[ "$dep_change_old_key" != "$dep_change_new_key" ]] \
|
|
16103
|
+
&& [[ "$FMIX_LAST_ARTIFACTS_OUTCOME" == "dependency_reconcile" ]] \
|
|
16104
|
+
&& [[ "$(fmix_read_state "$compile_root/artifact-state.json" template_key)" \
|
|
16105
|
+
== "$dep_change_new_key" ]] \
|
|
16106
|
+
&& [[ -f "$compile_root/_build/test/lib/cdrcisco/ebin/Elixir.Demo.beam" ]] \
|
|
16107
|
+
&& [[ ! -e "$compile_root/dependency-stamp.json" \
|
|
16108
|
+
&& ! -e "$compile_root/compile-stamp.json" ]] \
|
|
16109
|
+
&& [[ "$dep_change_output" == *"preserving the app cache for incremental compile"* ]]; then
|
|
16110
|
+
st_pass "same-toolchain dependency change remains a cache hit and preserves the app build"
|
|
16111
|
+
else
|
|
16112
|
+
st_fail "dependency change discarded the app cache or bypassed incremental reconciliation (rc=$dep_change_rc outcome=${FMIX_LAST_ARTIFACTS_OUTCOME:-} output=${dep_change_output//$'\n'/, })"
|
|
16113
|
+
fi
|
|
16114
|
+
|
|
16115
|
+
eval "$(declare -f fmix_run_deps_get | sed '1s/fmix_run_deps_get/fmix_run_deps_get_dependency_change_orig/')"
|
|
16116
|
+
eval "$(declare -f fmix_run_compile_streamed | sed '1s/fmix_run_compile_streamed/fmix_run_compile_streamed_dependency_change_orig/')"
|
|
16117
|
+
local dep_change_deps_marker="$compile_home/dependency-change-deps-get"
|
|
16118
|
+
local dep_change_compile_marker="$compile_home/dependency-change-compile"
|
|
16119
|
+
local dep_change_compile_rc=0
|
|
16120
|
+
fmix_run_deps_get() {
|
|
16121
|
+
: >"$dep_change_deps_marker"
|
|
16122
|
+
return 0
|
|
16123
|
+
}
|
|
16124
|
+
fmix_run_compile_streamed() {
|
|
16125
|
+
local dependency_change_log="$4"
|
|
16126
|
+
[[ -f "$compile_root/_build/test/lib/cdrcisco/ebin/Elixir.Demo.beam" ]] \
|
|
16127
|
+
|| return 1
|
|
16128
|
+
printf 'Compiling 12 files (.ex)\n' >"$dependency_change_log"
|
|
16129
|
+
: >"$dep_change_compile_marker"
|
|
16130
|
+
return 0
|
|
16131
|
+
}
|
|
16132
|
+
fmix_ensure_compile "$compile_root" demo \
|
|
16133
|
+
>/dev/null 2>&1 || dep_change_compile_rc=$?
|
|
16134
|
+
if (( dep_change_compile_rc == 0 )) \
|
|
16135
|
+
&& [[ -f "$dep_change_deps_marker" && -f "$dep_change_compile_marker" ]] \
|
|
16136
|
+
&& [[ "$FMIX_LAST_COMPILE_OUTCOME" == "incremental" \
|
|
16137
|
+
&& "$FMIX_LAST_COMPILE_FILES" == "12" ]] \
|
|
16138
|
+
&& [[ "$FMIX_LAST_ARTIFACTS_OUTCOME" == "dependency_reconcile" ]] \
|
|
16139
|
+
&& fmix_dependency_stamp_matches \
|
|
16140
|
+
"$compile_root" "$(fmix_compute_dependency_fingerprint "$compile_root")" \
|
|
16141
|
+
&& fmix_compile_stamp_matches \
|
|
16142
|
+
"$compile_root" "$(fmix_compute_compile_fingerprint "$compile_root")"; then
|
|
16143
|
+
st_pass "dependency cache hit performs deps reconciliation and a bounded incremental compile"
|
|
16144
|
+
else
|
|
16145
|
+
st_fail "dependency cache hit did not complete incremental reconciliation (rc=$dep_change_compile_rc compile=${FMIX_LAST_COMPILE_OUTCOME:-} files=${FMIX_LAST_COMPILE_FILES:-})"
|
|
16146
|
+
fi
|
|
16147
|
+
eval "$(declare -f fmix_run_deps_get_dependency_change_orig | sed '1s/fmix_run_deps_get_dependency_change_orig/fmix_run_deps_get/')"
|
|
16148
|
+
eval "$(declare -f fmix_run_compile_streamed_dependency_change_orig | sed '1s/fmix_run_compile_streamed_dependency_change_orig/fmix_run_compile_streamed/')"
|
|
16149
|
+
|
|
16150
|
+
# Only mix.lock may vary across this special cache-hit transition. A
|
|
16151
|
+
# simultaneous dependency-input change must fail the reconciliation proof
|
|
16152
|
+
# before it advances metadata or clears stamps.
|
|
16153
|
+
dep_change_old_key="$dep_change_new_key"
|
|
16154
|
+
cp "$compile_root/mix.exs" "$compile_home/reconciliation-mix.exs"
|
|
16155
|
+
printf 'lock with a second stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16156
|
+
sed 's/version: "0\.1\.0"/version: "0.2.0"/' "$compile_root/mix.exs" \
|
|
16157
|
+
>"$compile_home/reconciliation-app-setting.exs"
|
|
16158
|
+
mv "$compile_home/reconciliation-app-setting.exs" "$compile_root/mix.exs"
|
|
16159
|
+
dep_change_new_key="$(fmix_compute_template_key "$compile_root")"
|
|
16160
|
+
if ! fmix_reconcile_same_toolchain_dependency_change \
|
|
16161
|
+
"$compile_root" "$dep_change_old_key" "$dep_change_new_key" \
|
|
16162
|
+
>/dev/null 2>&1 \
|
|
16163
|
+
&& [[ "$(fmix_read_state "$compile_root/artifact-state.json" template_key)" \
|
|
16164
|
+
== "$dep_change_old_key" ]] \
|
|
16165
|
+
&& [[ -f "$compile_root/dependency-stamp.json" \
|
|
16166
|
+
&& -f "$compile_root/compile-stamp.json" ]]; then
|
|
16167
|
+
st_pass "dependency reconciliation rejects a simultaneous mix.exs app-setting change"
|
|
16168
|
+
else
|
|
16169
|
+
st_fail "dependency reconciliation admitted a simultaneous mix.exs app-setting change"
|
|
16170
|
+
fi
|
|
16171
|
+
mv "$compile_home/reconciliation-mix.exs" "$compile_root/mix.exs"
|
|
16172
|
+
printf 'lock with one stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16173
|
+
|
|
16174
|
+
printf 'lock with a third stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16175
|
+
printf 'changed vendor input\n' \
|
|
16176
|
+
>"$compile_root/vendor/reconciliation-fixture/input.txt"
|
|
16177
|
+
dep_change_new_key="$(fmix_compute_template_key "$compile_root")"
|
|
16178
|
+
if ! fmix_reconcile_same_toolchain_dependency_change \
|
|
16179
|
+
"$compile_root" "$dep_change_old_key" "$dep_change_new_key" \
|
|
16180
|
+
>/dev/null 2>&1 \
|
|
16181
|
+
&& [[ "$(fmix_read_state "$compile_root/artifact-state.json" template_key)" \
|
|
16182
|
+
== "$dep_change_old_key" ]] \
|
|
16183
|
+
&& [[ -f "$compile_root/dependency-stamp.json" \
|
|
16184
|
+
&& -f "$compile_root/compile-stamp.json" ]]; then
|
|
16185
|
+
st_pass "dependency reconciliation rejects a simultaneous vendor change"
|
|
16186
|
+
else
|
|
16187
|
+
st_fail "dependency reconciliation admitted a simultaneous vendor change"
|
|
16188
|
+
fi
|
|
16189
|
+
printf 'stable vendor input\n' \
|
|
16190
|
+
>"$compile_root/vendor/reconciliation-fixture/input.txt"
|
|
16191
|
+
printf 'lock with one stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16192
|
+
|
|
16193
|
+
printf 'lock with a fourth stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16194
|
+
FMIX_SELF_TEST_DEP_TOKEN="changed"
|
|
16195
|
+
dep_change_new_key="$(fmix_compute_template_key "$compile_root")"
|
|
16196
|
+
if ! fmix_reconcile_same_toolchain_dependency_change \
|
|
16197
|
+
"$compile_root" "$dep_change_old_key" "$dep_change_new_key" \
|
|
16198
|
+
>/dev/null 2>&1 \
|
|
16199
|
+
&& [[ "$(fmix_read_state "$compile_root/artifact-state.json" template_key)" \
|
|
16200
|
+
== "$dep_change_old_key" ]] \
|
|
16201
|
+
&& [[ -f "$compile_root/dependency-stamp.json" \
|
|
16202
|
+
&& -f "$compile_root/compile-stamp.json" ]]; then
|
|
16203
|
+
st_pass "dependency reconciliation rejects a dependency environment change"
|
|
16204
|
+
else
|
|
16205
|
+
st_fail "dependency reconciliation admitted a dependency environment change"
|
|
16206
|
+
fi
|
|
16207
|
+
FMIX_SELF_TEST_DEP_TOKEN="stable"
|
|
16208
|
+
printf 'lock with one stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16209
|
+
|
|
16210
|
+
rm -f "$compile_root/artifact-state.json" \
|
|
16211
|
+
"$compile_root/dependency-stamp.json" "$compile_root/compile-stamp.json"
|
|
16212
|
+
mv "$compile_root/mix.exs.dependency-change-fixture" "$compile_root/mix.exs"
|
|
16213
|
+
rm -rf "$compile_root/vendor/reconciliation-fixture"
|
|
16214
|
+
printf 'lock\n' >"$compile_root/mix.lock"
|
|
16215
|
+
if [[ "$dep_change_saved_active" == "__unset__" ]]; then
|
|
16216
|
+
unset FMIX_ACTIVE_SESSION_ROOT
|
|
16217
|
+
else
|
|
16218
|
+
FMIX_ACTIVE_SESSION_ROOT="$dep_change_saved_active"
|
|
16219
|
+
fi
|
|
16220
|
+
if [[ "$dep_change_saved_deps" == "__unset__" ]]; then
|
|
16221
|
+
unset MIX_DEPS_PATH
|
|
16222
|
+
else
|
|
16223
|
+
MIX_DEPS_PATH="$dep_change_saved_deps"
|
|
16224
|
+
fi
|
|
16225
|
+
if [[ "$dep_change_saved_build" == "__unset__" ]]; then
|
|
16226
|
+
unset MIX_BUILD_PATH
|
|
16227
|
+
else
|
|
16228
|
+
MIX_BUILD_PATH="$dep_change_saved_build"
|
|
16229
|
+
fi
|
|
16230
|
+
if [[ "$dep_change_saved_env" == "__unset__" ]]; then
|
|
16231
|
+
unset FMIX_SELF_TEST_DEP_TOKEN
|
|
16232
|
+
else
|
|
16233
|
+
FMIX_SELF_TEST_DEP_TOKEN="$dep_change_saved_env"
|
|
16234
|
+
fi
|
|
16235
|
+
else
|
|
16236
|
+
# The portable pre-toolchain stamp path deliberately binds all of
|
|
16237
|
+
# mix.exs. It may round-trip metadata, but cannot authorize the narrower
|
|
16238
|
+
# dependency-body exception without Elixir's AST parser.
|
|
16239
|
+
local raw_guard_before raw_guard_after
|
|
16240
|
+
cp "$compile_root/mix.exs" "$compile_home/raw-guard-mix.exs"
|
|
16241
|
+
raw_guard_before="$(
|
|
16242
|
+
fmix_compute_mix_project_reconciliation_guard "$compile_root"
|
|
16243
|
+
)"
|
|
16244
|
+
printf '\n# dependency declaration changed before toolchain activation\n' \
|
|
16245
|
+
>>"$compile_root/mix.exs"
|
|
16246
|
+
raw_guard_after="$(
|
|
16247
|
+
fmix_compute_mix_project_reconciliation_guard "$compile_root"
|
|
16248
|
+
)"
|
|
16249
|
+
mv "$compile_home/raw-guard-mix.exs" "$compile_root/mix.exs"
|
|
16250
|
+
if [[ "$raw_guard_before" =~ ^[0-9a-f]{64}$ \
|
|
16251
|
+
&& "$raw_guard_after" =~ ^[0-9a-f]{64}$ \
|
|
16252
|
+
&& "$raw_guard_before" != "$raw_guard_after" ]]; then
|
|
16253
|
+
st_pass "portable raw project guard fails closed before Elixir activation"
|
|
16254
|
+
else
|
|
16255
|
+
st_fail "portable raw project guard authorized a mix.exs change"
|
|
16256
|
+
fi
|
|
16257
|
+
st_skip "dependency-only reconciliation exercise requires an active Elixir AST parser"
|
|
16258
|
+
fi
|
|
16259
|
+
|
|
15807
16260
|
dep_before="$(fmix_compute_dependency_fingerprint "$compile_root")"
|
|
15808
16261
|
|
|
15809
16262
|
eval "$(declare -f fmix_run_deps_get | sed '1s/fmix_run_deps_get/fmix_run_deps_get_repair_orig/')"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calltelemetry/fmix",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.8",
|
|
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": "adc849bdca6acd7aa90bb51d115a6852f051f7de5567cef8d5f90bc0d9ecaee5",
|
|
30
|
+
"sourceTag": "fmix-v2.7.8"
|
|
31
31
|
}
|
|
32
32
|
}
|