feat(temporal/job): add type-focused workflow Definition layer#58
Merged
Conversation
Introduces ListOpts, StatsOpts, HistoryOpts, ScheduleListOpts, and ExecuteOption (with builders) for configuring Definition operations. Adds sentinel errors and translateSDKError for typed SDK error wrapping.
…GetRun Implements Task 5: Definition struct with option-based constructor (New), Register, Execute, GetRun methods, and RegisterWorkflowOnce/RegisterActivityOnce dedup helpers backed by sync.Map.
Implements Registry with Add, Get, MustGet, List, Names, RegisterAll, and a stub ApplySchedules pending Task 8.
…tats Add per-run workflow operations on Definition: Describe, History, Cancel, Terminate, Signal, Query, ListRuns, and Stats. All delegate to the Temporal client and share the scoped visibility-query helper (WorkflowId STARTS_WITH).
Implement Definition.ApplySchedule (create-or-update), PauseSchedule, ResumeSchedule, TriggerSchedule, DeleteSchedule, and DescribeSchedule. Replace the ApplySchedules stub in Registry with the real implementation.
Five integration tests cover full Definition lifecycle (execute, describe, history, cancel, list), schedule lifecycle (apply, describe, pause, resume, trigger, delete), and Registry deduplication across shared workflow types.
4 tasks
jasoet
added a commit
to jasoet/go-wf
that referenced
this pull request
May 11, 2026
Consume the new pkg/temporal/job package and converge all four go-wf builders on producing *job.Definition. - container.RegisterAll / function.RegisterAll made idempotent via job.RegisterWorkflowOnce / RegisterActivityOnce - datasync builder: Build() returns *job.Definition; FullJobRegistration deleted - datasync/chunk: Build() returns *job.Definition; new ScheduleEvery / ScheduleCron / ScheduleRaw setters replace Schedule(d) - function builder: single Build() returning *job.Definition; mode via .Pipeline()/.Parallel()/.Single()/.Loop()/.ParameterizedLoop() - container builder: same convergence; mode via .Pipeline()/.Parallel()/.Single()/.Loop()/.ParameterizedLoop() - 15 example files updated for new pkg/v2 NewClient signature and *job.Definition API Spec: docs/superpowers/specs/2026-05-11-pkg-temporal-job-definition-design.md Depends on: jasoet/pkg#58 (merged) PR: #20
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.
Summary
Adds
pkg/temporal/job— a generic, transport-agnostic abstraction for one registered Temporal workflow. Every per-job operation hangs off*job.Definitionas a method: register, execute, describe, history, cancel, terminate, signal, query, schedule lifecycle, list runs, stats.The new package coexists with existing
pkg/temporalmanagers —WorkflowManager/ScheduleManagerhandle namespace-wide ops;Definitionis the per-job lens.What's new
job.Definition+job.New(name, taskQueue, opts...)functional-options constructorjob.Registryfor name → Definition lookup +RegisterAll/ApplySchedulesjob.RegisterWorkflowOnce/RegisterActivityOnce— idempotent worker registration for cases where multiple Definitions share a workflow typejob.ScheduleSpecwith interval / cron / calendar support + overlap policyStatus,ActivityStatus,RunDetail,RunHistory,RunPage,ScheduleDetail, etc.ErrNotFound, etc.) preserving the underlying error chainSpec
go-wfdocs/superpowers/specs/2026-05-11-pkg-temporal-job-definition-design.mdTest plan