Skip to content

fix(run): refuse a multi-arg non-starmap warm unit instead of silently NameError'ing (calque#187) - #188

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/calque-187-arity-guard
Aug 15, 2026
Merged

fix(run): refuse a multi-arg non-starmap warm unit instead of silently NameError'ing (calque#187)#188
scttfrdmn merged 1 commit into
mainfrom
fix/calque-187-arity-guard

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Summary

  • Found while re-verifying calque#79's closing claim that AI-Almanac's three real scripts run end-to-end against calque v0.6.0: a picked warm unit with 2+ non-self/cls positional args that isn't .starmap()'d silently NameError'd on every synthetic item, since dryRunWarm/manifestBodyForUnit only ever bind the FIRST positional arg outside the .starmap() splat path.
  • Real-world hit: forecasts_app.py's run_forecast_inference(job_id, model_id, config) is invoked via .spawn(), not .map()/.starmap()checkInvokeSupport had no arity check for anything besides InvokeStarmap/InvokeForEach, so this fell through silently.
  • checkInvokeSupport now refuses loudly with a clear message naming the function, its arg count/names, and pointing at calque#187, instead of a confusing downstream NameError.
  • Critical carve-out: calque real --arg-file/--arg-json already solves this correctly for a real run when the caller supplies a real per-position tuple (e.g. app.py's run_benchmark_local, calque#178's real-hardware-verified path, invoked via .remote() with 4 args) — a blanket refusal would have broken that already-working, already-verified case. Added a hasRealArgTuple param to checkInvokeSupport, threaded through only at realrun.go's own call site (forceStarmap), so that path is unaffected.

Files touched

  • cmd/calque/run.gocheckInvokeSupport's new arity guard + hasRealArgTuple param.
  • cmd/calque/realrun.go — passes forceStarmap (true when --arg-file/--arg-json supplied a real tuple).
  • cmd/calque/fleetrun.go — passes false (fleet has no --arg-file equivalent).
  • cmd/calque/gate_test.go — updated existing call sites, new tests (TestCheckInvokeSupportMultiArgNonStarmapRefuses, TestCheckInvokeSupportMultiArgWithRealArgTupleFine, TestCheckInvokeSupportSingleArgNonStarmapFine).
  • cmd/calque/starmap_e2e_test.go — updated call site.
  • CHANGELOG.md.

Test plan

  • go build ./... && go vet ./... && gofmt -l . && go test -count=1 ./... — all pass
  • golangci-lint run ./... — 0 issues
  • ruff check . — all checks passed
  • Manually re-verified against fresh clones of all three real AI-Almanac scripts:
    • forecasts_app.py / blending_app.py now refuse honestly and immediately (previously crashed 50x on an unrelated missing-import/missing-secret error before ever reaching the unbound-arg bug)
    • app.py's dry-run path (no --arg-file) now also correctly refuses run_benchmark's 3-arg signature (previously masked by an earlier SERVICE_ACCOUNT_JSON KeyError crash)
    • Confirmed the carve-out doesn't regress calque#178's real-hardware-verified run_benchmark_local path (new regression test TestCheckInvokeSupportMultiArgWithRealArgTupleFine)

…y NameError'ing (calque#187)

Found while re-verifying calque#79's closing claim that AI-Almanac's three
real scripts run end-to-end on calque v0.6.0: a picked warm unit with 2+
non-self/cls positional args that isn't .starmap()'d (e.g. a
.spawn()-invoked function like forecasts_app.py's
run_forecast_inference(job_id, model_id, config)) silently NameError'd on
every synthetic item, since the warm runner only ever binds the FIRST
positional arg outside the .starmap() splat path. checkInvokeSupport now
refuses loudly with an explanatory message instead.

--arg-file/--arg-json (a real, caller-supplied positional tuple) already
solves this for a real run when the caller supplies one -- e.g. app.py's
run_benchmark_local, calque#178's real-hardware-verified path -- so that
path explicitly bypasses the new arity guard via a hasRealArgTuple param,
threaded only through realrun.go's own call site.
@scttfrdmn
scttfrdmn merged commit 12c875b into main Aug 15, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the fix/calque-187-arity-guard branch August 15, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant