@calltelemetry/fmix 2.7.7 → 2.7.9
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 +924 -37
- 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.9"
|
|
28
28
|
FMIX_HOME="${FMIX_HOME:-${HOME}/.ct-fmix}"
|
|
29
29
|
FMIX_OS="$(uname -s)"
|
|
30
30
|
FMIX_ARCH="$(uname -m)"
|
|
@@ -175,6 +175,14 @@ fmix_prepare_home() {
|
|
|
175
175
|
export FMIX_HOME
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
fmix_prepare_command_home() {
|
|
179
|
+
fmix_prepare_home || return 1
|
|
180
|
+
mkdir -p "$FMIX_HOME"/{templates,template-access,dependency-artifacts,dependency-artifact-access,sessions,worktrees,db-index,compile-stamps,dependency-stamps,locks,lock-kernel,lock-metadata,logs,quarantine} \
|
|
181
|
+
|| return 1
|
|
182
|
+
fmix_prepare_session_state_root || return 1
|
|
183
|
+
chmod 0700 "$FMIX_HOME" 2>/dev/null || true
|
|
184
|
+
}
|
|
185
|
+
|
|
178
186
|
fmix_prepare_home_readonly() {
|
|
179
187
|
# Cache explain/verify are read-only. Canonicalize an existing home so the
|
|
180
188
|
# same path-safety comparisons apply through aliases, but never create a
|
|
@@ -754,7 +762,7 @@ try:
|
|
|
754
762
|
output.write(digest + b"\n")
|
|
755
763
|
else:
|
|
756
764
|
output.write(b"missing\n")
|
|
757
|
-
|
|
765
|
+
output.flush()
|
|
758
766
|
except OSError:
|
|
759
767
|
report_error(b"Could not read tracked compiler input records")
|
|
760
768
|
raise SystemExit(1)
|
|
@@ -1676,13 +1684,21 @@ fmix_run_telemetry_finish() {
|
|
|
1676
1684
|
local hot_path="no" cache_hot="no" hot_budget overhead=0 phase_pair pname pval
|
|
1677
1685
|
hot_budget="$(fmix_uint_or_default "${FMIX_HOT_PATH_BUDGET_S:-25}" 25 FMIX_HOT_PATH_BUDGET_S)"
|
|
1678
1686
|
case "${FMIX_LAST_COMPILE_OUTCOME:-}" in
|
|
1679
|
-
stamp_hit|stamp_hit_repaired|stamp_hit_after_deps|stamp_hit_quick)
|
|
1687
|
+
stamp_hit|stamp_hit_repaired|stamp_hit_after_deps|stamp_hit_quick|noop_compile)
|
|
1680
1688
|
case "${FMIX_LAST_ARTIFACTS_OUTCOME:-}" in
|
|
1681
|
-
session_hit|adopt_stamps|adopt_compatible|ready|stable_seed|donor_clone)
|
|
1689
|
+
session_hit|adopt_stamps|adopt_compatible|dependency_reconcile|ready|stable_seed|donor_clone)
|
|
1682
1690
|
cache_hot="yes"
|
|
1683
1691
|
;;
|
|
1684
1692
|
esac
|
|
1685
1693
|
;;
|
|
1694
|
+
incremental)
|
|
1695
|
+
# A same-toolchain dependency change deliberately keeps the
|
|
1696
|
+
# proven application build and lets Mix compile only the affected
|
|
1697
|
+
# dependency/app delta. That is still a cache hit; a near-full
|
|
1698
|
+
# compile is classified separately as full_recompile.
|
|
1699
|
+
[[ "${FMIX_LAST_ARTIFACTS_OUTCOME:-}" == "dependency_reconcile" ]] \
|
|
1700
|
+
&& cache_hot="yes"
|
|
1701
|
+
;;
|
|
1686
1702
|
esac
|
|
1687
1703
|
if [[ -n "$FMIX_RUN_PHASES" ]]; then
|
|
1688
1704
|
for phase_pair in $FMIX_RUN_PHASES; do
|
|
@@ -2655,7 +2671,7 @@ fmix_guard_stale_build() {
|
|
|
2655
2671
|
fmix_error "SAFETY: refusing to delete '$path' — expected _build.fmix-stale.* pattern."
|
|
2656
2672
|
return 1
|
|
2657
2673
|
fi
|
|
2658
|
-
if
|
|
2674
|
+
if ! fmix_worktree_has_cisco_cdr_app "$parent"; then
|
|
2659
2675
|
fmix_error "SAFETY: refusing to delete '$path' — parent is not a cisco-cdr checkout."
|
|
2660
2676
|
return 1
|
|
2661
2677
|
fi
|
|
@@ -2672,7 +2688,7 @@ fmix_guard_worktree_subdir() {
|
|
|
2672
2688
|
fmix_error "SAFETY: refusing to rm '$path' — expected path ending in /deps or /_build."
|
|
2673
2689
|
return 1
|
|
2674
2690
|
fi
|
|
2675
|
-
if
|
|
2691
|
+
if ! fmix_worktree_has_cisco_cdr_app "$parent"; then
|
|
2676
2692
|
fmix_error "SAFETY: refusing to rm '$path' — parent '$parent' is not a cisco-cdr checkout."
|
|
2677
2693
|
return 1
|
|
2678
2694
|
fi
|
|
@@ -5143,6 +5159,7 @@ fmix_host_test_lock_enabled() {
|
|
|
5143
5159
|
|
|
5144
5160
|
fmix_ensure_worktree_submodules() {
|
|
5145
5161
|
local target_dir="$1"
|
|
5162
|
+
local selected_gitlink="${2:-}"
|
|
5146
5163
|
|
|
5147
5164
|
# Find top-level repo if inside a Git tree
|
|
5148
5165
|
local top_repo
|
|
@@ -5152,7 +5169,11 @@ fmix_ensure_worktree_submodules() {
|
|
|
5152
5169
|
if [[ ! -f "$target_dir/mix.exs" ]]; then
|
|
5153
5170
|
if [[ -f "$top_repo/.gitmodules" ]]; then
|
|
5154
5171
|
fmix_info "Detected uninitialized submodules in $top_repo. Initializing..." >&2
|
|
5155
|
-
|
|
5172
|
+
if [[ -n "$selected_gitlink" ]]; then
|
|
5173
|
+
git -C "$top_repo" submodule update --init --recursive -- ":(top,literal)$selected_gitlink" >&2 || true
|
|
5174
|
+
else
|
|
5175
|
+
git -C "$top_repo" submodule update --init --recursive >&2 || true
|
|
5176
|
+
fi
|
|
5156
5177
|
fi
|
|
5157
5178
|
fi
|
|
5158
5179
|
|
|
@@ -5170,17 +5191,290 @@ fmix_ensure_worktree_submodules() {
|
|
|
5170
5191
|
fi
|
|
5171
5192
|
}
|
|
5172
5193
|
|
|
5194
|
+
fmix_worktree_has_cisco_cdr_app() {
|
|
5195
|
+
[[ -f "$1/mix.exs" ]] || return 1
|
|
5196
|
+
|
|
5197
|
+
# A bounded static recognizer, not an Elixir interpreter. Require one
|
|
5198
|
+
# literal module, a direct use Mix.Project and its literal project list.
|
|
5199
|
+
# Python is isolated from site/PYTHONPATH and cannot create bytecode; no
|
|
5200
|
+
# project code, helper, toolchain, home or session preparation runs here.
|
|
5201
|
+
python3 -I -S -B - "$1/mix.exs" <<'PY' 2>/dev/null
|
|
5202
|
+
import re
|
|
5203
|
+
import sys
|
|
5204
|
+
|
|
5205
|
+
|
|
5206
|
+
class Refuse(Exception):
|
|
5207
|
+
pass
|
|
5208
|
+
|
|
5209
|
+
|
|
5210
|
+
def require(condition):
|
|
5211
|
+
if not condition:
|
|
5212
|
+
raise Refuse()
|
|
5213
|
+
|
|
5214
|
+
|
|
5215
|
+
def literal_end(source, start):
|
|
5216
|
+
quote = source[start]
|
|
5217
|
+
delimiter = quote * (3 if source.startswith(quote * 3, start) else 1)
|
|
5218
|
+
i = start + len(delimiter)
|
|
5219
|
+
while i < len(source):
|
|
5220
|
+
if source[i] == "\\":
|
|
5221
|
+
i += 2
|
|
5222
|
+
elif source.startswith("#{", i):
|
|
5223
|
+
# Canonical project strings interpolate simple names/calls.
|
|
5224
|
+
# Nested/quoted interpolation is outside this static subset.
|
|
5225
|
+
end = source.find("}", i + 2)
|
|
5226
|
+
require(end != -1 and re.fullmatch(r"[A-Za-z0-9_.&!?()\[\] +*/=-]+", source[i + 2:end]))
|
|
5227
|
+
i = end + 1
|
|
5228
|
+
elif source.startswith(delimiter, i):
|
|
5229
|
+
return i + len(delimiter)
|
|
5230
|
+
else:
|
|
5231
|
+
i += 1
|
|
5232
|
+
raise Refuse()
|
|
5233
|
+
|
|
5234
|
+
|
|
5235
|
+
def tokenize(source):
|
|
5236
|
+
tokens = []
|
|
5237
|
+
identifier = re.compile(r"[A-Za-z_][A-Za-z0-9_]*[!?]?")
|
|
5238
|
+
i = 0
|
|
5239
|
+
while i < len(source):
|
|
5240
|
+
start = i
|
|
5241
|
+
c = source[i]
|
|
5242
|
+
if c.isspace():
|
|
5243
|
+
i += 1
|
|
5244
|
+
continue
|
|
5245
|
+
if c == "#":
|
|
5246
|
+
end = source.find("\n", i)
|
|
5247
|
+
i = len(source) if end == -1 else end
|
|
5248
|
+
continue
|
|
5249
|
+
if c in "\"'":
|
|
5250
|
+
i = literal_end(source, i)
|
|
5251
|
+
value = "<literal>"
|
|
5252
|
+
elif c == "~":
|
|
5253
|
+
# Only canonical plain ASCII wordlists are supported. All other
|
|
5254
|
+
# sigils (including unused ~S decoys) refuse the whole candidate.
|
|
5255
|
+
require(source[i + 1:i + 2] in ("w", "W"))
|
|
5256
|
+
opener = source[i + 2:i + 3]
|
|
5257
|
+
closer = {"(": ")", "[": "]", "{": "}", "<": ">", "/": "/", "|": "|",
|
|
5258
|
+
"\"": "\"", "'": "'"}.get(opener)
|
|
5259
|
+
require(closer is not None)
|
|
5260
|
+
end = source.find(closer, i + 3)
|
|
5261
|
+
require(end != -1 and re.fullmatch(r"[A-Za-z0-9_\s]*", source[i + 3:end]))
|
|
5262
|
+
i = end + 1
|
|
5263
|
+
modifier_start = i
|
|
5264
|
+
while i < len(source) and source[i] in "acs":
|
|
5265
|
+
i += 1
|
|
5266
|
+
require(source[modifier_start:i] in ("", "a", "c", "s"))
|
|
5267
|
+
require(i == len(source) or not (source[i].isalnum() or source[i] == "_"))
|
|
5268
|
+
value = "<literal>"
|
|
5269
|
+
else:
|
|
5270
|
+
word = identifier.match(source, i)
|
|
5271
|
+
require(c != "?") # Character literals are outside this subset.
|
|
5272
|
+
value = word.group() if word else c
|
|
5273
|
+
i += len(value)
|
|
5274
|
+
tokens.append((value, start, i))
|
|
5275
|
+
require(len(tokens) <= 65_536)
|
|
5276
|
+
return tokens
|
|
5277
|
+
|
|
5278
|
+
|
|
5279
|
+
def recognizes(source):
|
|
5280
|
+
tokens = tokenize(source)
|
|
5281
|
+
words = [token[0] for token in tokens]
|
|
5282
|
+
require(len(words) >= 7 and words[0] == "defmodule")
|
|
5283
|
+
|
|
5284
|
+
def codeword(i, word):
|
|
5285
|
+
return (words[i] == word and (i == 0 or words[i - 1] not in (":", "."))
|
|
5286
|
+
and (i + 1 == len(words) or words[i + 1] != ":"))
|
|
5287
|
+
|
|
5288
|
+
# Never let a helper module or quoted/metaprogrammed definition become
|
|
5289
|
+
# authority. Even otherwise-valid multi-module mix.exs files fail closed.
|
|
5290
|
+
require(sum(codeword(i, "defmodule") for i in range(len(words))) == 1)
|
|
5291
|
+
require(not any(codeword(i, word) for i in range(len(words))
|
|
5292
|
+
for word in ("quote", "unquote", "unquote_splicing")))
|
|
5293
|
+
# Do not infer ownership through aliases or imported macros. This also
|
|
5294
|
+
# excludes qualified Kernel.alias/import; literal atoms/keyword keys do
|
|
5295
|
+
# not change lexical resolution and remain opaque field values.
|
|
5296
|
+
require(not any(word in ("alias", "import")
|
|
5297
|
+
and (i == 0 or words[i - 1] != ":")
|
|
5298
|
+
and (i + 1 == len(words) or words[i + 1] != ":")
|
|
5299
|
+
for i, word in enumerate(words)))
|
|
5300
|
+
projects = [i for i, word in enumerate(words[:-1])
|
|
5301
|
+
if word in ("def", "defp") and codeword(i, word) and words[i + 1] == "project"]
|
|
5302
|
+
require(len(projects) == 1)
|
|
5303
|
+
|
|
5304
|
+
i = 1
|
|
5305
|
+
module = []
|
|
5306
|
+
while i < len(words) and words[i] != "do":
|
|
5307
|
+
module.append(words[i])
|
|
5308
|
+
i += 1
|
|
5309
|
+
require(module and len(module) % 2 == 1
|
|
5310
|
+
and all(value == "." if index % 2 else re.fullmatch(r"[A-Z][A-Za-z0-9_]*", value)
|
|
5311
|
+
for index, value in enumerate(module)))
|
|
5312
|
+
require(i < len(words) and codeword(i, "do"))
|
|
5313
|
+
module_do = i
|
|
5314
|
+
i += 1
|
|
5315
|
+
blocks = ["module"]
|
|
5316
|
+
delimiters = []
|
|
5317
|
+
closing = {"]": "[", ")": "(", "}": "{"}
|
|
5318
|
+
uses = 0
|
|
5319
|
+
project_ok = False
|
|
5320
|
+
functions_seen = False
|
|
5321
|
+
|
|
5322
|
+
def statement_start(index):
|
|
5323
|
+
return (index - 1 == module_do or words[index - 1] == ";"
|
|
5324
|
+
or "\n" in source[tokens[index - 1][2]:tokens[index][1]])
|
|
5325
|
+
|
|
5326
|
+
def project_list(index):
|
|
5327
|
+
if words[index:index + 2] == ["(", ")"]:
|
|
5328
|
+
index += 2
|
|
5329
|
+
inline = words[index:index + 3] == [",", "do", ":"]
|
|
5330
|
+
require(inline or words[index:index + 1] == ["do"])
|
|
5331
|
+
index += 3 if inline else 1
|
|
5332
|
+
require(words[index:index + 1] == ["["])
|
|
5333
|
+
depth = ["["]
|
|
5334
|
+
entries = []
|
|
5335
|
+
entry = []
|
|
5336
|
+
index += 1
|
|
5337
|
+
while index < len(words) and depth:
|
|
5338
|
+
word = words[index]
|
|
5339
|
+
if word in ("[", "(", "{"):
|
|
5340
|
+
depth.append(word)
|
|
5341
|
+
elif word in closing:
|
|
5342
|
+
require(depth[-1] == closing[word])
|
|
5343
|
+
depth.pop()
|
|
5344
|
+
if not depth:
|
|
5345
|
+
break
|
|
5346
|
+
# Control blocks or spliced lists are not literal keyword fields.
|
|
5347
|
+
require(not any(codeword(index, key) for key in ("do", "fn", "end")))
|
|
5348
|
+
if word == "," and len(depth) == 1:
|
|
5349
|
+
entries.append(entry)
|
|
5350
|
+
entry = []
|
|
5351
|
+
else:
|
|
5352
|
+
entry.append(word)
|
|
5353
|
+
index += 1
|
|
5354
|
+
require(not depth)
|
|
5355
|
+
if entry:
|
|
5356
|
+
entries.append(entry)
|
|
5357
|
+
require(entries and all(len(field) >= 3 and field[1] == ":"
|
|
5358
|
+
and re.fullmatch(r"[a-z_][A-Za-z0-9_]*[!?]?", field[0])
|
|
5359
|
+
for field in entries))
|
|
5360
|
+
require([field[2:] for field in entries if field[0] == "app"] == [[":", "cdrcisco"]])
|
|
5361
|
+
index += 1
|
|
5362
|
+
require(index < len(words))
|
|
5363
|
+
if inline:
|
|
5364
|
+
require(words[index] in (";", "end")
|
|
5365
|
+
or (statement_start(index) and words[index] in ("def", "defp", "@")))
|
|
5366
|
+
else:
|
|
5367
|
+
require(codeword(index, "end"))
|
|
5368
|
+
index += 1
|
|
5369
|
+
return index
|
|
5370
|
+
|
|
5371
|
+
while i < len(words):
|
|
5372
|
+
word = words[i]
|
|
5373
|
+
if codeword(i, "use"):
|
|
5374
|
+
require(blocks == ["module"] and not delimiters and not functions_seen
|
|
5375
|
+
and statement_start(i) and words[i + 1:i + 4] == ["Mix", ".", "Project"])
|
|
5376
|
+
uses += 1
|
|
5377
|
+
require(uses == 1)
|
|
5378
|
+
i += 4
|
|
5379
|
+
require(i < len(words) and (words[i] in (";", "end") or statement_start(i))
|
|
5380
|
+
and words[i] not in (",", "."))
|
|
5381
|
+
continue
|
|
5382
|
+
if word in ("def", "defp") and codeword(i, word):
|
|
5383
|
+
functions_seen = True
|
|
5384
|
+
if i == projects[0]:
|
|
5385
|
+
require(word == "def" and blocks == ["module"] and not delimiters
|
|
5386
|
+
and uses == 1 and statement_start(i))
|
|
5387
|
+
i = project_list(i + 2)
|
|
5388
|
+
project_ok = True
|
|
5389
|
+
continue
|
|
5390
|
+
if word in ("[", "(", "{"):
|
|
5391
|
+
delimiters.append(word)
|
|
5392
|
+
elif word in closing:
|
|
5393
|
+
require(delimiters and delimiters.pop() == closing[word])
|
|
5394
|
+
elif codeword(i, "do") or codeword(i, "fn"):
|
|
5395
|
+
blocks.append("block")
|
|
5396
|
+
elif codeword(i, "end"):
|
|
5397
|
+
require(blocks)
|
|
5398
|
+
blocks.pop()
|
|
5399
|
+
if not blocks:
|
|
5400
|
+
require(not delimiters and all(value == ";" for value in words[i + 1:]))
|
|
5401
|
+
return uses == 1 and project_ok
|
|
5402
|
+
i += 1
|
|
5403
|
+
return False
|
|
5404
|
+
|
|
5405
|
+
|
|
5406
|
+
try:
|
|
5407
|
+
with open(sys.argv[1], "rb") as handle:
|
|
5408
|
+
raw = handle.read(1_048_577)
|
|
5409
|
+
require(len(raw) <= 1_048_576)
|
|
5410
|
+
source = raw.decode("utf-8")
|
|
5411
|
+
sys.exit(0 if recognizes(source) else 1)
|
|
5412
|
+
except (OSError, UnicodeError, Refuse, IndexError):
|
|
5413
|
+
sys.exit(1)
|
|
5414
|
+
PY
|
|
5415
|
+
}
|
|
5416
|
+
|
|
5417
|
+
fmix_worktree_is_cold_submodule() {
|
|
5418
|
+
# A missing mix.exs is not a checkout identity. Admit the one cold
|
|
5419
|
+
# exception only when Git registers this exact directory as an
|
|
5420
|
+
# uninitialized Gitlink and .gitmodules names the cisco-cdr source.
|
|
5421
|
+
[[ -d "$1" && ! -e "$1/mix.exs" ]] || return 1
|
|
5422
|
+
local target top relative entry key registered_path url status
|
|
5423
|
+
target="$(fmix_realpath "$1")" || return 1
|
|
5424
|
+
top="$(git -C "$target" rev-parse --show-toplevel 2>/dev/null)" || return 1
|
|
5425
|
+
top="$(fmix_realpath "$top")" || return 1
|
|
5426
|
+
[[ "$target" == "$top/"* && -f "$top/.gitmodules" ]] || return 1
|
|
5427
|
+
relative="${target#"$top/"}"
|
|
5428
|
+
entry="$(git -C "$top" ls-files --stage -- "$relative" 2>/dev/null)" || return 1
|
|
5429
|
+
[[ "$entry" != *$'\n'* && "$entry" =~ ^160000\ [0-9a-f]{40}\ 0$'\t' ]] || return 1
|
|
5430
|
+
[[ "${entry#*$'\t'}" == "$relative" ]] || return 1
|
|
5431
|
+
|
|
5432
|
+
while IFS= read -r key; do
|
|
5433
|
+
registered_path="$(git -C "$top" config --file .gitmodules --get "$key" 2>/dev/null)" || continue
|
|
5434
|
+
[[ "$registered_path" == "$relative" ]] || continue
|
|
5435
|
+
url="$(git -C "$top" config --file .gitmodules --get "${key%.path}.url" 2>/dev/null)" || return 1
|
|
5436
|
+
case "$url" in
|
|
5437
|
+
https://github.com/calltelemetry/cisco-cdr|https://github.com/calltelemetry/cisco-cdr.git|git@github.com:calltelemetry/cisco-cdr|git@github.com:calltelemetry/cisco-cdr.git|ssh://git@github.com/calltelemetry/cisco-cdr|ssh://git@github.com/calltelemetry/cisco-cdr.git) ;;
|
|
5438
|
+
*) return 1 ;;
|
|
5439
|
+
esac
|
|
5440
|
+
status="$(git -C "$top" submodule status -- "$relative" 2>/dev/null)" || return 1
|
|
5441
|
+
[[ "$status" == -[0-9a-f]* ]] || return 1
|
|
5442
|
+
printf '%s\n' "$relative"
|
|
5443
|
+
return 0
|
|
5444
|
+
done < <(git -C "$top" config --file .gitmodules --name-only --get-regexp '^submodule\..*\.path$' 2>/dev/null)
|
|
5445
|
+
return 1
|
|
5446
|
+
}
|
|
5447
|
+
|
|
5173
5448
|
fmix_find_worktree() {
|
|
5174
5449
|
local path="$1"
|
|
5450
|
+
# Admission needs a verified candidate without initializing submodules.
|
|
5451
|
+
# The default resolution still initializes and verifies the checkout.
|
|
5452
|
+
local resolution_mode="${2:-initialize}"
|
|
5175
5453
|
local search_from
|
|
5454
|
+
local cold_relative
|
|
5176
5455
|
|
|
5177
5456
|
if [[ "$path" == "auto" ]]; then
|
|
5178
5457
|
search_from="$(pwd)"
|
|
5179
5458
|
# Walk up looking for mix.exs with app: :cdrcisco
|
|
5180
5459
|
local dir="$search_from"
|
|
5181
5460
|
while true; do
|
|
5182
|
-
|
|
5183
|
-
|
|
5461
|
+
cold_relative=""
|
|
5462
|
+
if fmix_worktree_has_cisco_cdr_app "$dir"; then
|
|
5463
|
+
:
|
|
5464
|
+
elif cold_relative="$(fmix_worktree_is_cold_submodule "$dir")"; then
|
|
5465
|
+
:
|
|
5466
|
+
else
|
|
5467
|
+
cold_relative=""
|
|
5468
|
+
fi
|
|
5469
|
+
if fmix_worktree_has_cisco_cdr_app "$dir" || [[ -n "$cold_relative" ]]; then
|
|
5470
|
+
if [[ "$resolution_mode" != "readonly" ]]; then
|
|
5471
|
+
if [[ -n "$cold_relative" ]]; then
|
|
5472
|
+
fmix_ensure_worktree_submodules "$dir" "$cold_relative"
|
|
5473
|
+
else
|
|
5474
|
+
fmix_ensure_worktree_submodules "$dir"
|
|
5475
|
+
fi
|
|
5476
|
+
fmix_worktree_has_cisco_cdr_app "$dir" || return 1
|
|
5477
|
+
fi
|
|
5184
5478
|
printf '%s\n' "$dir"
|
|
5185
5479
|
return 0
|
|
5186
5480
|
fi
|
|
@@ -5194,10 +5488,29 @@ fmix_find_worktree() {
|
|
|
5194
5488
|
|
|
5195
5489
|
# If not found walking up, check if CWD has a cisco-cdr subdirectory
|
|
5196
5490
|
if [[ -d "$search_from/cisco-cdr" ]]; then
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5491
|
+
if [[ "$resolution_mode" == "readonly" ]]; then
|
|
5492
|
+
cold_relative=""
|
|
5493
|
+
if ! fmix_worktree_has_cisco_cdr_app "$search_from/cisco-cdr"; then
|
|
5494
|
+
cold_relative="$(fmix_worktree_is_cold_submodule "$search_from/cisco-cdr")" || cold_relative=""
|
|
5495
|
+
fi
|
|
5496
|
+
if fmix_worktree_has_cisco_cdr_app "$search_from/cisco-cdr" || [[ -n "$cold_relative" ]]; then
|
|
5497
|
+
printf '%s\n' "$search_from/cisco-cdr"
|
|
5498
|
+
return 0
|
|
5499
|
+
fi
|
|
5500
|
+
else
|
|
5501
|
+
cold_relative=""
|
|
5502
|
+
if ! fmix_worktree_has_cisco_cdr_app "$search_from/cisco-cdr"; then
|
|
5503
|
+
cold_relative="$(fmix_worktree_is_cold_submodule "$search_from/cisco-cdr")" || cold_relative=""
|
|
5504
|
+
fi
|
|
5505
|
+
if [[ -n "$cold_relative" ]]; then
|
|
5506
|
+
fmix_ensure_worktree_submodules "$search_from/cisco-cdr" "$cold_relative"
|
|
5507
|
+
elif fmix_worktree_has_cisco_cdr_app "$search_from/cisco-cdr"; then
|
|
5508
|
+
fmix_ensure_worktree_submodules "$search_from/cisco-cdr"
|
|
5509
|
+
fi
|
|
5510
|
+
if fmix_worktree_has_cisco_cdr_app "$search_from/cisco-cdr"; then
|
|
5511
|
+
printf '%s\n' "$search_from/cisco-cdr"
|
|
5512
|
+
return 0
|
|
5513
|
+
fi
|
|
5201
5514
|
fi
|
|
5202
5515
|
fi
|
|
5203
5516
|
|
|
@@ -5215,9 +5528,30 @@ fmix_find_worktree() {
|
|
|
5215
5528
|
resolved_dir="$resolved_dir/cisco-cdr"
|
|
5216
5529
|
fi
|
|
5217
5530
|
|
|
5218
|
-
|
|
5531
|
+
cold_relative=""
|
|
5532
|
+
if ! fmix_worktree_has_cisco_cdr_app "$resolved_dir"; then
|
|
5533
|
+
cold_relative="$(fmix_worktree_is_cold_submodule "$resolved_dir")" || cold_relative=""
|
|
5534
|
+
fi
|
|
5535
|
+
|
|
5536
|
+
if [[ "$resolution_mode" == "readonly" ]]; then
|
|
5537
|
+
if ! fmix_worktree_has_cisco_cdr_app "$resolved_dir" && [[ -z "$cold_relative" ]]; then
|
|
5538
|
+
fmix_error "'$path' is not a cisco-cdr checkout (mix.exs missing or app: :cdrcisco not found; no recognized uninitialized cisco-cdr Gitlink)."
|
|
5539
|
+
return 1
|
|
5540
|
+
fi
|
|
5541
|
+
printf '%s\n' "$resolved_dir"
|
|
5542
|
+
return 0
|
|
5543
|
+
fi
|
|
5544
|
+
if [[ -n "$cold_relative" ]]; then
|
|
5545
|
+
fmix_ensure_worktree_submodules "$resolved_dir" "$cold_relative"
|
|
5546
|
+
elif fmix_worktree_has_cisco_cdr_app "$resolved_dir"; then
|
|
5547
|
+
fmix_ensure_worktree_submodules "$resolved_dir"
|
|
5548
|
+
else
|
|
5549
|
+
fmix_error "'$path' is not a cisco-cdr checkout (not inside a cisco-cdr checkout, mix.exs missing or app: :cdrcisco not found)."
|
|
5550
|
+
fmix_error "fmix v1 only supports cisco-cdr worktrees."
|
|
5551
|
+
return 1
|
|
5552
|
+
fi
|
|
5219
5553
|
|
|
5220
|
-
if
|
|
5554
|
+
if ! fmix_worktree_has_cisco_cdr_app "$resolved_dir"; then
|
|
5221
5555
|
fmix_error "'$path' is not a cisco-cdr checkout (not inside a cisco-cdr checkout, mix.exs missing or app: :cdrcisco not found)."
|
|
5222
5556
|
fmix_error "fmix v1 only supports cisco-cdr worktrees."
|
|
5223
5557
|
return 1
|
|
@@ -6135,7 +6469,7 @@ fmix_clone_donor_to_session() {
|
|
|
6135
6469
|
local donor_keeper_pid
|
|
6136
6470
|
[[ -f "$donor/meta.json" ]] || return 1
|
|
6137
6471
|
if ! fmix_lock_keeper_start "$donor/meta.json" shared 0 \
|
|
6138
|
-
"donor session clone" "donor-$(
|
|
6472
|
+
"donor session clone" "donor-$(fmix_hash_string "$donor" | cut -c1-16)"; then
|
|
6139
6473
|
fmix_warn "Could not acquire shared lock on donor session $donor."
|
|
6140
6474
|
return 1
|
|
6141
6475
|
fi
|
|
@@ -6362,6 +6696,12 @@ fmix_ensure_artifacts() {
|
|
|
6362
6696
|
FMIX_LAST_ARTIFACTS_OUTCOME="adopt_compatible"
|
|
6363
6697
|
return 0
|
|
6364
6698
|
fi
|
|
6699
|
+
if fmix_reconcile_same_toolchain_dependency_change \
|
|
6700
|
+
"$worktree" "$recorded_key" "$template_key"; then
|
|
6701
|
+
fmix_info "Dependency change adopted under template key $template_key — preserving the app cache for incremental compile."
|
|
6702
|
+
FMIX_LAST_ARTIFACTS_OUTCOME="dependency_reconcile"
|
|
6703
|
+
return 0
|
|
6704
|
+
fi
|
|
6365
6705
|
fmix_info "Artifact compatibility proof failed; a verified template clone is required."
|
|
6366
6706
|
fi
|
|
6367
6707
|
fi
|
|
@@ -8421,6 +8761,115 @@ fmix_compute_dependency_fingerprint() {
|
|
|
8421
8761
|
printf '%s\n' "$fingerprint"
|
|
8422
8762
|
}
|
|
8423
8763
|
|
|
8764
|
+
fmix_compute_mix_project_reconciliation_guard() {
|
|
8765
|
+
# Normalize mix.exs while replacing exactly one ordinary deps/0 body. This
|
|
8766
|
+
# permits dependency declaration/constraint edits but keeps application,
|
|
8767
|
+
# compiler, path-layout, and every helper definition bound to the retained
|
|
8768
|
+
# app build. Path deps and referenced environment are guarded separately.
|
|
8769
|
+
local worktree="$1" real guard
|
|
8770
|
+
real="$(fmix_realpath "$worktree")" || return 1
|
|
8771
|
+
[[ -f "$real/mix.exs" ]] || return 1
|
|
8772
|
+
if ! command -v elixir >/dev/null 2>&1; then
|
|
8773
|
+
# Stamp helpers are intentionally portable before toolchain activation.
|
|
8774
|
+
# Bind the full project file in that mode: this keeps ordinary stamp
|
|
8775
|
+
# round-trips usable but deliberately prevents dependency-only reuse
|
|
8776
|
+
# until Elixir can produce the narrower AST-backed proof.
|
|
8777
|
+
(
|
|
8778
|
+
printf 'fmix-raw-mix-project-v1\n'
|
|
8779
|
+
cat "$real/mix.exs"
|
|
8780
|
+
) | fmix_hash_stdin
|
|
8781
|
+
return $?
|
|
8782
|
+
fi
|
|
8783
|
+
guard="$(cd "$real" && elixir -e '
|
|
8784
|
+
path = List.first(System.argv())
|
|
8785
|
+
|
|
8786
|
+
with {:ok, source} <- File.read(path) do
|
|
8787
|
+
quoted = Code.string_to_quoted(source)
|
|
8788
|
+
|
|
8789
|
+
if match?({:ok, _}, quoted) do
|
|
8790
|
+
{:ok, quoted} = quoted
|
|
8791
|
+
{normalized, count} =
|
|
8792
|
+
Macro.prewalk(quoted, 0, fn
|
|
8793
|
+
{kind, meta, [{:deps, call_meta, args}, body]} = node, count
|
|
8794
|
+
when kind in [:def, :defp] and args in [nil, []] and is_list(body) ->
|
|
8795
|
+
if Keyword.keyword?(body) and Keyword.has_key?(body, :do) do
|
|
8796
|
+
replacement =
|
|
8797
|
+
{kind, meta,
|
|
8798
|
+
[
|
|
8799
|
+
{:deps, call_meta, args},
|
|
8800
|
+
Keyword.put(body, :do, :__fmix_dependency_declarations__)
|
|
8801
|
+
]}
|
|
8802
|
+
|
|
8803
|
+
{replacement, count + 1}
|
|
8804
|
+
else
|
|
8805
|
+
{node, count}
|
|
8806
|
+
end
|
|
8807
|
+
|
|
8808
|
+
node, count ->
|
|
8809
|
+
{node, count}
|
|
8810
|
+
end)
|
|
8811
|
+
|
|
8812
|
+
if count == 1 do
|
|
8813
|
+
IO.write("fmix-normalized-deps-v1\n" <> Macro.to_string(normalized))
|
|
8814
|
+
else
|
|
8815
|
+
IO.write("fmix-raw-mix-project-v1\n" <> source)
|
|
8816
|
+
end
|
|
8817
|
+
else
|
|
8818
|
+
IO.write("fmix-raw-mix-project-v1\n" <> source)
|
|
8819
|
+
end
|
|
8820
|
+
end
|
|
8821
|
+
' mix.exs)" || return 1
|
|
8822
|
+
[[ -n "$guard" ]] || return 1
|
|
8823
|
+
printf '%s' "$guard" | fmix_hash_stdin
|
|
8824
|
+
}
|
|
8825
|
+
|
|
8826
|
+
fmix_compute_dependency_reconciliation_guard() {
|
|
8827
|
+
# Identity for dependency-resolution inputs that must remain stable while
|
|
8828
|
+
# reusing an app build across an ordinary deps/0 + mix.lock transition.
|
|
8829
|
+
# Those two dependency declarations are intentionally excluded; every
|
|
8830
|
+
# other dependency/compile-shaping input remains bound to the stamp.
|
|
8831
|
+
local worktree="$1" real toolchain_identity manifest guard rc
|
|
8832
|
+
real="$(fmix_realpath "$worktree")" || return 1
|
|
8833
|
+
toolchain_identity="${FMIX_TOOLCHAIN_IDENTITY:-}"
|
|
8834
|
+
if [[ -z "$toolchain_identity" ]]; then
|
|
8835
|
+
toolchain_identity="$(fmix_resolved_toolchain_identity "$real")" \
|
|
8836
|
+
|| return 1
|
|
8837
|
+
fi
|
|
8838
|
+
local -a guarded_paths=(
|
|
8839
|
+
.tool-versions vendor dev_tools
|
|
8840
|
+
)
|
|
8841
|
+
manifest="$(mktemp)" || return 1
|
|
8842
|
+
(
|
|
8843
|
+
printf 'fmix-dependency-reconciliation-guard-v1\n'
|
|
8844
|
+
printf 'os_arch=%s %s\n' "$FMIX_OS" "$FMIX_ARCH"
|
|
8845
|
+
printf '%s\n' "$toolchain_identity"
|
|
8846
|
+
fmix_hash_compile_paths "$real" "${guarded_paths[@]}" || return 1
|
|
8847
|
+
fmix_compute_mix_project_reconciliation_guard "$real" || return 1
|
|
8848
|
+
fmix_declared_path_dependency_resolution_guard "$real" || return 1
|
|
8849
|
+
fmix_dependency_environment "$real" || return 1
|
|
8850
|
+
) >"$manifest"
|
|
8851
|
+
rc=$?
|
|
8852
|
+
if (( rc != 0 )); then
|
|
8853
|
+
rm -f "$manifest"
|
|
8854
|
+
return "$rc"
|
|
8855
|
+
fi
|
|
8856
|
+
guard="$(fmix_hash_stdin <"$manifest")"
|
|
8857
|
+
rc=$?
|
|
8858
|
+
rm -f "$manifest"
|
|
8859
|
+
(( rc == 0 )) || return "$rc"
|
|
8860
|
+
[[ "$guard" =~ ^[0-9a-f]{64}$ ]] || return 1
|
|
8861
|
+
printf '%s\n' "$guard"
|
|
8862
|
+
}
|
|
8863
|
+
|
|
8864
|
+
fmix_compute_dependency_lock_identity() {
|
|
8865
|
+
local worktree="$1" real
|
|
8866
|
+
real="$(fmix_realpath "$worktree")" || return 1
|
|
8867
|
+
(
|
|
8868
|
+
printf 'fmix-dependency-lock-v1\n'
|
|
8869
|
+
fmix_hash_compile_paths "$real" mix.lock || return 1
|
|
8870
|
+
) | fmix_hash_stdin
|
|
8871
|
+
}
|
|
8872
|
+
|
|
8424
8873
|
fmix_compute_legacy_compile_fingerprint_v2() {
|
|
8425
8874
|
local worktree="$1" real build_root
|
|
8426
8875
|
real="$(fmix_realpath "$worktree")"
|
|
@@ -8874,9 +9323,14 @@ fmix_dependency_stamp_file() {
|
|
|
8874
9323
|
|
|
8875
9324
|
fmix_write_dependency_stamp() {
|
|
8876
9325
|
local worktree="$1" dependency_fingerprint="$2" real build_root guard stamp tmp
|
|
9326
|
+
local reconciliation_guard lock_identity
|
|
8877
9327
|
real="$(fmix_realpath "$worktree")"
|
|
8878
9328
|
build_root="$(fmix_compile_build_root "$real")"
|
|
8879
9329
|
guard="$(fmix_dependency_source_guard "$real")" || return 1
|
|
9330
|
+
reconciliation_guard="$(
|
|
9331
|
+
fmix_compute_dependency_reconciliation_guard "$real"
|
|
9332
|
+
)" || return 1
|
|
9333
|
+
lock_identity="$(fmix_compute_dependency_lock_identity "$real")" || return 1
|
|
8880
9334
|
stamp="$(fmix_dependency_stamp_file "$real")"
|
|
8881
9335
|
mkdir -p "$(dirname "$stamp")"
|
|
8882
9336
|
tmp="$(mktemp "${stamp}.tmp.XXXXXX")" || return 1
|
|
@@ -8885,6 +9339,8 @@ fmix_write_dependency_stamp() {
|
|
|
8885
9339
|
"path": $(fmix_json_escape "$real"),
|
|
8886
9340
|
"build_root": $(fmix_json_escape "$build_root"),
|
|
8887
9341
|
"dependency_fingerprint": $(fmix_json_escape "$dependency_fingerprint"),
|
|
9342
|
+
"reconciliation_guard": $(fmix_json_escape "$reconciliation_guard"),
|
|
9343
|
+
"lock_identity": $(fmix_json_escape "$lock_identity"),
|
|
8888
9344
|
"source_guard": $(fmix_json_escape "$guard"),
|
|
8889
9345
|
"resolved_at": $(fmix_json_escape "$(fmix_now)")
|
|
8890
9346
|
}
|
|
@@ -9021,6 +9477,15 @@ fmix_compute_dirty_hash() {
|
|
|
9021
9477
|
local worktree="$1" real status manifest hash rc file
|
|
9022
9478
|
local untracked_file diff_file staged_file
|
|
9023
9479
|
local -a untracked=()
|
|
9480
|
+
shift
|
|
9481
|
+
local -a target_paths=("$@")
|
|
9482
|
+
if (( ${#target_paths[@]} == 0 )); then
|
|
9483
|
+
target_paths=(
|
|
9484
|
+
.tool-versions mix.exs mix.lock
|
|
9485
|
+
config lib test/support test/cdrcisco/policies/reputation_signals/shared
|
|
9486
|
+
vendor dev_tools priv/repo
|
|
9487
|
+
)
|
|
9488
|
+
fi
|
|
9024
9489
|
real="$(fmix_realpath "$worktree" 2>/dev/null)" || return 1
|
|
9025
9490
|
if [[ ! -d "$real/.git" && ! -f "$real/.git" ]]; then
|
|
9026
9491
|
printf 'clean\n'
|
|
@@ -9029,7 +9494,7 @@ fmix_compute_dirty_hash() {
|
|
|
9029
9494
|
command -v git >/dev/null 2>&1 || return 1
|
|
9030
9495
|
git -C "$real" rev-parse --is-inside-work-tree >/dev/null 2>&1 \
|
|
9031
9496
|
|| return 1
|
|
9032
|
-
status="$(git -C "$real" status --porcelain=v1 2>/dev/null)" || return 1
|
|
9497
|
+
status="$(git -C "$real" status --porcelain=v1 -- "${target_paths[@]}" 2>/dev/null)" || return 1
|
|
9033
9498
|
if [[ -z "$status" ]]; then
|
|
9034
9499
|
printf 'clean\n'
|
|
9035
9500
|
return 0
|
|
@@ -9040,17 +9505,17 @@ fmix_compute_dirty_hash() {
|
|
|
9040
9505
|
|| { rm -f "$manifest" "$untracked_file"; return 1; }
|
|
9041
9506
|
staged_file="$(mktemp)" \
|
|
9042
9507
|
|| { rm -f "$manifest" "$untracked_file" "$diff_file"; return 1; }
|
|
9043
|
-
if ! git -C "$real" ls-files --others --exclude-standard -z \
|
|
9508
|
+
if ! git -C "$real" ls-files --others --exclude-standard -z -- "${target_paths[@]}" \
|
|
9044
9509
|
>"$untracked_file" 2>/dev/null; then
|
|
9045
9510
|
rm -f "$manifest" "$untracked_file" "$diff_file" "$staged_file"
|
|
9046
9511
|
return 1
|
|
9047
9512
|
fi
|
|
9048
|
-
if ! git -C "$real" diff --no-ext-diff --binary --
|
|
9513
|
+
if ! git -C "$real" diff --no-ext-diff --binary -- "${target_paths[@]}" \
|
|
9049
9514
|
>"$diff_file" 2>/dev/null; then
|
|
9050
9515
|
rm -f "$manifest" "$untracked_file" "$diff_file" "$staged_file"
|
|
9051
9516
|
return 1
|
|
9052
9517
|
fi
|
|
9053
|
-
if ! git -C "$real" diff --cached --no-ext-diff --binary --
|
|
9518
|
+
if ! git -C "$real" diff --cached --no-ext-diff --binary -- "${target_paths[@]}" \
|
|
9054
9519
|
>"$staged_file" 2>/dev/null; then
|
|
9055
9520
|
rm -f "$manifest" "$untracked_file" "$diff_file" "$staged_file"
|
|
9056
9521
|
return 1
|
|
@@ -9373,6 +9838,129 @@ fmix_update_worktree_template_key() {
|
|
|
9373
9838
|
mv "$tmp" "$key_state_file" || { rm -f "$tmp"; return 1; }
|
|
9374
9839
|
}
|
|
9375
9840
|
|
|
9841
|
+
fmix_reconcile_same_toolchain_dependency_change() {
|
|
9842
|
+
# A dependency-only template-key change must not throw away a proven app
|
|
9843
|
+
# build. Prove that the existing session was compiled at the same ABI and
|
|
9844
|
+
# that its dependency/build guards are intact, advance only its storage
|
|
9845
|
+
# key, then let the split dependency lane install an exact/ancestor
|
|
9846
|
+
# artifact when available. With no shared artifact, the current session is
|
|
9847
|
+
# itself the reconciliation seed: clear its exact-hit claims so deps.get +
|
|
9848
|
+
# Mix perform an ordinary incremental repair in place.
|
|
9849
|
+
local worktree="$1" recorded_key="$2" template_key="$3"
|
|
9850
|
+
local real deps_root build_root state_file artifact_state_file key_state_file
|
|
9851
|
+
local dependency_stamp compile_stamp recorded_dependency current_dependency
|
|
9852
|
+
local recorded_dependency_guard current_dependency_guard
|
|
9853
|
+
local recorded_reconciliation_guard current_reconciliation_guard
|
|
9854
|
+
local recorded_lock_identity current_lock_identity
|
|
9855
|
+
local recorded_manifest_guard current_manifest_guard
|
|
9856
|
+
local recorded_env_hash current_env_hash recorded_stamp_key recorded_schema
|
|
9857
|
+
local app_ebin preparation_rc=0
|
|
9858
|
+
real="$(fmix_realpath "$worktree")" || return 1
|
|
9859
|
+
deps_root="$(fmix_session_deps_root "$real")" || return 1
|
|
9860
|
+
build_root="$(fmix_compile_build_root "$real")" || return 1
|
|
9861
|
+
state_file="$(fmix_worktree_state_file "$real")"
|
|
9862
|
+
artifact_state_file="$(fmix_artifact_state_file "$real")"
|
|
9863
|
+
if [[ -f "$artifact_state_file" ]]; then
|
|
9864
|
+
key_state_file="$artifact_state_file"
|
|
9865
|
+
else
|
|
9866
|
+
key_state_file="$state_file"
|
|
9867
|
+
fi
|
|
9868
|
+
dependency_stamp="$(fmix_dependency_stamp_file "$real")"
|
|
9869
|
+
compile_stamp="$(fmix_compile_stamp_file "$real")"
|
|
9870
|
+
app_ebin="$build_root/test/lib/cdrcisco/ebin"
|
|
9871
|
+
|
|
9872
|
+
[[ -d "$deps_root" && -d "$build_root" \
|
|
9873
|
+
&& -f "$key_state_file" \
|
|
9874
|
+
&& -f "$dependency_stamp" && -f "$compile_stamp" \
|
|
9875
|
+
&& -d "$app_ebin" \
|
|
9876
|
+
&& -n "$(find "$app_ebin" -maxdepth 1 -type f -name '*.beam' -print -quit 2>/dev/null)" ]] \
|
|
9877
|
+
|| return 1
|
|
9878
|
+
[[ "$(fmix_read_state "$key_state_file" path)" == "$real" \
|
|
9879
|
+
&& "$(fmix_read_state "$key_state_file" template_key)" == "$recorded_key" ]] \
|
|
9880
|
+
|| return 1
|
|
9881
|
+
|
|
9882
|
+
recorded_schema="$(fmix_read_state "$compile_stamp" schema_version)"
|
|
9883
|
+
recorded_stamp_key="$(fmix_read_state "$compile_stamp" template_key)"
|
|
9884
|
+
recorded_env_hash="$(fmix_read_state "$compile_stamp" compile_env_hash)"
|
|
9885
|
+
current_env_hash="$(fmix_compute_compile_env_hash "$real" 2>/dev/null)" \
|
|
9886
|
+
|| return 1
|
|
9887
|
+
[[ "$recorded_schema" == "2" \
|
|
9888
|
+
&& "$recorded_stamp_key" == "$recorded_key" \
|
|
9889
|
+
&& -n "$recorded_env_hash" \
|
|
9890
|
+
&& "$recorded_env_hash" == "$current_env_hash" ]] || return 1
|
|
9891
|
+
[[ "$(fmix_read_state "$dependency_stamp" path)" == "$real" \
|
|
9892
|
+
&& "$(fmix_read_state "$dependency_stamp" build_root)" == "$build_root" \
|
|
9893
|
+
&& "$(fmix_read_state "$compile_stamp" path)" == "$real" \
|
|
9894
|
+
&& "$(fmix_read_state "$compile_stamp" build_root)" == "$build_root" ]] \
|
|
9895
|
+
|| return 1
|
|
9896
|
+
|
|
9897
|
+
recorded_dependency="$(
|
|
9898
|
+
fmix_read_state "$dependency_stamp" dependency_fingerprint
|
|
9899
|
+
)"
|
|
9900
|
+
current_dependency="$(fmix_compute_dependency_fingerprint "$real")" \
|
|
9901
|
+
|| return 1
|
|
9902
|
+
[[ "$recorded_dependency" =~ ^[0-9a-f]{64}$ \
|
|
9903
|
+
&& "$current_dependency" =~ ^[0-9a-f]{64}$ \
|
|
9904
|
+
&& "$recorded_dependency" != "$current_dependency" ]] || return 1
|
|
9905
|
+
|
|
9906
|
+
recorded_reconciliation_guard="$(
|
|
9907
|
+
fmix_read_state "$dependency_stamp" reconciliation_guard
|
|
9908
|
+
)"
|
|
9909
|
+
current_reconciliation_guard="$(
|
|
9910
|
+
fmix_compute_dependency_reconciliation_guard "$real" 2>/dev/null
|
|
9911
|
+
)" || return 1
|
|
9912
|
+
recorded_lock_identity="$(
|
|
9913
|
+
fmix_read_state "$dependency_stamp" lock_identity
|
|
9914
|
+
)"
|
|
9915
|
+
current_lock_identity="$(
|
|
9916
|
+
fmix_compute_dependency_lock_identity "$real" 2>/dev/null
|
|
9917
|
+
)" || return 1
|
|
9918
|
+
[[ "$recorded_reconciliation_guard" =~ ^[0-9a-f]{64}$ \
|
|
9919
|
+
&& "$current_reconciliation_guard" == "$recorded_reconciliation_guard" \
|
|
9920
|
+
&& "$recorded_lock_identity" =~ ^[0-9a-f]{64}$ \
|
|
9921
|
+
&& "$current_lock_identity" =~ ^[0-9a-f]{64}$ \
|
|
9922
|
+
&& "$current_lock_identity" != "$recorded_lock_identity" ]] || return 1
|
|
9923
|
+
|
|
9924
|
+
recorded_dependency_guard="$(fmix_read_state "$dependency_stamp" source_guard)"
|
|
9925
|
+
current_dependency_guard="$(fmix_dependency_source_guard "$real")" \
|
|
9926
|
+
|| return 1
|
|
9927
|
+
[[ -n "$recorded_dependency_guard" \
|
|
9928
|
+
&& "$recorded_dependency_guard" == "$current_dependency_guard" ]] \
|
|
9929
|
+
|| return 1
|
|
9930
|
+
recorded_manifest_guard="$(fmix_read_state "$compile_stamp" manifest_guard)"
|
|
9931
|
+
current_manifest_guard="$(fmix_compile_manifest_guard "$real")" \
|
|
9932
|
+
|| return 1
|
|
9933
|
+
[[ -n "$recorded_manifest_guard" \
|
|
9934
|
+
&& "$recorded_manifest_guard" == "$current_manifest_guard" ]] \
|
|
9935
|
+
|| return 1
|
|
9936
|
+
|
|
9937
|
+
# Move the cheap metadata first. Dependency installation is transactional;
|
|
9938
|
+
# if preparation rejects the candidate, restore the old key and leave the
|
|
9939
|
+
# prior session claims untouched.
|
|
9940
|
+
fmix_update_worktree_template_key \
|
|
9941
|
+
"$real" "$recorded_key" "$template_key" || return 1
|
|
9942
|
+
fmix_prepare_dependency_artifacts "$real" || preparation_rc=$?
|
|
9943
|
+
if (( preparation_rc != 0 )); then
|
|
9944
|
+
fmix_update_worktree_template_key \
|
|
9945
|
+
"$real" "$template_key" "$recorded_key" >/dev/null 2>&1 || true
|
|
9946
|
+
return "$preparation_rc"
|
|
9947
|
+
fi
|
|
9948
|
+
|
|
9949
|
+
if ! fmix_dependency_stamp_matches "$real" "$current_dependency"; then
|
|
9950
|
+
# No exact artifact was installed (an ancestor artifact may already
|
|
9951
|
+
# have replaced the dependency tree). Remove both exact claims so the
|
|
9952
|
+
# next compile resolves and incrementally repairs this retained build.
|
|
9953
|
+
rm -f "$dependency_stamp" "$compile_stamp" || return 1
|
|
9954
|
+
fi
|
|
9955
|
+
[[ -d "$deps_root" && -d "$build_root" \
|
|
9956
|
+
&& -d "$app_ebin" \
|
|
9957
|
+
&& -n "$(find "$app_ebin" -maxdepth 1 -type f -name '*.beam' -print -quit 2>/dev/null)" \
|
|
9958
|
+
&& "$(fmix_read_state "$key_state_file" template_key)" == "$template_key" ]] \
|
|
9959
|
+
|| return 1
|
|
9960
|
+
fmix_info "Same-toolchain dependency change retained the proven app build for incremental reconciliation."
|
|
9961
|
+
return 0
|
|
9962
|
+
}
|
|
9963
|
+
|
|
9376
9964
|
fmix_adopt_compatible_worktree_artifacts() {
|
|
9377
9965
|
local worktree="$1" recorded_key="$2" template_key="$3"
|
|
9378
9966
|
local real state_file artifact_state_file key_state_file
|
|
@@ -10482,6 +11070,107 @@ fmix_ensure_chromium() {
|
|
|
10482
11070
|
# cmd: fmix test
|
|
10483
11071
|
# ---------------------------------------------------------------------------
|
|
10484
11072
|
|
|
11073
|
+
fmix_validate_test_targets() {
|
|
11074
|
+
# Mix silently drops nonexistent selections when another file runs. Admit
|
|
11075
|
+
# every positional path before home/session/setup effects, without treating
|
|
11076
|
+
# Mix option values (tags, regexes, formatters, numbers) as file selections.
|
|
11077
|
+
local worktree="$1"
|
|
11078
|
+
shift
|
|
11079
|
+
local selection option boolean_name target prefix remaining part resolved
|
|
11080
|
+
local positional_only=0 takes_value=0
|
|
11081
|
+
while (( $# > 0 )); do
|
|
11082
|
+
selection="$1"
|
|
11083
|
+
shift
|
|
11084
|
+
if (( positional_only == 0 )); then
|
|
11085
|
+
takes_value=0
|
|
11086
|
+
option="${selection%%=*}"
|
|
11087
|
+
case "$option" in
|
|
11088
|
+
--)
|
|
11089
|
+
if [[ "$selection" == "--" ]]; then
|
|
11090
|
+
positional_only=1
|
|
11091
|
+
continue
|
|
11092
|
+
fi
|
|
11093
|
+
fmix_error "Unsupported or ambiguous Mix test option: $option. Target admission supports documented mix test options only; use -- before a literal positional selection."
|
|
11094
|
+
return 2
|
|
11095
|
+
;;
|
|
11096
|
+
--include|--exclude|--only|--formatter|--name-pattern|--export-coverage|--profile-require|--max-cases|--max-failures|--max-requires|--seed|--timeout|--slowest|--slowest-modules|--partitions|--exit-status|--repeat-until-failure)
|
|
11097
|
+
takes_value=1
|
|
11098
|
+
;;
|
|
11099
|
+
--*)
|
|
11100
|
+
boolean_name="${option#--}"
|
|
11101
|
+
boolean_name="${boolean_name#no-}"
|
|
11102
|
+
case "$boolean_name" in
|
|
11103
|
+
all-warnings|breakpoints|force|color|cover|trace|compile|start|raise|deps-check|archives-check|elixir-version-check|failed|stale|listen-on-stdin|preload-modules|warnings-as-errors|dry-run)
|
|
11104
|
+
continue
|
|
11105
|
+
;;
|
|
11106
|
+
*)
|
|
11107
|
+
fmix_error "Unsupported or ambiguous Mix test option: $option. Target admission supports documented mix test options only; use -- before a literal positional selection."
|
|
11108
|
+
return 2
|
|
11109
|
+
;;
|
|
11110
|
+
esac
|
|
11111
|
+
;;
|
|
11112
|
+
-*)
|
|
11113
|
+
# Mix's only short aliases are -b (boolean) and -n
|
|
11114
|
+
# (regex). A cluster ending in -n also consumes a value;
|
|
11115
|
+
# a numeric suffix is an attached value, as in -n2pattern.
|
|
11116
|
+
if [[ "$option" =~ ^-b*n$ ]]; then
|
|
11117
|
+
takes_value=1
|
|
11118
|
+
elif [[ "$option" =~ ^-b+$ || "$option" =~ ^-b*n[0-9][^-_]*$ ]]; then
|
|
11119
|
+
continue
|
|
11120
|
+
elif [[ "$selection" != "-" && "$selection" != "- "* \
|
|
11121
|
+
&& ! ( "$selection" =~ ^-[0-9] && "$selection" != *=* ) ]]; then
|
|
11122
|
+
fmix_error "Unsupported or ambiguous Mix test option: $option. Target admission supports documented mix test options only; use -- before a literal positional selection."
|
|
11123
|
+
return 2
|
|
11124
|
+
fi
|
|
11125
|
+
;;
|
|
11126
|
+
esac
|
|
11127
|
+
if (( takes_value == 1 )); then
|
|
11128
|
+
[[ "$selection" == "$option" ]] || continue
|
|
11129
|
+
# Match OptionParser: another switch is not a value, but a
|
|
11130
|
+
# negative number, lone '-' or '- ' prefix can be one. Refuse
|
|
11131
|
+
# unknown arity before effects; leave value/type validation to
|
|
11132
|
+
# Mix rather than implementing another full option parser.
|
|
11133
|
+
if (( $# > 0 )) && { [[ "$1" != -* || "$1" == "-" || "$1" == "- "* ]] \
|
|
11134
|
+
|| [[ "$1" =~ ^-[0-9] ]]; }; then
|
|
11135
|
+
shift
|
|
11136
|
+
else
|
|
11137
|
+
fmix_error "Mix test option requires a value: $option."
|
|
11138
|
+
return 2
|
|
11139
|
+
fi
|
|
11140
|
+
continue
|
|
11141
|
+
fi
|
|
11142
|
+
fi
|
|
11143
|
+
if [[ -z "$selection" ]]; then
|
|
11144
|
+
fmix_error "Invalid test target: empty positional selection."
|
|
11145
|
+
return 2
|
|
11146
|
+
fi
|
|
11147
|
+
# ExUnit treats the first positive numeric colon component as the
|
|
11148
|
+
# location boundary (including multiple lines and +/leading-zero forms).
|
|
11149
|
+
# Colons before that boundary remain part of the filename.
|
|
11150
|
+
target="$selection"
|
|
11151
|
+
prefix="${selection%%:*}"
|
|
11152
|
+
remaining="$selection"
|
|
11153
|
+
while [[ "$remaining" == *:* ]]; do
|
|
11154
|
+
remaining="${remaining#*:}"
|
|
11155
|
+
part="${remaining%%:*}"
|
|
11156
|
+
if [[ "$part" =~ ^[+]?0*[1-9][0-9]*$ ]]; then
|
|
11157
|
+
target="$prefix"
|
|
11158
|
+
break
|
|
11159
|
+
fi
|
|
11160
|
+
prefix="$prefix:$part"
|
|
11161
|
+
done
|
|
11162
|
+
case "$target" in
|
|
11163
|
+
/*) resolved="$target" ;;
|
|
11164
|
+
*) resolved="$worktree/$target" ;;
|
|
11165
|
+
esac
|
|
11166
|
+
if [[ -z "$target" || ! -f "$resolved" && ! -d "$resolved" ]]; then
|
|
11167
|
+
fmix_error "Missing or non-regular test target: $selection (resolved path: $resolved)."
|
|
11168
|
+
return 2
|
|
11169
|
+
fi
|
|
11170
|
+
done
|
|
11171
|
+
return 0
|
|
11172
|
+
}
|
|
11173
|
+
|
|
10485
11174
|
cmd_test() {
|
|
10486
11175
|
local run_mode="${FMIX_INTERNAL_RUN_MODE:-test}"
|
|
10487
11176
|
local worktree_arg="auto"
|
|
@@ -10652,6 +11341,15 @@ cmd_test() {
|
|
|
10652
11341
|
fi
|
|
10653
11342
|
fi
|
|
10654
11343
|
|
|
11344
|
+
local worktree real_worktree
|
|
11345
|
+
worktree="$(fmix_find_worktree "$worktree_arg" readonly)" || return 1
|
|
11346
|
+
real_worktree="$(fmix_realpath "$worktree")" || return 1
|
|
11347
|
+
if (( mix_args_present == 1 )); then
|
|
11348
|
+
fmix_validate_test_targets "$real_worktree" "${mix_args[@]}" || return $?
|
|
11349
|
+
fi
|
|
11350
|
+
|
|
11351
|
+
# main defers all mutable test/coverage preparation until admission passes.
|
|
11352
|
+
fmix_prepare_command_home || return 1
|
|
10655
11353
|
fmix_run_telemetry_begin "$run_mode"
|
|
10656
11354
|
|
|
10657
11355
|
if (( isolate_mode == 1 )); then
|
|
@@ -10664,13 +11362,12 @@ cmd_test() {
|
|
|
10664
11362
|
fi
|
|
10665
11363
|
fi
|
|
10666
11364
|
|
|
10667
|
-
|
|
10668
|
-
|
|
11365
|
+
# Initialize/verify this same candidate only after target admission. This
|
|
11366
|
+
# retains cold submodule bootstrap and the normal no-target default.
|
|
11367
|
+
worktree="$(fmix_find_worktree "$real_worktree")" || {
|
|
10669
11368
|
fmix_run_telemetry_finish 1
|
|
10670
11369
|
return 1
|
|
10671
11370
|
}
|
|
10672
|
-
local real_worktree
|
|
10673
|
-
real_worktree="$(fmix_realpath "$worktree")"
|
|
10674
11371
|
fmix_activate_toolchain "$real_worktree" || {
|
|
10675
11372
|
fmix_run_telemetry_finish 1
|
|
10676
11373
|
return 1
|
|
@@ -12997,15 +13694,22 @@ cmd_self_test() {
|
|
|
12997
13694
|
# Also cover a top-level cisco-cdr submodule that has not materialized its
|
|
12998
13695
|
# mix.exs yet. The mocked update creates the checkout while keeping every
|
|
12999
13696
|
# initialization diagnostic off command-substitution stdout.
|
|
13000
|
-
local submodule_parent top_level_wt top_level_stderr top_level_stdout
|
|
13697
|
+
local submodule_parent top_level_wt top_level_stderr top_level_stdout top_level_fixture_sha
|
|
13001
13698
|
submodule_parent="$(mktemp -d)"
|
|
13002
13699
|
submodule_parent="$(fmix_realpath "$submodule_parent")"
|
|
13003
13700
|
top_level_wt="$submodule_parent/cisco-cdr"
|
|
13004
13701
|
top_level_stderr="$(mktemp)"
|
|
13005
13702
|
git init -q "$submodule_parent"
|
|
13006
13703
|
mkdir -p "$top_level_wt"
|
|
13007
|
-
printf '[submodule "cisco-cdr"]\n\tpath = cisco-cdr\n\turl = https://
|
|
13704
|
+
printf '[submodule "cisco-cdr"]\n\tpath = cisco-cdr\n\turl = https://github.com/calltelemetry/cisco-cdr.git\n' \
|
|
13008
13705
|
>"$submodule_parent/.gitmodules"
|
|
13706
|
+
git -C "$submodule_parent" -c user.name=fmix-self-test \
|
|
13707
|
+
-c user.email=fmix-self-test@example.invalid -c commit.gpgsign=false \
|
|
13708
|
+
commit --allow-empty -qm 'owned cold Gitlink fixture'
|
|
13709
|
+
top_level_fixture_sha="$(git -C "$submodule_parent" rev-parse HEAD)"
|
|
13710
|
+
git -C "$submodule_parent" add .gitmodules
|
|
13711
|
+
git -C "$submodule_parent" update-index --add --cacheinfo \
|
|
13712
|
+
"160000,$top_level_fixture_sha,cisco-cdr"
|
|
13009
13713
|
if top_level_stdout="$({
|
|
13010
13714
|
git() {
|
|
13011
13715
|
if [[ " $* " == *" submodule update --init --recursive "* ]]; then
|
|
@@ -15804,6 +16508,197 @@ EOF
|
|
|
15804
16508
|
fmix_update_worktree_template_key \
|
|
15805
16509
|
"$compile_root" "$legacy_template_key" "$current_template_key"
|
|
15806
16510
|
|
|
16511
|
+
if command -v elixir >/dev/null 2>&1; then
|
|
16512
|
+
local dep_change_old_key dep_change_new_key dep_change_output dep_change_log dep_change_rc=0
|
|
16513
|
+
local dep_change_saved_env="${FMIX_SELF_TEST_DEP_TOKEN-__unset__}"
|
|
16514
|
+
local dep_change_saved_active="${FMIX_ACTIVE_SESSION_ROOT-__unset__}"
|
|
16515
|
+
local dep_change_saved_deps="${MIX_DEPS_PATH-__unset__}"
|
|
16516
|
+
local dep_change_saved_build="${MIX_BUILD_PATH-__unset__}"
|
|
16517
|
+
FMIX_ACTIVE_SESSION_ROOT="$compile_root"
|
|
16518
|
+
MIX_DEPS_PATH="$compile_root/deps"
|
|
16519
|
+
MIX_BUILD_PATH="$compile_root/_build/test"
|
|
16520
|
+
FMIX_SELF_TEST_DEP_TOKEN="stable"
|
|
16521
|
+
cp "$compile_root/mix.exs" "$compile_root/mix.exs.dependency-change-fixture"
|
|
16522
|
+
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' \
|
|
16523
|
+
>"$compile_root/mix.exs"
|
|
16524
|
+
mkdir -p "$compile_root/vendor/reconciliation-fixture"
|
|
16525
|
+
printf 'stable vendor input\n' \
|
|
16526
|
+
>"$compile_root/vendor/reconciliation-fixture/input.txt"
|
|
16527
|
+
printf 'lock\n' >"$compile_root/mix.lock"
|
|
16528
|
+
dep_change_old_key="$(fmix_compute_template_key "$compile_root")"
|
|
16529
|
+
dep_before="$(fmix_compute_dependency_fingerprint "$compile_root")"
|
|
16530
|
+
fp_before="$(fmix_compute_compile_fingerprint "$compile_root")"
|
|
16531
|
+
fmix_write_dependency_stamp "$compile_root" "$dep_before"
|
|
16532
|
+
fmix_write_compile_stamp "$compile_root" "$fp_before"
|
|
16533
|
+
fmix_write_artifact_state "$compile_root" "$dep_change_old_key"
|
|
16534
|
+
sed 's/~> 1\.0/~> 1.1/' "$compile_root/mix.exs" \
|
|
16535
|
+
>"$compile_home/dependency-change-mix.exs"
|
|
16536
|
+
mv "$compile_home/dependency-change-mix.exs" "$compile_root/mix.exs"
|
|
16537
|
+
printf 'lock with one stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16538
|
+
dep_change_new_key="$(fmix_compute_template_key "$compile_root")"
|
|
16539
|
+
dep_change_log="$compile_home/dependency-change-reconcile.log"
|
|
16540
|
+
fmix_ensure_artifacts "$compile_root" "$dep_change_new_key" 0 \
|
|
16541
|
+
>"$dep_change_log" 2>&1 || dep_change_rc=$?
|
|
16542
|
+
dep_change_output="$(cat "$dep_change_log")"
|
|
16543
|
+
if (( dep_change_rc == 0 )) \
|
|
16544
|
+
&& [[ "$dep_change_old_key" != "$dep_change_new_key" ]] \
|
|
16545
|
+
&& [[ "$FMIX_LAST_ARTIFACTS_OUTCOME" == "dependency_reconcile" ]] \
|
|
16546
|
+
&& [[ "$(fmix_read_state "$compile_root/artifact-state.json" template_key)" \
|
|
16547
|
+
== "$dep_change_new_key" ]] \
|
|
16548
|
+
&& [[ -f "$compile_root/_build/test/lib/cdrcisco/ebin/Elixir.Demo.beam" ]] \
|
|
16549
|
+
&& [[ ! -e "$compile_root/dependency-stamp.json" \
|
|
16550
|
+
&& ! -e "$compile_root/compile-stamp.json" ]] \
|
|
16551
|
+
&& [[ "$dep_change_output" == *"preserving the app cache for incremental compile"* ]]; then
|
|
16552
|
+
st_pass "same-toolchain dependency change remains a cache hit and preserves the app build"
|
|
16553
|
+
else
|
|
16554
|
+
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'/, })"
|
|
16555
|
+
fi
|
|
16556
|
+
|
|
16557
|
+
eval "$(declare -f fmix_run_deps_get | sed '1s/fmix_run_deps_get/fmix_run_deps_get_dependency_change_orig/')"
|
|
16558
|
+
eval "$(declare -f fmix_run_compile_streamed | sed '1s/fmix_run_compile_streamed/fmix_run_compile_streamed_dependency_change_orig/')"
|
|
16559
|
+
local dep_change_deps_marker="$compile_home/dependency-change-deps-get"
|
|
16560
|
+
local dep_change_compile_marker="$compile_home/dependency-change-compile"
|
|
16561
|
+
local dep_change_compile_rc=0
|
|
16562
|
+
fmix_run_deps_get() {
|
|
16563
|
+
: >"$dep_change_deps_marker"
|
|
16564
|
+
return 0
|
|
16565
|
+
}
|
|
16566
|
+
fmix_run_compile_streamed() {
|
|
16567
|
+
local dependency_change_log="$4"
|
|
16568
|
+
[[ -f "$compile_root/_build/test/lib/cdrcisco/ebin/Elixir.Demo.beam" ]] \
|
|
16569
|
+
|| return 1
|
|
16570
|
+
printf 'Compiling 12 files (.ex)\n' >"$dependency_change_log"
|
|
16571
|
+
: >"$dep_change_compile_marker"
|
|
16572
|
+
return 0
|
|
16573
|
+
}
|
|
16574
|
+
fmix_ensure_compile "$compile_root" demo \
|
|
16575
|
+
>/dev/null 2>&1 || dep_change_compile_rc=$?
|
|
16576
|
+
if (( dep_change_compile_rc == 0 )) \
|
|
16577
|
+
&& [[ -f "$dep_change_deps_marker" && -f "$dep_change_compile_marker" ]] \
|
|
16578
|
+
&& [[ "$FMIX_LAST_COMPILE_OUTCOME" == "incremental" \
|
|
16579
|
+
&& "$FMIX_LAST_COMPILE_FILES" == "12" ]] \
|
|
16580
|
+
&& [[ "$FMIX_LAST_ARTIFACTS_OUTCOME" == "dependency_reconcile" ]] \
|
|
16581
|
+
&& fmix_dependency_stamp_matches \
|
|
16582
|
+
"$compile_root" "$(fmix_compute_dependency_fingerprint "$compile_root")" \
|
|
16583
|
+
&& fmix_compile_stamp_matches \
|
|
16584
|
+
"$compile_root" "$(fmix_compute_compile_fingerprint "$compile_root")"; then
|
|
16585
|
+
st_pass "dependency cache hit performs deps reconciliation and a bounded incremental compile"
|
|
16586
|
+
else
|
|
16587
|
+
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:-})"
|
|
16588
|
+
fi
|
|
16589
|
+
eval "$(declare -f fmix_run_deps_get_dependency_change_orig | sed '1s/fmix_run_deps_get_dependency_change_orig/fmix_run_deps_get/')"
|
|
16590
|
+
eval "$(declare -f fmix_run_compile_streamed_dependency_change_orig | sed '1s/fmix_run_compile_streamed_dependency_change_orig/fmix_run_compile_streamed/')"
|
|
16591
|
+
|
|
16592
|
+
# Only mix.lock may vary across this special cache-hit transition. A
|
|
16593
|
+
# simultaneous dependency-input change must fail the reconciliation proof
|
|
16594
|
+
# before it advances metadata or clears stamps.
|
|
16595
|
+
dep_change_old_key="$dep_change_new_key"
|
|
16596
|
+
cp "$compile_root/mix.exs" "$compile_home/reconciliation-mix.exs"
|
|
16597
|
+
printf 'lock with a second stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16598
|
+
sed 's/version: "0\.1\.0"/version: "0.2.0"/' "$compile_root/mix.exs" \
|
|
16599
|
+
>"$compile_home/reconciliation-app-setting.exs"
|
|
16600
|
+
mv "$compile_home/reconciliation-app-setting.exs" "$compile_root/mix.exs"
|
|
16601
|
+
dep_change_new_key="$(fmix_compute_template_key "$compile_root")"
|
|
16602
|
+
if ! fmix_reconcile_same_toolchain_dependency_change \
|
|
16603
|
+
"$compile_root" "$dep_change_old_key" "$dep_change_new_key" \
|
|
16604
|
+
>/dev/null 2>&1 \
|
|
16605
|
+
&& [[ "$(fmix_read_state "$compile_root/artifact-state.json" template_key)" \
|
|
16606
|
+
== "$dep_change_old_key" ]] \
|
|
16607
|
+
&& [[ -f "$compile_root/dependency-stamp.json" \
|
|
16608
|
+
&& -f "$compile_root/compile-stamp.json" ]]; then
|
|
16609
|
+
st_pass "dependency reconciliation rejects a simultaneous mix.exs app-setting change"
|
|
16610
|
+
else
|
|
16611
|
+
st_fail "dependency reconciliation admitted a simultaneous mix.exs app-setting change"
|
|
16612
|
+
fi
|
|
16613
|
+
mv "$compile_home/reconciliation-mix.exs" "$compile_root/mix.exs"
|
|
16614
|
+
printf 'lock with one stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16615
|
+
|
|
16616
|
+
printf 'lock with a third stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16617
|
+
printf 'changed vendor input\n' \
|
|
16618
|
+
>"$compile_root/vendor/reconciliation-fixture/input.txt"
|
|
16619
|
+
dep_change_new_key="$(fmix_compute_template_key "$compile_root")"
|
|
16620
|
+
if ! fmix_reconcile_same_toolchain_dependency_change \
|
|
16621
|
+
"$compile_root" "$dep_change_old_key" "$dep_change_new_key" \
|
|
16622
|
+
>/dev/null 2>&1 \
|
|
16623
|
+
&& [[ "$(fmix_read_state "$compile_root/artifact-state.json" template_key)" \
|
|
16624
|
+
== "$dep_change_old_key" ]] \
|
|
16625
|
+
&& [[ -f "$compile_root/dependency-stamp.json" \
|
|
16626
|
+
&& -f "$compile_root/compile-stamp.json" ]]; then
|
|
16627
|
+
st_pass "dependency reconciliation rejects a simultaneous vendor change"
|
|
16628
|
+
else
|
|
16629
|
+
st_fail "dependency reconciliation admitted a simultaneous vendor change"
|
|
16630
|
+
fi
|
|
16631
|
+
printf 'stable vendor input\n' \
|
|
16632
|
+
>"$compile_root/vendor/reconciliation-fixture/input.txt"
|
|
16633
|
+
printf 'lock with one stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16634
|
+
|
|
16635
|
+
printf 'lock with a fourth stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16636
|
+
FMIX_SELF_TEST_DEP_TOKEN="changed"
|
|
16637
|
+
dep_change_new_key="$(fmix_compute_template_key "$compile_root")"
|
|
16638
|
+
if ! fmix_reconcile_same_toolchain_dependency_change \
|
|
16639
|
+
"$compile_root" "$dep_change_old_key" "$dep_change_new_key" \
|
|
16640
|
+
>/dev/null 2>&1 \
|
|
16641
|
+
&& [[ "$(fmix_read_state "$compile_root/artifact-state.json" template_key)" \
|
|
16642
|
+
== "$dep_change_old_key" ]] \
|
|
16643
|
+
&& [[ -f "$compile_root/dependency-stamp.json" \
|
|
16644
|
+
&& -f "$compile_root/compile-stamp.json" ]]; then
|
|
16645
|
+
st_pass "dependency reconciliation rejects a dependency environment change"
|
|
16646
|
+
else
|
|
16647
|
+
st_fail "dependency reconciliation admitted a dependency environment change"
|
|
16648
|
+
fi
|
|
16649
|
+
FMIX_SELF_TEST_DEP_TOKEN="stable"
|
|
16650
|
+
printf 'lock with one stable dependency bump\n' >"$compile_root/mix.lock"
|
|
16651
|
+
|
|
16652
|
+
rm -f "$compile_root/artifact-state.json" \
|
|
16653
|
+
"$compile_root/dependency-stamp.json" "$compile_root/compile-stamp.json"
|
|
16654
|
+
mv "$compile_root/mix.exs.dependency-change-fixture" "$compile_root/mix.exs"
|
|
16655
|
+
rm -rf "$compile_root/vendor/reconciliation-fixture"
|
|
16656
|
+
printf 'lock\n' >"$compile_root/mix.lock"
|
|
16657
|
+
if [[ "$dep_change_saved_active" == "__unset__" ]]; then
|
|
16658
|
+
unset FMIX_ACTIVE_SESSION_ROOT
|
|
16659
|
+
else
|
|
16660
|
+
FMIX_ACTIVE_SESSION_ROOT="$dep_change_saved_active"
|
|
16661
|
+
fi
|
|
16662
|
+
if [[ "$dep_change_saved_deps" == "__unset__" ]]; then
|
|
16663
|
+
unset MIX_DEPS_PATH
|
|
16664
|
+
else
|
|
16665
|
+
MIX_DEPS_PATH="$dep_change_saved_deps"
|
|
16666
|
+
fi
|
|
16667
|
+
if [[ "$dep_change_saved_build" == "__unset__" ]]; then
|
|
16668
|
+
unset MIX_BUILD_PATH
|
|
16669
|
+
else
|
|
16670
|
+
MIX_BUILD_PATH="$dep_change_saved_build"
|
|
16671
|
+
fi
|
|
16672
|
+
if [[ "$dep_change_saved_env" == "__unset__" ]]; then
|
|
16673
|
+
unset FMIX_SELF_TEST_DEP_TOKEN
|
|
16674
|
+
else
|
|
16675
|
+
FMIX_SELF_TEST_DEP_TOKEN="$dep_change_saved_env"
|
|
16676
|
+
fi
|
|
16677
|
+
else
|
|
16678
|
+
# The portable pre-toolchain stamp path deliberately binds all of
|
|
16679
|
+
# mix.exs. It may round-trip metadata, but cannot authorize the narrower
|
|
16680
|
+
# dependency-body exception without Elixir's AST parser.
|
|
16681
|
+
local raw_guard_before raw_guard_after
|
|
16682
|
+
cp "$compile_root/mix.exs" "$compile_home/raw-guard-mix.exs"
|
|
16683
|
+
raw_guard_before="$(
|
|
16684
|
+
fmix_compute_mix_project_reconciliation_guard "$compile_root"
|
|
16685
|
+
)"
|
|
16686
|
+
printf '\n# dependency declaration changed before toolchain activation\n' \
|
|
16687
|
+
>>"$compile_root/mix.exs"
|
|
16688
|
+
raw_guard_after="$(
|
|
16689
|
+
fmix_compute_mix_project_reconciliation_guard "$compile_root"
|
|
16690
|
+
)"
|
|
16691
|
+
mv "$compile_home/raw-guard-mix.exs" "$compile_root/mix.exs"
|
|
16692
|
+
if [[ "$raw_guard_before" =~ ^[0-9a-f]{64}$ \
|
|
16693
|
+
&& "$raw_guard_after" =~ ^[0-9a-f]{64}$ \
|
|
16694
|
+
&& "$raw_guard_before" != "$raw_guard_after" ]]; then
|
|
16695
|
+
st_pass "portable raw project guard fails closed before Elixir activation"
|
|
16696
|
+
else
|
|
16697
|
+
st_fail "portable raw project guard authorized a mix.exs change"
|
|
16698
|
+
fi
|
|
16699
|
+
st_skip "dependency-only reconciliation exercise requires an active Elixir AST parser"
|
|
16700
|
+
fi
|
|
16701
|
+
|
|
15807
16702
|
dep_before="$(fmix_compute_dependency_fingerprint "$compile_root")"
|
|
15808
16703
|
|
|
15809
16704
|
eval "$(declare -f fmix_run_deps_get | sed '1s/fmix_run_deps_get/fmix_run_deps_get_repair_orig/')"
|
|
@@ -19525,11 +20420,7 @@ fmix_observability_validate_worker_capability() {
|
|
|
19525
20420
|
|
|
19526
20421
|
main() {
|
|
19527
20422
|
if (( $# == 0 )); then
|
|
19528
|
-
|
|
19529
|
-
mkdir -p "$FMIX_HOME"/{templates,template-access,dependency-artifacts,dependency-artifact-access,sessions,worktrees,db-index,compile-stamps,dependency-stamps,locks,lock-kernel,lock-metadata,logs,quarantine} \
|
|
19530
|
-
|| return 1
|
|
19531
|
-
fmix_prepare_session_state_root || return 1
|
|
19532
|
-
chmod 0700 "$FMIX_HOME" 2>/dev/null || true
|
|
20423
|
+
fmix_prepare_command_home || return 1
|
|
19533
20424
|
fmix_usage
|
|
19534
20425
|
return 0
|
|
19535
20426
|
fi
|
|
@@ -19568,12 +20459,8 @@ main() {
|
|
|
19568
20459
|
|
|
19569
20460
|
if [[ "$cmd" == "cache" ]]; then
|
|
19570
20461
|
fmix_prepare_home_readonly || return 1
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
mkdir -p "$FMIX_HOME"/{templates,template-access,dependency-artifacts,dependency-artifact-access,sessions,worktrees,db-index,compile-stamps,dependency-stamps,locks,lock-kernel,lock-metadata,logs,quarantine} \
|
|
19574
|
-
|| return 1
|
|
19575
|
-
fmix_prepare_session_state_root || return 1
|
|
19576
|
-
chmod 0700 "$FMIX_HOME" 2>/dev/null || true
|
|
20462
|
+
elif [[ "$cmd" != "test" && "$cmd" != "coverage" ]]; then
|
|
20463
|
+
fmix_prepare_command_home || return 1
|
|
19577
20464
|
fi
|
|
19578
20465
|
|
|
19579
20466
|
case "$cmd" in
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calltelemetry/fmix",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.9",
|
|
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": "67794255e5093d508bc36af1c8d3ad932d7f392624f44e96660d62379edfe9f5",
|
|
30
|
+
"sourceTag": "fmix-v2.7.9"
|
|
31
31
|
}
|
|
32
32
|
}
|