fix: use query params for workflow_id in Poimen endpoints
CI / CI (pull_request) Successful in 2m17s
CI / CI (pull_request) Successful in 2m17s
Root cause: ServiceAdapter dispatcher sets X-Upstream-Path to template
strings like /v1/poimen/executions/{id}/stream with literal {id}.
extractWorkflowID() returned '{id}' instead of the actual workflow ID.
Fix:
- All handlers read workflow_id from ?workflow_id=xxx query param
- Remove path param extraction (extractWorkflowID)
- Update spec paths: remove {id} segments, use flat resource paths
/v1/poimen/executions/detail?workflow_id=xxx
/v1/poimen/executions/stream?workflow_id=xxx
/v1/poimen/executions/history?workflow_id=xxx
/v1/poimen/executions/signal?workflow_id=xxx
- Exact path matching in ServeHTTP (no prefix/suffix matching)
API contract:
GET /v1/poimen/executions — list all
GET /v1/poimen/executions/detail?workflow_id=xxx — describe one
GET /v1/poimen/executions/history?workflow_id=xxx — event history
GET /v1/poimen/executions/stream?workflow_id=xxx — SSE events
POST /v1/poimen/executions/signal?workflow_id=xxx — signal
DELETE /v1/poimen/executions/detail?workflow_id=xxx — terminate
This commit is contained in:
@@ -53,17 +53,20 @@ func GetPoimenSpec() *Spec {
|
||||
},
|
||||
},
|
||||
},
|
||||
// Note: workflow_id is passed as ?workflow_id=xxx query param,
|
||||
// not as a path segment. The ServiceAdapter dispatcher does not
|
||||
// substitute path parameters.
|
||||
{
|
||||
Name: "execution-detail",
|
||||
Methods: []Method{
|
||||
{
|
||||
Verb: "GET",
|
||||
UpstreamPath: "/v1/poimen/executions/{id}",
|
||||
UpstreamPath: "/v1/poimen/executions/detail",
|
||||
Auth: &Auth{Required: true, Capability: "workflow:read"},
|
||||
},
|
||||
{
|
||||
Verb: "DELETE",
|
||||
UpstreamPath: "/v1/poimen/executions/{id}",
|
||||
UpstreamPath: "/v1/poimen/executions/detail",
|
||||
Auth: &Auth{Required: true, Capability: "workflow:execute"},
|
||||
},
|
||||
},
|
||||
@@ -72,7 +75,7 @@ func GetPoimenSpec() *Spec {
|
||||
Name: "execution-history",
|
||||
Methods: []Method{{
|
||||
Verb: "GET",
|
||||
UpstreamPath: "/v1/poimen/executions/{id}/history",
|
||||
UpstreamPath: "/v1/poimen/executions/history",
|
||||
Auth: &Auth{Required: true, Capability: "workflow:read"},
|
||||
}},
|
||||
},
|
||||
@@ -80,7 +83,7 @@ func GetPoimenSpec() *Spec {
|
||||
Name: "execution-stream",
|
||||
Methods: []Method{{
|
||||
Verb: "GET",
|
||||
UpstreamPath: "/v1/poimen/executions/{id}/stream",
|
||||
UpstreamPath: "/v1/poimen/executions/stream",
|
||||
Auth: &Auth{Required: true, Capability: "workflow:read"},
|
||||
}},
|
||||
},
|
||||
@@ -88,7 +91,7 @@ func GetPoimenSpec() *Spec {
|
||||
Name: "execution-signal",
|
||||
Methods: []Method{{
|
||||
Verb: "POST",
|
||||
UpstreamPath: "/v1/poimen/executions/{id}/signal",
|
||||
UpstreamPath: "/v1/poimen/executions/signal",
|
||||
Auth: &Auth{Required: true, Capability: "workflow:execute"},
|
||||
}},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user