Draft
Conversation
24923a8 to
1e06e05
Compare
1e06e05 to
eb1bde8
Compare
Replaces the hand-authored github.com/temporalio/api-go/experimental/example separate module with the generated files now in go.temporal.io/api under //go:build experimental. Changes: - go.mod: remove experimental/example dep; add replace directive pointing to local api-go with the generated files - api_example.go: workflowservice.EchoRequest/Response and workflowservice.ExampleWorkflowService_ServiceDesc replace expexample.* - experimental_api_test.go: NewExampleWorkflowServiceClient, EchoRequest, WORKFLOW_ID_CONFLICT_POLICY_FOO now from go.temporal.io/api directly; MessageOverlay test skipped until experimental_field annotations are added Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…oundary Creates common/expguard with a single Check() function: looks at msg.ProtoReflect().GetUnknown() and softassert.Fails if non-empty. One branch, same behavior in tests and prod — no modes, no reflection walk, no generated sidecar. Wires it as a frontend gRPC unary interceptor (ExperimentalGuardInterceptor) that fires only when no API variant is active. When a variant IS active, experimental clients are expected and the check is skipped. The compile-time boundary (//go:build experimental) already prevents stable server code from constructing experimental values. expguard is defense-in-depth for the remaining case: an experimental client sends unknown fields to a stable server, and those bytes ride through the gRPC stack toward the history service. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ypes Tests Set/Get/Clear on StartWorkflowExecutionRequestOverlay, now generated into go.temporal.io/api/workflowservice/v1 via experimentgen. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the local path replace directive with a proper pseudo-version resolved from the stephanos/experimental-apis branch of api-go. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
go.sum now has the correct entries for the remote pseudo-version. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two new subtests in TestExperimentalApi_Example send each experimental annotation type through a real cluster, proving all four reach the handler: experimental_method — Echo RPC responds experimental_message — EchoRequest/EchoResponse used by Echo experimental_enum_value — WORKFLOW_ID_CONFLICT_POLICY_FOO sent via StartWorkflow experimental_field/overlay — foo_text overlay sent via StartWorkflow The enum and overlay subtests assert NotEqual(Unimplemented) rather than NoError: the server may reject the unknown conflict policy value (1000) as invalid, but it must not reject it at the gRPC layer — proving the value crossed the boundary and reached the handler. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
api_example.go now demonstrates how a real feature uses each type in
server code:
experimental_method/message — exampleHandler.Echo (unchanged)
experimental_enum_value — exampleWorkflowWrapper.StartWorkflowExecution
reads WORKFLOW_ID_CONFLICT_POLICY_FOO and
returns InvalidArgument
experimental_field/overlay — same wrapper calls
GetStartWorkflowExecutionRequestOverlay to
read foo_text before delegating to stable handler
The wrapper embeds WorkflowServiceServer and only overrides the one method
it needs, relying on the stable handler for everything else.
Tests updated to assert codes.InvalidArgument for the enum subtest now
that the handler explicitly handles the FOO value.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Demonstrates two patterns for safe stable/experimental mixing: Pattern 1 — frontend wrapper (api_example.go, existing): Intercepts at the gRPC boundary via exampleWorkflowWrapper. Stable workflow_handler.go is never modified. Right for API-boundary changes. Pattern 2 — hook interface (service/frontend/hook/hook.go, new): Stable code defines StartWorkflowHook with a no-op default and calls hook.StartWorkflow.PreStart(ctx, req) without a build tag. Experimental code registers exampleStartWorkflowHook in init(). Right for injecting behaviour deeper in the stack without touching stable files. The hook package sits between frontend and frontend/services to avoid the import cycle that would arise if hooks lived in either. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the hook interface/variable pattern with the same approach already used in services/registry_default.go + registry_experimental.go: workflow_handler.go — one added call: startWorkflowExperimentalCheck(req) workflow_handler_default.go — //go:build !experimental → returns nil workflow_handler_experimental.go — //go:build experimental → real logic No interface, no global variable, no registration. Stable builds get an inlined nil return. Experimental builds get the check. One call-site in the stable file; two files for the two worlds. api_example.go simplified: enum value and overlay handling moved to workflow_handler_experimental.go where they belong. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
No //go:build experimental anywhere. Experimental types come from
github.com/temporalio/api-go/experimental — a plain Go dependency.
Stable go.temporal.io/api stays clean.
Changes:
- registry_default.go + registry_experimental.go deleted; registry
inlined into register.go (no build tag needed)
- api_example.go: removed build tag, imports exp{enums,workflowservice}
from the experimental module directly
- workflow_handler.go: reverted (no experimental check call)
- workflow_handler_default.go + workflow_handler_experimental.go deleted
- Makefile: removed experimental from ALL_TEST_TAGS (no longer needed)
- Tests: import expworkflowservice/expenums from experimental module
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- go.mod: re-add github.com/temporalio/api-go/experimental dep (removed by go mod tidy since it wasn't in go.sum yet) - experimental_api_test.go: use enumspb.WorkflowIdConflictPolicy for the cast — the experimental module exports only the constant, not the type (which lives in the stable enums package) Co-Authored-By: Claude Opus 4.7 (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 changed?
This PR prototypes an experimental API development flow without long-lived Temporal feature branches.
It adds:
frontend.apiVariantapi-gomodules for additive RPCs (ping,tinker)fairness)Why?
Developing in-progress APIs across
api,api-go, andtemporalcurrently requires feature branches, repeated rebases, and a large final merge. This change explores a smaller incremental path where Temporal can depend on temporary experimentalapi-gomodules until the stable API lands.How did you test it?
Local verification included:
go test ./cmd/experimentgeninapi-gogo test ./...in the generatedping,tinker, andfairnessexperiment modulesgo test -tags 'test_dep experimental' ./service/frontend/servicesgo test -tags 'test_dep experimental' ./tests/testcore ./tests -run 'TestExperimentalApi_(Ping|Tinker|Stable|FairnessWrapper)'go test -c -o /dev/null ./tests -tags 'disable_grpc_modules,test_dep,experimental'make fmt-importsmake lint-codePotential risks
This is prototype-only infrastructure and increases complexity in frontend registration, test wiring, and module generation. The wrapper path intentionally relies on protobuf unknown fields, so it is best suited to additive field experiments and should stay temporary until the stable API is merged.