feat(temporal): resolve func-returning-constant dispatch names#87
Open
avfirsov wants to merge 1 commit into
Open
feat(temporal): resolve func-returning-constant dispatch names#87avfirsov wants to merge 1 commit into
avfirsov wants to merge 1 commit into
Conversation
Resolve Temporal dispatch where the activity/workflow name comes from a
function that returns a string constant:
func GetChargeActivityName() string { return "ChargeActivity" }
workflow.ExecuteActivity(ctx, constants.GetChargeActivityName())
Reuses the existing constant-value sidecar + const-deref path rather than
adding a new resolver pass or meta keys:
- extractor records any func/method whose body is a single `return "lit"`
into `result.ConstValues` (the same sidecar already used for string
consts), keyed by the func node id;
- `goTemporalNameFromExpr` learns `call_expression`: a call-expr dispatch
arg yields the callee func name (`pkg.GetX()` / `GetX()` -> "GetX");
- `buildConstDerefMap` now also considers KindFunction / KindMethod
candidates, so the existing deref step maps "GetX" -> "ChargeActivity"
-> registered handler.
Wrapper-following / executor-field / cross-language / env-default untouched.
Tests: extractor (ConstValue emission + call-expr name), resolver deref,
and an end-to-end index→resolve test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 comes from a function that returns a string constant:
Today the call-expression argument yields no name and the dispatch stays unresolved. This resolves it to the registered
ChargeActivity.How — reuse the existing const-deref machinery
No new resolver pass and no new meta keys. It plugs into the constant-value sidecar + const-deref step that already resolves
const X = "Y"dispatch names:return "<literal>"intoresult.ConstValues(the same sidecar already used for string consts), keyed by the func node id;goTemporalNameFromExprlearnscall_expression: a call-expr dispatch arg yields the callee function name (pkg.GetX()/GetX()→"GetX");buildConstDerefMapnow also considersKindFunction/KindMethodcandidates, so the existing deref step maps"GetX"→"ChargeActivity"→ registered handler.Scope
Tests
temporal_name == "GetX", incl.pkg.Get…()),go build ./...andgo test -race ./internal/resolver/... ./internal/parser/languages/... ./internal/indexer/...pass.🤖 Generated with Claude Code