mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
Goes from 135 MB binary with 1153 files importing go.temporal.io and 224
importing google.golang.org/grpc to a 10 MB native binary with ZERO of
either.
Deleted:
- tasks/, tasktests/, service/, chasm/, client/, api/, proto/, tools/
- cmd/tools/, components/, docker/
- schema/{cassandra,elasticsearch,mysql,postgresql,sqlite}/
- 40 tainted common/ subdirs + 7 top-level common files
- tests/testutils (no longer referenced after surviving deps drop common)
New cmd/tasksd (~100 lines) boots tasks.Embed (zap.Node) + http.Server.
New pkg/tasks/embed.go registers ZAP handlers for the SDK opcode surface
(0x0060-0x00A5). Workflow handlers return a 501 "not yet implemented"
envelope; native engine lands behind this contract.
Build: go build ./cmd/tasksd → 10 MB
Vet: go vet ./... → clean
Boot: tasksd --zap-port 9999 --http :7243
Probes: /healthz, /v1/tasks/health → 200
UI: /_/tasks/, / → 200 (embedded Vite bundle)
ZAP: _tasks._tcp on :9999 (mDNS disabled; direct connect)
go.mod: tidy. No go.temporal.io. No google.golang.org/grpc.
75 lines
2.2 KiB
Go
75 lines
2.2 KiB
Go
package matching
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
deploymentpb "go.temporal.io/api/deployment/v1"
|
|
enumspb "go.temporal.io/api/enums/v1"
|
|
"go.temporal.io/server/common/tqid"
|
|
)
|
|
|
|
func TestVersionSetQueueKey(t *testing.T) {
|
|
a := assert.New(t)
|
|
|
|
f, err := tqid.NewTaskQueueFamily("", "tq")
|
|
assert.NoError(t, err)
|
|
p := f.TaskQueue(enumspb.TASK_QUEUE_TYPE_WORKFLOW).NormalPartition(2)
|
|
key := VersionSetQueueKey(p, "abc3")
|
|
a.Equal(p, key.Partition())
|
|
a.Equal("abc3", key.Version().VersionSet())
|
|
a.Equal("", key.Version().BuildId())
|
|
a.Nil(key.Version().Deployment())
|
|
}
|
|
|
|
func TestBuildIDQueueKey(t *testing.T) {
|
|
a := assert.New(t)
|
|
|
|
f, err := tqid.NewTaskQueueFamily("", "tq")
|
|
assert.NoError(t, err)
|
|
p := f.TaskQueue(enumspb.TASK_QUEUE_TYPE_WORKFLOW).NormalPartition(2)
|
|
key := BuildIdQueueKey(p, "abc3")
|
|
a.Equal(p, key.Partition())
|
|
a.Equal("", key.Version().VersionSet())
|
|
a.Equal("abc3", key.Version().BuildId())
|
|
a.Nil(key.Version().Deployment())
|
|
}
|
|
|
|
func TestDeploymentQueueKey(t *testing.T) {
|
|
a := assert.New(t)
|
|
|
|
f, err := tqid.NewTaskQueueFamily("", "tq")
|
|
assert.NoError(t, err)
|
|
p := f.TaskQueue(enumspb.TASK_QUEUE_TYPE_WORKFLOW).NormalPartition(2)
|
|
d := &deploymentpb.Deployment{
|
|
SeriesName: "my_app",
|
|
BuildId: "abc",
|
|
}
|
|
key := DeploymentQueueKey(p, d)
|
|
a.Equal(p, key.Partition())
|
|
a.Equal("", key.Version().VersionSet())
|
|
a.Equal("", key.Version().BuildId())
|
|
a.True(d.Equal(key.Version().Deployment()))
|
|
}
|
|
|
|
func TestUnversionedQueueKey(t *testing.T) {
|
|
a := assert.New(t)
|
|
|
|
f, err := tqid.NewTaskQueueFamily("", "tq")
|
|
assert.NoError(t, err)
|
|
p := f.TaskQueue(enumspb.TASK_QUEUE_TYPE_WORKFLOW).NormalPartition(2)
|
|
key := UnversionedQueueKey(p)
|
|
a.Equal(p, key.Partition())
|
|
a.Equal("", key.Version().VersionSet())
|
|
a.Equal("", key.Version().BuildId())
|
|
a.Nil(key.Version().Deployment())
|
|
}
|
|
|
|
func TestWorkerCommandsPersistenceName(t *testing.T) {
|
|
tq := tqid.UnsafeTaskQueueFamily("ns", "/temporal-sys/worker-commands/ns/key").TaskQueue(enumspb.TASK_QUEUE_TYPE_NEXUS)
|
|
p := tq.WorkerCommandsPartition()
|
|
key := UnversionedQueueKey(p)
|
|
require.Equal(t, "/temporal-sys/worker-commands/ns/key", key.PersistenceName())
|
|
}
|