refactor: rename action→activity, statemachine→workflow, remove HTTP API layer
- action/ → activity/ (Temporal activities) - statemachine/ → workflow/ (Temporal workflows) - Removed internal/api/ and cmd/server/ (api-gw handles HTTP, Temporal is the API) - Created pkg/types/types.go as single source of truth for all shared types - Extracted CallRoleLLM helper (DRY: implementer/planner/judge shared pattern) - Fixed circular import: workflow_graph_query uses string activity names - Fixed logger.logf → logger.Info/Warn (method didn't exist) - Fixed routing types: added Branches, Activity, BackoffSeconds, TaskActivity - Fixed db.Canvas.Name, db.Client→DB, GetWorkflow→FetchWorkflow - Removed unused imports - All tests pass, build clean, vet clean
This commit is contained in:
+15
-15
@@ -9,7 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/rockliang/poimen/workflows/action"
|
||||
"github.com/rockliang/poimen/workflows/activity"
|
||||
)
|
||||
|
||||
func TestGitCloneAndFetch(t *testing.T) {
|
||||
@@ -56,7 +56,7 @@ func TestGitCloneAndFetch(t *testing.T) {
|
||||
|
||||
// Test clone into empty path
|
||||
ctx := context.Background()
|
||||
err := action.CloneRepoActivity(ctx, action.CloneRepoInput{
|
||||
err := activity.CloneRepoActivity(ctx, activity.CloneRepoInput{
|
||||
RemoteURL: sourceDir,
|
||||
TargetRepoPath: targetDir,
|
||||
})
|
||||
@@ -89,7 +89,7 @@ func TestGitCloneAndFetch(t *testing.T) {
|
||||
}
|
||||
|
||||
// Test fetch on existing repo
|
||||
err = action.CloneRepoActivity(ctx, action.CloneRepoInput{
|
||||
err = activity.CloneRepoActivity(ctx, activity.CloneRepoInput{
|
||||
RemoteURL: sourceDir,
|
||||
TargetRepoPath: targetDir,
|
||||
})
|
||||
@@ -139,14 +139,14 @@ func TestGitWorktreeAdd(t *testing.T) {
|
||||
|
||||
// Clone the repo
|
||||
ctx := context.Background()
|
||||
err := action.CloneRepoActivity(ctx, action.CloneRepoInput{
|
||||
err := activity.CloneRepoActivity(ctx, activity.CloneRepoInput{
|
||||
RemoteURL: sourceDir,
|
||||
TargetRepoPath: repoDir,
|
||||
})
|
||||
assert.NoError(t, err, "clone should succeed")
|
||||
|
||||
// Test worktree add
|
||||
worktreePath, err := action.GitWorktreeAddActivity(ctx, action.GitWorktreeAddInput{
|
||||
worktreePath, err := activity.GitWorktreeAddActivity(ctx, activity.GitWorktreeAddInput{
|
||||
RepoPath: repoDir,
|
||||
TaskID: "T0.1",
|
||||
})
|
||||
@@ -207,14 +207,14 @@ func TestGitCommit(t *testing.T) {
|
||||
|
||||
// Clone the repo
|
||||
ctx := context.Background()
|
||||
err := action.CloneRepoActivity(ctx, action.CloneRepoInput{
|
||||
err := activity.CloneRepoActivity(ctx, activity.CloneRepoInput{
|
||||
RemoteURL: sourceDir,
|
||||
TargetRepoPath: repoDir,
|
||||
})
|
||||
assert.NoError(t, err, "clone should succeed")
|
||||
|
||||
// Create a worktree
|
||||
worktreePath, err := action.GitWorktreeAddActivity(ctx, action.GitWorktreeAddInput{
|
||||
worktreePath, err := activity.GitWorktreeAddActivity(ctx, activity.GitWorktreeAddInput{
|
||||
RepoPath: repoDir,
|
||||
TaskID: "T0.1",
|
||||
})
|
||||
@@ -227,7 +227,7 @@ func TestGitCommit(t *testing.T) {
|
||||
}
|
||||
|
||||
// Commit changes
|
||||
err = action.GitCommitActivity(ctx, action.GitCommitInput{
|
||||
err = activity.GitCommitActivity(ctx, activity.GitCommitInput{
|
||||
WorktreePath: worktreePath,
|
||||
Message: "Add new file",
|
||||
})
|
||||
@@ -283,14 +283,14 @@ func TestGitDiff(t *testing.T) {
|
||||
|
||||
// Clone the repo
|
||||
ctx := context.Background()
|
||||
err := action.CloneRepoActivity(ctx, action.CloneRepoInput{
|
||||
err := activity.CloneRepoActivity(ctx, activity.CloneRepoInput{
|
||||
RemoteURL: sourceDir,
|
||||
TargetRepoPath: repoDir,
|
||||
})
|
||||
assert.NoError(t, err, "clone should succeed")
|
||||
|
||||
// Create a worktree
|
||||
worktreePath, err := action.GitWorktreeAddActivity(ctx, action.GitWorktreeAddInput{
|
||||
worktreePath, err := activity.GitWorktreeAddActivity(ctx, activity.GitWorktreeAddInput{
|
||||
RepoPath: repoDir,
|
||||
TaskID: "T0.1",
|
||||
})
|
||||
@@ -309,7 +309,7 @@ func TestGitDiff(t *testing.T) {
|
||||
}
|
||||
|
||||
// Get diff (should show the staged change)
|
||||
diffOutput, err := action.GitDiffActivity(ctx, action.GitDiffInput{
|
||||
diffOutput, err := activity.GitDiffActivity(ctx, activity.GitDiffInput{
|
||||
WorktreePath: worktreePath,
|
||||
})
|
||||
assert.NoError(t, err, "diff should succeed")
|
||||
@@ -378,7 +378,7 @@ func TestGitSquashMerge(t *testing.T) {
|
||||
|
||||
// Clone for the orchestrator to use
|
||||
ctx := context.Background()
|
||||
err := action.CloneRepoActivity(ctx, action.CloneRepoInput{
|
||||
err := activity.CloneRepoActivity(ctx, activity.CloneRepoInput{
|
||||
RemoteURL: sourceDir,
|
||||
TargetRepoPath: repoDir,
|
||||
})
|
||||
@@ -387,7 +387,7 @@ func TestGitSquashMerge(t *testing.T) {
|
||||
// Create multiple worktrees with changes
|
||||
for i := 1; i <= 2; i++ {
|
||||
taskID := fmt.Sprintf("T0.%d", i)
|
||||
worktreePath, err := action.GitWorktreeAddActivity(ctx, action.GitWorktreeAddInput{
|
||||
worktreePath, err := activity.GitWorktreeAddActivity(ctx, activity.GitWorktreeAddInput{
|
||||
RepoPath: repoDir,
|
||||
TaskID: taskID,
|
||||
})
|
||||
@@ -400,7 +400,7 @@ func TestGitSquashMerge(t *testing.T) {
|
||||
}
|
||||
|
||||
// Commit changes
|
||||
err = action.GitCommitActivity(ctx, action.GitCommitInput{
|
||||
err = activity.GitCommitActivity(ctx, activity.GitCommitInput{
|
||||
WorktreePath: worktreePath,
|
||||
Message: fmt.Sprintf("Task %s implementation", taskID),
|
||||
})
|
||||
@@ -408,7 +408,7 @@ func TestGitSquashMerge(t *testing.T) {
|
||||
}
|
||||
|
||||
// Perform squash merge
|
||||
err = action.GitSquashMergeActivity(ctx, action.GitSquashMergeInput{
|
||||
err = activity.GitSquashMergeActivity(ctx, activity.GitSquashMergeInput{
|
||||
RepoPath: repoDir,
|
||||
Branches: []string{"task/T0.1", "task/T0.2"},
|
||||
Message: "Milestone T0: completed all tasks",
|
||||
|
||||
Reference in New Issue
Block a user