From 6de95908a03425c401a6ad77438ea7131c290d17 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Fri, 15 Aug 2025 13:18:54 -0700 Subject: [PATCH 1/5] feat(ci): apidiff-go for root module --- .github/workflows/api-diff.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/api-diff.yml diff --git a/.github/workflows/api-diff.yml b/.github/workflows/api-diff.yml new file mode 100644 index 0000000000..f1702bb2c5 --- /dev/null +++ b/.github/workflows/api-diff.yml @@ -0,0 +1,31 @@ +name: Analyze API Changes +description: Runs apidiff-go action to check for breaking changes to modules' public APIs + +on: + pull_request: + +jobs: + root-module: + name: Root Module + permissions: + pull-requests: write + contents: read + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + cache: false + + - uses: smartcontractkit/.github/actions/apidiff-go@apidiff-go/0.1.0 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + go-mod-paths: "./" + enforce-compatible: "false" # dont fail on breaking changes From 1aa7a02f0394db9a923c31923903e4eac7860776 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Fri, 15 Aug 2025 13:22:30 -0700 Subject: [PATCH 2/5] test: breaking change --- pkg/utils/mailbox/mailbox.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/utils/mailbox/mailbox.go b/pkg/utils/mailbox/mailbox.go index 6b84eb5246..3228058f74 100644 --- a/pkg/utils/mailbox/mailbox.go +++ b/pkg/utils/mailbox/mailbox.go @@ -33,7 +33,7 @@ func NewSingle[T any]() *Mailbox[T] { return New[T](1) } // New creates a new mailbox instance. If name is non-empty, it must be unique and calling Start will launch // prometheus metric monitor that periodically reports mailbox load until Close() is called. -func New[T any](capacity uint64) *Mailbox[T] { +func New[T any](capacity uint32) *Mailbox[T] { queueCap := capacity if queueCap == 0 { queueCap = 100 @@ -41,7 +41,7 @@ func New[T any](capacity uint64) *Mailbox[T] { return &Mailbox[T]{ chNotify: make(chan struct{}, 1), queue: make([]T, 0, queueCap), - capacity: capacity, + capacity: uint64(capacity), } } From 2a1d70d1384b20efab773a939e93911c916f4734 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Fri, 15 Aug 2025 13:23:22 -0700 Subject: [PATCH 3/5] test: non-breaking change --- pkg/utils/mailbox/mailbox.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/utils/mailbox/mailbox.go b/pkg/utils/mailbox/mailbox.go index 3228058f74..08aba8a89d 100644 --- a/pkg/utils/mailbox/mailbox.go +++ b/pkg/utils/mailbox/mailbox.go @@ -31,6 +31,9 @@ func NewHighCapacity[T any]() *Mailbox[T] { // NewSingle returns a new Mailbox with capacity one. func NewSingle[T any]() *Mailbox[T] { return New[T](1) } +// NewSingleDuplicate copies the above function to demonstrate API analysis +func NewSingleDuplicate[T any]() *Mailbox[T] { return New[T](1) } + // New creates a new mailbox instance. If name is non-empty, it must be unique and calling Start will launch // prometheus metric monitor that periodically reports mailbox load until Close() is called. func New[T any](capacity uint32) *Mailbox[T] { From 70e6855e1a07dc856601ec66b33779c92818c581 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Fri, 15 Aug 2025 16:26:04 -0700 Subject: [PATCH 4/5] test: modified modules --- .github/workflows/api-diff.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/api-diff.yml b/.github/workflows/api-diff.yml index f1702bb2c5..09fca0949f 100644 --- a/.github/workflows/api-diff.yml +++ b/.github/workflows/api-diff.yml @@ -23,9 +23,12 @@ jobs: go-version-file: "go.mod" cache: false + - uses: smartcontractkit/.github/actions/changed-modules-go@feat/changed-modules-go + id: changed-modules + - uses: smartcontractkit/.github/actions/apidiff-go@apidiff-go/0.1.0 env: GITHUB_TOKEN: ${{ github.token }} with: - go-mod-paths: "./" + go-mod-paths: "${{ steps.changed-modules.outputs.modified-modules }}" enforce-compatible: "false" # dont fail on breaking changes From 7f796d137876d0e6562a67b1e133143f68cbd123 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Fri, 15 Aug 2025 16:48:21 -0700 Subject: [PATCH 5/5] test: new breaking change --- pkg/monitoring/monitor.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/monitoring/monitor.go b/pkg/monitoring/monitor.go index dd158a0264..761cf271a0 100644 --- a/pkg/monitoring/monitor.go +++ b/pkg/monitoring/monitor.go @@ -42,6 +42,8 @@ type Monitor struct { Manager Manager HTTPServer HTTPServer + + NewParam uint64 } // NewMonitor builds a new Monitor instance using dependency injection. @@ -56,6 +58,7 @@ func NewMonitor( txResultsSourceFactory SourceFactory, feedsParser FeedsParser, nodesParser NodesParser, + newParam uint64, ) (*Monitor, error) { cfg, err := config.Parse() if err != nil { @@ -147,6 +150,7 @@ func NewMonitor( RDDPoller: rddPoller, Manager: manager, HTTPServer: httpServer, + NewParam: newParam, }, nil }