load levels: remove load levels from model, config, CLI, IPC, tests, docs
CI / test (pull_request) Successful in 3m20s

Completes issue #2 on top of the phase-1 strict single-job FIFO
scheduler. Removed:

- Job.load_level / Manifest.load_level / CreateOptions.load_level and
  the manifest.json loadLevel field (old manifests still parse: unknown
  fields are ignored)
- loadLevel in job JSON and <load_level> in XML output (field order
  shifts; old JSON still parses)
- the [load_levels] config section, service.max_concurrent_jobs,
  ZAG_LOAD_LEVELS_*/ZAG_LOADLEVELS_*/ZAG_SERVICE_MAX_CONCURRENT_JOBS
  env vars, loadlevel.zig / loadclass.zig and the default .load files

Friendly deprecation: old configs and environments still load fine.
config validate and config show report the removed settings as
non-fatal warnings (validate exit 1 stays reserved for real errors)
and the CLI/daemon logs them once at startup. --load-level is gone
from zag run; old IPC clients sending loadLevel are simply ignored.

e2e: wait_state is now portable to macOS bash 3.2 (it silently skipped
three checks before) and a serial-execution check asserts the second
job stays QUEUED while the first runs and both finish in FIFO order.
README and AGENTS.md document the deviation from barn.
This commit is contained in:
Daniel Samson committed 2026-11-12 10:07:30 +00:00
1 parent 8f3f61c86a
commit 4abc94f681
20 files changed
+250 -543

No files matched your search

+18 -4
View File
@@ -17,9 +17,11 @@ contains() { # contains <name> <needle> <haystack>
}
json_field() { printf '%s\n' "$2" | sed -n "s/.*\"$1\" : \"\{0,1\}\([^\",]*\)\"\{0,1\},\{0,1\}\$/\1/p" | head -1; }
wait_state() { # wait_state <id> <state> [seconds]
local i
# ${2,,} would work on bash >= 4, but macOS ships bash 3.2
local lower i
lower=$(printf '%s' "$2" | tr '[:upper:]' '[:lower:]')
for ((i = 0; i < ${3:-100}; i++)); do
[[ $(json_field state "$(Z describe -o json "$1" --offline)") == "${2,,}" ]] && return 0
[[ $(json_field state "$(Z describe -o json "$1" --offline)") == "$lower" ]] && return 0
sleep 0.1
done
return 1
@@ -48,12 +50,15 @@ contains "clean --all removes it" "Cleaned 1 job" "$(Z clean --offline --all)"
contains "status empty" "No jobs found." "$(Z status --offline)"
# --- config -----------------------------------------------------------------------------
contains "config show --defaults" "max_high_jobs = 2" "$(Z config show --defaults)"
contains "config show --defaults" "retry_backoff_multiplier = 2.0" "$(Z config show --defaults)"
printf '[jobs]\nmax_retries = 0\nbogus = 1\n' >"$DIR/bad.conf"
Z config validate --file "$DIR/bad.conf" >/dev/null 2>&1; [[ $? -eq 1 ]] && pass "validate flags bad config" || fail "validate flags bad config"
printf '[jobs]\nmax_retries = 0\n' >"$DIR/good.conf"
contains "validate accepts good config" "Configuration is valid" "$(Z config validate --file "$DIR/good.conf")"
contains "install --show prints files" "high.load" "$(Z config install --show)"
printf '[service]\nmax_concurrent_jobs = 4\n[load_levels]\nmax_high_jobs = 2\n' >"$DIR/deprecated.conf"
deprecated_out=$(Z config validate --file "$DIR/deprecated.conf" 2>&1); rc=$?
[[ $rc -eq 0 ]] && contains "validate warns on deprecated settings, exit 0" "deprecated" "$deprecated_out" || fail "validate warns on deprecated settings (rc=$rc)"
contains "install --show prints files" "zag.conf" "$(Z config install --show)"
# --- daemon -----------------------------------------------------------------------------
Z run echo hi >/dev/null 2>&1; [[ $? -eq 1 ]] && pass "run without service exits 1" || fail "run without service exits 1"
@@ -82,6 +87,15 @@ out=$(Z run -o json --timeout 1 sleep 30); tid=$(json_field id "$out")
sleep 3
contains "timeout fails the job" '"exitCode" : "timeout"' "$(Z describe -o json "$tid" --offline)"
# Strict single-job FIFO: while the first job runs, the second stays queued, and both
# finish in creation order.
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"
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"
contains "service reload" "Configuration reloaded" "$(Z service reload)"
contains "clean via IPC" "Cleaned" "$(Z clean --all --include-failed)"
contains "service stop" "Zag service stopped" "$(Z service stop)"