review fixes: safe reload warnings, idiomatic @field, range-check guard, e2e FIFO assert
CI / test (pull_request) Successful in 3m20s

- reloadConfig: use a local ArrayList per reload instead of the shared
  ctx.config_deprecations — the previous approach could reallocate the
  backing array into the short-lived reload arena, causing use-after-free
  on successive reloads when warning counts grew between reloads
- fromDoc: replace unsafe @ptrFromInt/@offsetOf arithmetic with &@field,
  which is idiomatic Zig and carries no extra risk; remove the incorrect
  comment claiming @field materialises a copy
- problems(): fix the out.items.len == 0 range-check guard to count only
  non-warning (error) items so a deprecated setting no longer suppresses
  the range check for the rest of the document; add regression test
- deprecations now typed as []Problem throughout (env-var warnings carry
  key/message/is_warning like file-level ones) so callers have full context
- e2e: assert b1 never leaves QUEUED while a1 is running (true FIFO check)
- sections table shared by fromDoc and checkDoc eliminates drift risk
  between the two section lists; problemNodes refactored to ArrayList
  single-pass; isDeprecatedKey inlined; isDeprecatedEnvName comment added

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel SamsonandClaude Sonnet 4.6 committed 2026-11-12 14:38:30 +00:00
1 parent 18c77a6e96
commit 6325a87670
4 files changed
+140 -71

No files matched your search

+13
View File
@@ -98,6 +98,19 @@ out=$(Z run -o json sleep 3); a1=$(json_field id "$out")
wait_state "$a1" RUNNING && pass "serial: first job is running" || fail "serial: first job is running"
out=$(Z run -o json sleep 1); b1=$(json_field id "$out")
contains "serial: second job stays queued" '"state" : "QUEUED"' "$out"
# The checks above would still pass if the scheduler ran both jobs concurrently
# (sleep 3 always finishes before sleep 1 started after it could catch up). Assert the
# defining FIFO invariant directly: b1 never leaves QUEUED while a1 is running.
exclusive=1
last=""
for i in 1 2 3 4 5 6 7 8 9 10 11 12; do
st_a=$(json_field state "$(Z describe -o json "$a1" --offline)")
[[ $st_a == "running" ]] || break
last=$(json_field state "$(Z describe -o json "$b1" --offline)")
[[ $last == "queued" ]] || exclusive=0
sleep 0.3
done
[[ $exclusive -eq 1 ]] && pass "serial: second job never runs while the first runs" || fail "serial: second job never runs while the first runs (state: $last)"
wait_state "$a1" SUCCEEDED && pass "serial: first job finishes first" || fail "serial: first job finishes first"
wait_state "$b1" SUCCEEDED && pass "serial: second job finishes second" || fail "serial: second job finishes second"