Skip to content

feat(temporal): resolve unregistered activities by func-name convention - #89

Merged
zzet merged 1 commit into
zzet:mainfrom
avfirsov:pr/temporal-unregistered-activities
Jun 15, 2026
Merged

feat(temporal): resolve unregistered activities by func-name convention#89
zzet merged 1 commit into
zzet:mainfrom
avfirsov:pr/temporal-unregistered-activities

Conversation

@avfirsov

Copy link
Copy Markdown
Contributor

What

Adds a convention fallback to Temporal dispatch resolution: when a dispatch name doesn't resolve to a registered activity/workflow, fall back to an exported Go function/method of that name following the activity/workflow naming convention (suffix Activity / Workflow).

Resolves the dispatch at the inferred tier (graph.OriginASTInferred, confidence 0.6, temporal_resolution_via="convention") — it's a naming convention, not a register-confirmed binding. Tries the dispatch name directly, then its const-deref value.

Why

Activity repos commonly hold the functions but register them from a separate worker-runner, so the register-based index never sees them and the dispatch stays broken_dispatch. This recovers the common 1:1 func name == dispatch string case (Pattern 2: ActivityFuncName const → the function).

How it fits current main

Ported onto the post-#82 resolver:

  • lookupConvention(kind, name, callerRepo, callerLang) mirrors idx.lookup's same-language gate (a Go dispatch never lands on a like-named symbol in another language).
  • The fallback block runs after const-deref and before the cross-language join — a same-language convention match is a stronger signal than a speculative cross-language by-string match.
  • A bounded funcByName index (convention-named Go funcs/methods only) is built in buildTemporalIndex.

Includes a small prerequisite fix to goConstLiteralValue: it now selects the matching const_spec by name inside a grouped const ( … ) block (previously only single-spec blocks yielded a const value), which the feature's own grouped-const dispatch test exercises.

Tests

New e2e TestTemporalE2E_GoUnregisteredActivityByConvention (workflow dispatches via an ActivityFuncName const to an unregistered GetProductOfferingActivity). go build ./... clean; resolver / parser / indexer suites pass.

…vention

Activity repos hold the functions but register them from a separate
worker-runner, so the register-based index never sees them. Add a
convention fallback: index Go functions/methods named like activities/
workflows (suffix Activity/Workflow) and, when no registered handler
matches a dispatch name (directly or via its const value), resolve to the
unambiguous convention-named function — at the inferred tier
(temporal_resolution_via=convention), since it's a naming convention not a
register-confirmed binding.

This is Pattern 2's two-part naming (ActivityFuncName const → the func)
and Stage 1.2 generally (func names match dispatch strings 1:1).

e2e: workflow dispatches via ActivityFuncName const -> unregistered
GetProductOfferingActivity function.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@avfirsov
avfirsov force-pushed the pr/temporal-unregistered-activities branch from 806a762 to fef01ac Compare June 15, 2026 06:56
@zzet
zzet merged commit 5811fa7 into zzet:main Jun 15, 2026
9 checks passed
zzet added a commit to avfirsov/gortex that referenced this pull request Jun 15, 2026
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")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants