feat(temporal): resolve executor struct-field dispatch#86
Open
avfirsov wants to merge 1 commit into
Open
Conversation
Resolve Temporal dispatch where the activity/workflow name is a receiver
field whose literal is set at struct construction:
type ActivityExecutor struct{ ActivityName string }
func (e ActivityExecutor) Run(ctx workflow.Context) {
workflow.ExecuteActivity(ctx, e.ActivityName) // name = recv field
}
exec := ActivityExecutor{ActivityName: "ChargeCard"} // literal here
The dispatch sees `e.ActivityName` (not a literal) and the literal lives at
the construction site; this joins the two by (receiver type, field).
Extractor (golang.go / golang_temporal.go):
- a `fieldstr` tree-sitter pattern collects `Type{Field: "literal"}` struct
field assignments; emitted as `via=temporal.executor-field` marker edges
carrying executor_type / executor_field / executor_value;
- the dispatch stub is stamped `temporal_name_field` + `temporal_recv_type`
when the dispatch arg is `<receiver>.<field>`;
- helper `goCompositeLiteralType`; `recvTypeByID` map; `callNode` on the
deferred-call struct so the calls loop can inspect the dispatch arg.
Resolver (temporal_calls.go):
- `resolveTemporalExecutorFields` joins dispatch (recv_type, field) to a
construction literal and rewrites the method's stub name to that literal,
so the existing sweep lands it on the registered handler and callers of
the activity surface the dispatching method. Wired at the top of
`ResolveTemporalCalls`; self-guards; recompute-safe; unique-or-nothing on
conflicting construction literals.
Cross-language / const-deref / env-default / wrapper-following untouched.
Tests: resolver unit, extractor unit (field meta + marker), e2e.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
db1b05e to
de36f95
Compare
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.
What
Resolves Temporal dispatch where the activity/workflow name is a receiver field whose literal is set at struct construction:
The dispatch only sees
e.ActivityName(not a literal), so it never resolved. This joins the dispatch to the construction-site literal by(receiver type, field).How
Extractor (
golang.go/golang_temporal.go):fieldstrtree-sitter pattern collectsType{Field: "literal"}struct-field assignments, emitted asvia=temporal.executor-fieldmarker edges carryingexecutor_type/executor_field/executor_value;temporal_name_field+temporal_recv_typewhen the dispatch argument is<receiver>.<field>;goCompositeLiteralType; arecvTypeByIDmap; and the call AST node on the deferred-call struct so the calls loop can inspect the dispatch arg.Resolver (
temporal_calls.go):resolveTemporalExecutorFieldsjoins a dispatch's(recv_type, field)to a construction literal and rewrites the dispatching method's stub name to that literal — so the existing sweep lands it on the registered handler and callers of the activity surface the dispatching method (not the constructor). Wired at the top ofResolveTemporalCalls; self-guards; recompute-safe; unique-or-nothing on conflicting literals (matching the const-deref policy).Scope
Tests
temporal_name_field/temporal_recv_typeon the stub;executor_*on the marker),go build ./...andgo test -race ./internal/resolver/... ./internal/parser/languages/... ./internal/indexer/...pass.🤖 Generated with Claude Code