fix(run): refuse a multi-arg non-starmap warm unit instead of silently NameError'ing (calque#187) - #188
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.starmap()'d silentlyNameError'd on every synthetic item, sincedryRunWarm/manifestBodyForUnitonly ever bind the FIRST positional arg outside the.starmap()splat path.forecasts_app.py'srun_forecast_inference(job_id, model_id, config)is invoked via.spawn(), not.map()/.starmap()—checkInvokeSupporthad no arity check for anything besidesInvokeStarmap/InvokeForEach, so this fell through silently.checkInvokeSupportnow refuses loudly with a clear message naming the function, its arg count/names, and pointing at calque#187, instead of a confusing downstreamNameError.calque real --arg-file/--arg-jsonalready solves this correctly for a real run when the caller supplies a real per-position tuple (e.g.app.py'srun_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 ahasRealArgTupleparam tocheckInvokeSupport, threaded through only atrealrun.go's own call site (forceStarmap), so that path is unaffected.Files touched
cmd/calque/run.go—checkInvokeSupport's new arity guard +hasRealArgTupleparam.cmd/calque/realrun.go— passesforceStarmap(true when--arg-file/--arg-jsonsupplied a real tuple).cmd/calque/fleetrun.go— passesfalse(fleet has no--arg-fileequivalent).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 passgolangci-lint run ./...— 0 issuesruff check .— all checks passedforecasts_app.py/blending_app.pynow 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 refusesrun_benchmark's 3-arg signature (previously masked by an earlierSERVICE_ACCOUNT_JSONKeyError crash)run_benchmark_localpath (new regression testTestCheckInvokeSupportMultiArgWithRealArgTupleFine)