Repository navigation
A dispatch error names the symbol the author typed - #728
Merged
Merged
Conversation
Closes #710. >>> print("a", "b") ui.print: got 2 arguments, want at most 1 ui.print does not exist. ui is promoted, so its methods ARE the top-level globals and the provider name is not a symbol any script can use -- an author who takes the error at its word and writes ui.print(...) gets `undefined: ui`. The error sent them toward a second, unrelated error, which is worse than a vague message. Pre-existing, not introduced by #708: flow has done this since promotion existed. The rule Where a call site exists, an error names what the author typed; where none exists, it names the action. The two cannot be one name because the action name is a node's identity field -- it is in the serialized document and the checksum -- so tying it to placement would rewrite every saved workflow when a provider's placement changed. print("a", "b") script evaluation -- the call site is right here -> print: got 2 arguments, want at most 1 plan.failed("db down") runs later, possibly from a workflow loaded off disk -> flow.failed executed: db down unchanged; there is no call site to name Three sites, and each already knew its own surface starlarkbridge/go_receiver.go script consults Placement(): bare when promoted plan/provider.go workflow promoted -> plan.<method> plan/adapter.go workflow qualified -> plan.<provider>.<method> Only the first consults placement. The other two ARE the promoted and qualified paths, so the site itself determines the shape. This is what #715 unblocked. Before it, placement was a bit tangled with dispatch and "which name would the author have typed" had no clean answer. flags.Placement() == op.PlacementPromoted is now a one-line question. actionName was a misnomer, and it made the change look risky Both workflow sites named the variable actionName and passed it to dispatchBuiltinBody, which reads as though changing it would move the serialized action name. It does not: that function uses the string ONLY in error text, and a node's action name comes from unit.Action().Name() at marshal. A display string was wearing an identity's name. Renamed to callSiteName at both sites, with a comment saying which it is. Step 1 classified every fixture before anything changed Four expectations name a provider-qualified symbol; exactly ONE moves. test_imm_ui_print_replaces_builtin is script evaluation. The three file.* expectations and the flow.* one are execution errors and stay exactly as they are. "Runs a graph" is the mechanical discriminator -- every execution fixture calls t.run(graph). The change then confirmed the classification rather than merely being consistent with it: those four fixtures passed untouched, because they never reach these sites. Tests assert both directions A promoted provider reports the bare name AND a qualified one keeps its qualifier -- together, because a fix that made every name bare would satisfy the first alone. And flow.choose, flow.gather, and flow.failed must still resolve through BuildAction: a saved workflow says flow.choose and has to load. test_imm_ui_print_replaces_builtin pinned `ui\.print: got 2 arguments` deliberately, with a comment saying the fix to #710 had to come back through it. It did.
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.
Closes #710. Plan:
docs/plans/dispatch-error-names.md.ui.printdoes not exist.uiis promoted, so its methods are the top-level globals and the provider nameis not a symbol any script can use — an author who takes the error at its word and writes
ui.print(...)getsundefined: ui. The error sent them toward a second, unrelated error, which is worse than a vague message.Pre-existing, not introduced by #708:
flowhas done this since promotion existed.The rule
An execution error genuinely cannot use a call-site name: a loaded workflow has nodes, not call sites. So the
boundary is explainable rather than arbitrary, which is what would otherwise confuse an author.
Three sites, each already knowing its own surface
starlarkbridge/go_receiver.goui.printprintpromoted,file.copyqualifiedplan/provider.goflow.chooseplan.chooseplan/adapter.gofile.copyplan.file.copyOnly the first consults
Placement(). The other two are the promoted and qualified paths, so the siteitself determines the shape.
This is what #715 unblocked. Before it, placement was a bit tangled with dispatch and "which name would the
author have typed" had no clean answer.
flags.Placement() == op.PlacementPromotedis now a one-line question.actionNamewas a misnomer, and it made this look riskier than it isBoth workflow sites named their variable
actionNameand passed it todispatchBuiltinBody— which reads asthough changing it would move the serialized action name. It does not. That function uses the string only
in error text, and a node's action name comes from
unit.Action().Name()at marshal.A display string was wearing an identity's name. Renamed to
callSiteNameat both sites, with a comment sayingwhich it is.
Step 1 classified every fixture before anything changed
Four fixture expectations name a provider-qualified symbol. Exactly one moves.
test_imm_ui_print_replaces_builtinprint:test_compensationtest_judgment_1_delete_then_copytest_judgment_resolve_danglingtest_flow_fatal"Runs a graph" is the mechanical discriminator. The change then confirmed that classification rather than
merely being consistent with it: all four execution fixtures passed untouched, because they never reach these
sites.
Tests assert both directions
A promoted provider reports the bare name and a qualified one keeps its qualifier — together, because a fix
that made every name bare would satisfy the first alone.
file.copyis exactly what an author types.And
flow.choose,flow.gather, andflow.failedmust still resolve throughBuildAction: a saved workflowsays
flow.chooseand has to load. That is the boundary made explicit rather than incidental.test_imm_ui_print_replaces_builtinpinnedui\.print: got 2 argumentsdeliberately, with a comment sayingthe #710 fix had to come back through it. It did — the fixture failed on the first run of the fix.
Verified
make check,make test-race,make test-scenario— all pass.