Repository navigation
TS SDK: add withArgNames for explicit argument renames - #73191
Merged
jason810496 merged 1 commit intoSep 19, 2026
Merged
Conversation
1 task done
jason810496
force-pushed
the
feature/ts-sdk/with-arg-names
branch
15 times, most recently
from
September 18, 2026 03:16
7ba4226 to
7427c1d
Compare
jason810496
force-pushed
the
feature/ts-sdk/with-arg-names
branch
4 times, most recently
from
September 18, 2026 10:07
91646ed to
932668c
Compare
jason810496
marked this pull request as ready for review
September 18, 2026 10:17
jason810496
requested review from
amoghrajesh,
ashb,
gopidesupavan,
jscheffl and
potiuk
as code owners
September 18, 2026 10:17
jason810496
force-pushed
the
feature/ts-sdk/with-arg-names
branch
from
September 18, 2026 13:52
932668c to
1e89ceb
Compare
pierrejeambrun
approved these changes
Sep 18, 2026
jason810496
marked this pull request as draft
September 18, 2026 15:38
Folding absorbs spelling differences, so a Python `region_code` reaches a
handler's `regionCode` with nothing declared. What it cannot reach is a name
the Python side never used: a handler that wants to call `run_label` simply
`label`, or one whose argument is a TypeScript reserved word like `enum`. Until
now the only options were to rename the Python parameter, or to read the
argument under Python's name and shadow it locally.
`withArgNames` states that binding. The mapping comes first and the handler
second, so the map reads as a qualifier on the handler rather than an extra
parameter, and an entry takes precedence over folding. Everything the map does
not mention still folds, which is the property that keeps this rare.
The map's keys are checked against the handler's own parameter type, so
`{ labl: "run_label" }` is a compile error naming the right key, since a
mapping for a name the handler does not have would silently do nothing. That
check needs the parameter type to come from the handler alone, so the map's
type parameter is `NoInfer`: inferring it from the map too would make every key
correct by construction and the check vacuous.
A mapped name the call did not pass misses rather than falling back to folding.
An author who stated a binding that is wrong should see the miss, not a value
the SDK guessed at, so the unbound-argument warning now also names the wire
name that was asked for.
The renames travel with the handler on a global symbol and are read back at the
dispatch site, which is also why the returned value is a wrapper rather than
the author's own function with a property attached: one handler can be
registered for two tasks that rename differently, and mutating it would let the
second registration silently change the first.
jason810496
force-pushed
the
feature/ts-sdk/with-arg-names
branch
from
September 18, 2026 15:39
1e89ceb to
3411603
Compare
jason810496
marked this pull request as ready for review
September 19, 2026 03:26
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.
TS SDK: add withArgNames for explicit argument renames
Why
Folding absorbs spelling differences, but not a name the Python side never used:
a handler that wants to call
run_labelsimplylabel, or one whose argument is a TypeScript reserved word likeenum.How
withArgNames(map, handler), mapping first. An entry beats folding, and everything the map does not mention still folds,which is what keeps this rare in a real Dag.
{ labl: "run_label" }is a compile error naming the right key.Its type parameter is
NoInfer, so the parameter type comes from the handler alone;inferring it from the map too would make every key correct by construction and the check vacuous.
The values are Python names, which
tsccannot see and does not check.so a stated binding that is wrong is visible instead of silently replaced by a guess.
The unbound-argument warning now also names the wire name that was asked for.
The return value is a wrapper rather than the author's own function with a property attached,
because one handler can be registered for two tasks that rename differently.
reporttask whose handler renamesrun_labeltolabeland throws unless it bound correctly,so a rename that did not take effect fails the end-to-end run rather than returning a null.
Was generative AI tooling used to co-author this PR?