feat(temporal): variable-tracing, const-to-const & exact-name signature dispatch - #98
Merged
Merged
Conversation
…, exact-name signature match Implements the three resolver categories assigned to the external agent in docs/design/05 §9, reducing broken_dispatch beyond the worker-runner work. Cat 2 (variable tracing, meta_vars): goTemporalVarTrace traces a bare-variable dispatch name (name := <value>; ExecuteActivity(ctx, name)) to its last intra-procedural assignment — string literal, const reference, or no-arg const-returning func — feeding the existing temporal_name / temporal_default_const / temporal_name_func channels (resolver validates via constVal, so precision-safe). Const-default emission is ungated from the env-default block. A no-arg guard keeps env-helper-style calls (with args) out of the const-getter path. Cat 3 (ALL_CAPS const): adds const-to-const alias resolution (const ALIAS = RealName) — parser records Meta["const_ref"] (goConstRefName), buildTemporalIndex resolves aliases against constVal by bounded fixpoint. Direct/block-form consts already resolved. Cat 4 (PascalCase exact-name): lookupExactSig resolves a PascalCase dispatch onto a same-named, unregistered, non-suffixed function ONLY when its signature matches the kind (activity->context.Context / workflow->workflow.Context) and the candidate is unique; speculative + hidden. Fuzzy precision deliberately not loosened. Tests: temporal_vartrace_test.go, temporal_allcaps_test.go, temporal_pascalcase_test.go (incl. precision/abstention guards). Full temporal suites + build + vet green under -race; no regression. Corpus re-measurement is the corp agent's (no corpus access externally). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
avfirsov
force-pushed
the
pr/temporal-vartrace
branch
from
June 15, 2026 06:30
de82f4a to
38c8f1a
Compare
goAssignRHSExpr returned the first RHS expression regardless of which LHS target matched, so a parallel assignment like `x, name := "foo", "Charge"` traced "foo" for a dispatch via name. Match the RHS position to the target position; refuse multi-value calls (`a, b := f()`) that have no per-target literal.
Reconcile var-trace / const-alias / exact-name signature dispatch (zzet#98) with the convention (zzet#89) and env-helper (zzet#90) tiers now on main: - resolution ladder keeps exactSig (speculative) after the cross-language join; the env-default tier-override now also covers var_trace origins and preserves zzet#90's source-tiering (allowlist/os_getenv/const_ref stay visible) - single temporal_resolution_via stamp (exact_sig | convention) instead of two blocks that clobbered each other - fold the funcExact (zzet#98) and funcByName (zzet#89) indexes into one node sweep - goConstLiteralValue: keep main's grouped-const selection (drop zzet#98's equivalent duplicate) - lookupConvention drops cross-repo *_test.go stubs (matches main's fix) - regression test for parallel-assignment var-trace (x, act := _, "Name")
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
Three additional Go Temporal dispatch fallbacks, for dispatch names that aren't a direct string literal:
act := "ChargeActivity"; workflow.ExecuteActivity(ctx, act)traces a local var back to its assigned value: a string literal, a package-level const reference, or a no-arg func returning a single literal/const (goTemporalVarTrace,goTemporalFuncReturnName).const ALIAS = RealNamechains are followed (bounded fixpoint over theconstant_valuessidecar) so dispatch via an alias resolves to the underlying name.context.Context, workflow →workflow.Context), and is unique, lands at the hidden speculative tier (OriginSpeculative0.45,var_trace/exact-sig tagged) so it's available on opt-in without polluting default queries.Why
Real Temporal code frequently names activities/workflows through a local var, a const alias, or a convention-named function rather than an inline literal — these previously stayed
broken_dispatch.Porting notes (onto post-#82/#85/#86 main)
Main rewrote the const/func resolution machinery this feature was built on, so it was re-implemented against main's current structure (not mechanically cherry-picked):
constant_valuessidecar (ConstantValueReader/buildConstDerefMap); the var-trace const case emits the traced const name and letsbuildConstDerefMapdereference it; the alias case extendsbuildConstDerefMapto chaseconst_refhops.lookupExactSigis a sibling of main's 4-arglookup, gated onsignatureMatchesKind+ a cross-repo_test.godrop.Two precision guards were added to respect main's existing invariants (both verified against main-side tests): var-trace fires only on a single-assignment var (
EnvDefaultOverwrittenNotFlagged), and the bare-identifier case admits only package-level file consts (PlainVarNotEnvDefault).Tests
New:
temporal_vartrace_test.go,temporal_allcaps_test.go,temporal_pascalcase_test.go(literal/const/func trace, alias chains, exact-sig with signature/kind-mismatch abstention) — all #85/#86 tests kept.go build ./...,go vet, resolver/parser/indexer suites pass. (Pre-existing unrelatedinternal/hooksdeny-path failures need a live daemon; reproduce onmain.)