Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions framework/clclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"os"
"regexp"
"strconv"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -1431,3 +1432,38 @@ func ImportP2PKeys(cl []*ChainlinkClient, keys [][]byte) error {
}
return eg.Wait()
}

func (c *ChainlinkClient) ReadWorkflowEvents(workflowID string, sequence int64, limit int) (*WorkflowDebugEvents, *http.Response, error) {
specObj := &WorkflowDebugEvents{}
framework.L.Info().Str(NodeURL, c.Config.URL).Str("ID", workflowID).Int64("sequence", sequence).Int("limit", limit).Msg("Reading Workflow Events")
resp, err := c.APIClient.R().
SetResult(&specObj).
SetPathParams(map[string]string{
"id": workflowID,
}).
SetQueryParams(map[string]string{
"sequence": strconv.FormatInt(sequence, 10),
"limit": strconv.Itoa(limit),
}).
Get("/v2/debug/workflow/{id}/events?sequence={sequence}&limit={limit}")

Copilot AI Dec 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query parameters should not be included in the URL path when using SetQueryParams. The query string should be just '/v2/debug/workflow/{id}/events' as SetQueryParams already adds the query parameters.

Copilot uses AI. Check for mistakes.
if err != nil {
return nil, nil, err
}
return specObj, resp.RawResponse, err
}

func (c *ChainlinkClient) ReadOrphanEvents(sequence int64, limit int) (*WorkflowOrphanEvents, *http.Response, error) {
specObj := &WorkflowOrphanEvents{}
framework.L.Info().Str(NodeURL, c.Config.URL).Int64("sequence", sequence).Int("limit", limit).Msg("Reading Workflow Orphan Events")
resp, err := c.APIClient.R().
SetResult(&specObj).
SetQueryParams(map[string]string{
"sequence": strconv.FormatInt(sequence, 10),
"limit": strconv.Itoa(limit),
}).
Get("/v2/debug/workflow/orphan_events?sequence={sequence}&limit={limit}")

Copilot AI Dec 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query parameters should not be included in the URL path when using SetQueryParams. The query string should be just '/v2/debug/workflow/orphan_events' as SetQueryParams already adds the query parameters.

Copilot uses AI. Check for mistakes.
if err != nil {
return nil, nil, err
}
return specObj, resp.RawResponse, err
}
42 changes: 42 additions & 0 deletions framework/clclient/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -1419,3 +1419,45 @@ type ForwarderAttributes struct {
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}

type WorkflowDebugEvents struct {
Data WorkflowDebugEventsData `json:"data"`
}

type WorkflowDebugEventsData struct {
Type string `json:"type"`
ID string `json:"id"`
Attributes WorkflowDebugEventsAttributes `json:"attributes"`
}

type WorkflowDebugEventsAttributes struct {
Events []WorkflowDebugEvent `json:"events"`
}

type WorkflowDebugEvent struct {
Timestamp time.Time `json:"timestamp"`
Sequence int64 `json:"sequence"`
Message []byte `json:"message"` // protobuf encoded
Type string `json:"type"` // protobuf type name
}

type WorkflowOrphanEvents struct {
Data WorkflowOrphanEventsData `json:"data"`
}

type WorkflowOrphanEventsData struct {
Type string `json:"type"`
ID string `json:"id"`
Attributes WorkflowDebugEventsAttributes `json:"attributes"`
Comment on lines +1449 to +1451

Copilot AI Dec 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field type should be WorkflowOrphanEventsAttributes instead of WorkflowDebugEventsAttributes. This is a copy-paste error that causes the WorkflowOrphanEventsData struct to have the wrong attributes type.

Suggested change
Type string `json:"type"`
ID string `json:"id"`
Attributes WorkflowDebugEventsAttributes `json:"attributes"`
Type string `json:"type"`
ID string `json:"id"`
Attributes WorkflowOrphanEventsAttributes `json:"attributes"`

Copilot uses AI. Check for mistakes.
}

type WorkflowOrphanEventsAttributes struct {
Events []WorkflowOrphanEvent `json:"events"`
}

type WorkflowOrphanEvent struct {
Timestamp time.Time `json:"timestamp"`
Sequence int64 `json:"sequence"`
Message []byte `json:"message"` // protobuf encoded
Type string `json:"type"` // protobuf type name
}
2 changes: 2 additions & 0 deletions framework/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ require (
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-github/v72 v72.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
Expand Down
3 changes: 3 additions & 0 deletions framework/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,15 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/go-github/v72 v72.0.0 h1:FcIO37BLoVPBO9igQQ6tStsv2asG4IPcYFi655PPvBM=
github.com/google/go-github/v72 v72.0.0/go.mod h1:WWtw8GMRiL62mvIquf1kO3onRHeWWKmK01qdCY8c5fg=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
Expand Down
Loading
Loading