Repository navigation
Description
A root-placed provider's dispatch errors name a symbol the script cannot use.
>>> print("a", "b")
ui.print: got 2 arguments, want at most 1
ui.print does not exist. Root placement removes the provider global, so a script that takes the error at
its word and writes ui.print(...) gets undefined: ui. The caller reached the function as print.
Mechanism
pkg/op/starlarkbridge/go_receiver.go:229:
actionName := g.receiverType.Name() + "." + name
builtin := starlark.NewBuiltin(actionName, g.dispatch)The builtin's name is unconditionally <provider>.<method>, with no regard for placement. That name is what
starlark.UnpackArgs reports, and what every %s in routeArgs and fillNamedSlots interpolates.
For a non-root provider it is exactly right — file.copy is both the dispatch name and the call site. For a
root-placed one the two diverge, and the error reports the wrong half.
Pre-existing, not introduced by #708
flow is root-placed under plan and has had this since root placement existed. It is already normalized
into a fixture — cmd/devlore-test/devloretest/data/test_flow_fatal.star:
t.expect_error("flow.failed executed: database unreachable")
graph = plan.assemble_definition([
plan.failed("database unreachable"),
])The call is plan.failed; the expected error says flow.failed. Nobody could write flow.failed in a
script — flow is not a global.
#708 makes it conspicuous rather than new: print is the most-reached-for function in any language, and its
arity error now names something undefined.
Why it is worth fixing rather than tolerating
The error is the only feedback a script author gets, and it currently sends them toward a name that produces a
second, unrelated error. That is worse than a vague message — it is a confident wrong direction.
Proposal
Name the builtin by how it is actually reached:
RoleModulenon-root →provider.method(unchanged)RoleModule|RoleRoot→methodRoleActionnon-root →plan.provider.methodRoleAction|RoleRoot→plan.method
The dispatch zone and placement are both known at newGoReceiver, so this is a naming decision at
construction, not a lookup.
Note the action name on a graph node is a separate concern and should stay flow.failed — it identifies the
operation in a serialized graph, where the provider qualifier is the point. Only the starlark-facing
builtin name should follow placement. test_flow_fatal.star asserts on the node's execution message, so
check which of the two it is actually matching before changing it.
Acceptance
-
print("a", "b")reportsprint:, notui.print: -
plan.choose(...)with bad arguments reportsplan.choose:, notflow.choose: -
file.copy(...)is unchanged - Graph node action names are unchanged
Plan and design documents
| Kind | Document |
|---|---|
| Plan | docs/plans/dispatch-error-names.md |
Activity
test(ui): e2e coverage in devlore-test, and proof the bytes reach the…
docs(ui): correct the print(42) claim, and record two traps for the n…
ui takes the root namespace and replaces print and fail (#708)