Skip to content

Commit d6fb3d6

Browse files
committed
fix: don't produce duplicate inputs in the transform controller
If Input and Output matches, don't add an extra input for output. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent 2dbc4fd commit d6fb3d6

24 files changed

Lines changed: 167 additions & 92 deletions

File tree

.github/renovate.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"description": "THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.",
3+
"description": "THIS FILE WAS AUTOMATICALLY GENERATED BY KRES, PLEASE DO NOT EDIT.",
44
"prHeader": "Update Request | Renovate Bot",
55
"extends": [
66
":dependencyDashboard",
@@ -32,5 +32,6 @@
3232
]
3333
}
3434
],
35-
"separateMajorMinor": false
35+
"separateMajorMinor": false,
36+
"draftPR": true
3637
}

.github/workflows/slack-notify-ci-failure.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
1+
# THIS FILE WAS AUTOMATICALLY GENERATED BY KRES, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2026-05-10T19:55:35Z by kres 1762ab2.
3+
# Generated on 2026-05-20T15:26:37Z by kres 0c6a8db.
44

55
"on":
66
workflow_run:
@@ -11,14 +11,15 @@
1111
branches:
1212
- main
1313
name: slack-notify-failure
14+
permissions: {}
1415
jobs:
1516
slack-notify:
1617
runs-on:
1718
group: generic
1819
if: github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event != 'pull_request'
1920
steps:
2021
- name: Slack Notify
21-
uses: slackapi/slack-github-action@03ea5433c137af7c0495bc0cad1af10403fc800c # version: v3.0.2
22+
uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # version: v3.0.3
2223
with:
2324
method: chat.postMessage
2425
payload: |
@@ -33,7 +34,7 @@ jobs:
3334
{
3435
"fields": [
3536
{
36-
"text": "${{ github.event.workflow_run.event == 'pull_request' && format('*Pull Request:* {0} (`{1}`)\n<{2}/pull/{3}|{4}>', github.repository, github.ref_name, github.event.repository.html_url, steps.get-pr-number.outputs.pull_request_number, github.event.workflow_run.display_title) || format('*Build:* {0} (`{1}`)\n<{2}/commit/{3}|{4}>', github.repository, github.ref_name, github.event.repository.html_url, github.sha, github.event.workflow_run.display_title) }}",
37+
"text": "${{ format('*Build:* {0} (`{1}`)\n<{2}/commit/{3}|{4}>', github.repository, github.ref_name, github.event.repository.html_url, github.sha, github.event.workflow_run.display_title) }}",
3738
"type": "mrkdwn"
3839
},
3940
{

.github/workflows/slack-notify.yaml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
1+
# THIS FILE WAS AUTOMATICALLY GENERATED BY KRES, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2026-05-10T19:55:35Z by kres 1762ab2.
3+
# Generated on 2026-05-20T15:26:37Z by kres 0c6a8db.
44

55
"on":
66
workflow_run:
@@ -9,6 +9,8 @@
99
types:
1010
- completed
1111
name: slack-notify
12+
permissions:
13+
pull-requests: read
1214
jobs:
1315
slack-notify:
1416
runs-on:
@@ -18,12 +20,24 @@ jobs:
1820
- name: Get PR number
1921
id: get-pr-number
2022
if: github.event.workflow_run.event == 'pull_request'
21-
env:
22-
GH_TOKEN: ${{ github.token }}
23-
run: |
24-
echo pull_request_number=$(gh pr view -R ${{ github.repository }} ${{ github.event.workflow_run.head_repository.owner.login }}:${{ github.event.workflow_run.head_branch }} --json number --jq .number) >> $GITHUB_OUTPUT
23+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # version: v9.0.0
24+
with:
25+
script: |
26+
const prs = await github.rest.pulls.list({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
head: `${context.payload.workflow_run.head_repository.owner.login}:${context.payload.workflow_run.head_branch}`,
30+
state: 'all',
31+
sort: 'updated',
32+
direction: 'desc',
33+
per_page: 1,
34+
})
35+
36+
if (prs.data.length > 0) {
37+
core.setOutput('pull_request_number', prs.data[0].number)
38+
}
2539
- name: Slack Notify
26-
uses: slackapi/slack-github-action@03ea5433c137af7c0495bc0cad1af10403fc800c # version: v3.0.2
40+
uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # version: v3.0.3
2741
with:
2842
method: chat.postMessage
2943
payload: |

.golangci.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
1+
# THIS FILE WAS AUTOMATICALLY GENERATED BY KRES, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2026-02-11T22:21:54Z by kres f3ab59e.
3+
# Generated on 2026-05-20T15:26:37Z by kres 0c6a8db.
44

55
version: "2"
66

@@ -31,8 +31,10 @@ linters:
3131
- funlen
3232
- gochecknoglobals
3333
- gochecknoinits
34+
- goconst # complains about repeated values without understanding code context, it checks comments and logger variables and gives false positives for all of those
3435
- godox
3536
- gomoddirectives
37+
- gomodguard
3638
- gosec
3739
- inamedparam
3840
- ireturn
@@ -71,16 +73,13 @@ linters:
7173
min-complexity: 30
7274
nestif:
7375
min-complexity: 5
74-
goconst:
75-
min-len: 3
76-
min-occurrences: 3
7776
gocritic:
7877
disabled-checks: [ ]
7978
gocyclo:
8079
min-complexity: 20
8180
godot:
8281
scope: declarations
83-
gomodguard: { }
82+
gomodguard_v2: { }
8483
govet:
8584
enable-all: true
8685
lll:

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# syntax = docker/dockerfile-upstream:1.23.0-labs
1+
# syntax = docker/dockerfile-upstream:1.24.0-labs
22

3-
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
3+
# THIS FILE WAS AUTOMATICALLY GENERATED BY KRES, PLEASE DO NOT EDIT.
44
#
5-
# Generated on 2026-05-10T22:33:29Z by kres 1762ab2.
5+
# Generated on 2026-05-20T15:26:37Z by kres 0c6a8db.
66

77
ARG TOOLCHAIN=scratch
88

@@ -11,7 +11,7 @@ FROM ghcr.io/siderolabs/ca-certificates:v1.13.0 AS image-ca-certificates
1111
FROM ghcr.io/siderolabs/fhs:v1.13.0 AS image-fhs
1212

1313
# runs markdownlint
14-
FROM docker.io/oven/bun:1.3.13-alpine AS lint-markdown
14+
FROM docker.io/oven/bun:1.3.14-alpine AS lint-markdown
1515
WORKDIR /src
1616
RUN bun i markdownlint-cli@0.48.0 sentences-per-line@0.5.2
1717
COPY .markdownlint.json .

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
1+
# THIS FILE WAS AUTOMATICALLY GENERATED BY KRES, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2026-05-10T19:55:35Z by kres 1762ab2.
3+
# Generated on 2026-05-20T15:26:37Z by kres 0c6a8db.
44

55
# common variables
66

@@ -20,16 +20,16 @@ REGISTRY ?= ghcr.io
2020
USERNAME ?= cosi-project
2121
REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME)
2222
PROTOBUF_GO_VERSION ?= 1.36.11
23-
GRPC_GO_VERSION ?= 1.6.1
23+
GRPC_GO_VERSION ?= 1.6.2
2424
GRPC_GATEWAY_VERSION ?= 2.29.0
2525
VTPROTOBUF_VERSION ?= 0.6.0
26-
GOIMPORTS_VERSION ?= 0.44.0
26+
GOIMPORTS_VERSION ?= 0.45.0
2727
GOMOCK_VERSION ?= 0.6.0
2828
DEEPCOPY_VERSION ?= v0.5.8
29-
GOLANGCILINT_VERSION ?= v2.11.4
30-
GOFUMPT_VERSION ?= v0.9.2
31-
GO_VERSION ?= 1.26.2
32-
DIS_VULNCHECK_VERSION ?= v0.0.0-20260409114749-05440f84fe69
29+
GOLANGCILINT_VERSION ?= v2.12.2
30+
GOFUMPT_VERSION ?= v0.10.0
31+
GO_VERSION ?= 1.26.3
32+
DIS_VULNCHECK_VERSION ?= v0.0.0-20260430093434-b73e0972e2fb
3333
GO_BUILDFLAGS ?=
3434
GO_BUILDTAGS ?= ,
3535
GO_LDFLAGS ?=

api/v1alpha1/state_grpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/controller/conformance/runtime.go

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,8 @@ func (suite *RuntimeSuite) TestModifyWithResultController() {
474474
suite.Require().NoError(suite.State.Create(suite.ctx, NewStrResource(srcNS, "id", "val-1")))
475475

476476
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
477-
suite.assertStrObjects(targetNS, StrResourceType,
477+
suite.assertStrObjects(
478+
targetNS, StrResourceType,
478479
[]string{"id-out", "id-out-modify-result"},
479480
[]string{"val-1-modified", "val-1-valid"},
480481
),
@@ -490,7 +491,8 @@ func (suite *RuntimeSuite) TestModifyWithResultController() {
490491
suite.Require().NoError(err)
491492

492493
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
493-
suite.assertStrObjects(targetNS, StrResourceType,
494+
suite.assertStrObjects(
495+
targetNS, StrResourceType,
494496
[]string{"id-out", "id-out-modify-result"},
495497
[]string{"val-2-modified", "val-2-valid"},
496498
),
@@ -591,7 +593,8 @@ func (suite *RuntimeSuite) TestQIntToStrController() {
591593
suite.startRuntime(ctx)
592594

593595
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
594-
suite.assertStrObjects(targetNS, StrResourceType,
596+
suite.assertStrObjects(
597+
targetNS, StrResourceType,
595598
[]string{"id1", "id2"},
596599
[]string{"1", "2"},
597600
),
@@ -600,7 +603,8 @@ func (suite *RuntimeSuite) TestQIntToStrController() {
600603
suite.Require().NoError(suite.State.Create(suite.ctx, NewIntResource(srcNS, "id3", 3)))
601604

602605
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
603-
suite.assertStrObjects(targetNS, StrResourceType,
606+
suite.assertStrObjects(
607+
targetNS, StrResourceType,
604608
[]string{"id1", "id2", "id3"},
605609
[]string{"1", "2", "3"},
606610
),
@@ -613,7 +617,8 @@ func (suite *RuntimeSuite) TestQIntToStrController() {
613617
suite.Require().NoError(suite.State.Update(suite.ctx, int2Resource))
614618

615619
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
616-
suite.assertStrObjects(targetNS, StrResourceType,
620+
suite.assertStrObjects(
621+
targetNS, StrResourceType,
617622
[]string{"id1", "id2", "id3"},
618623
[]string{"1", "22", "3"},
619624
),
@@ -630,7 +635,8 @@ func (suite *RuntimeSuite) TestQIntToStrController() {
630635
suite.Require().NoError(suite.State.Destroy(suite.ctx, resource.NewMetadata(srcNS, IntResourceType, "id1", resource.VersionUndefined)))
631636

632637
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
633-
suite.assertStrObjects(targetNS, StrResourceType,
638+
suite.assertStrObjects(
639+
targetNS, StrResourceType,
634640
[]string{"id2", "id3"},
635641
[]string{"22", "3"},
636642
),
@@ -660,7 +666,8 @@ func (suite *RuntimeSuite) TestQIntToStrController() {
660666
suite.Require().NoError(suite.State.Destroy(suite.ctx, resource.NewMetadata(srcNS, IntResourceType, "id2", resource.VersionUndefined)))
661667

662668
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
663-
suite.assertStrObjects(targetNS, StrResourceType,
669+
suite.assertStrObjects(
670+
targetNS, StrResourceType,
664671
[]string{"id3"},
665672
[]string{"3"},
666673
),
@@ -713,7 +720,8 @@ func (suite *RuntimeSuite) TestQFailingController() {
713720
suite.Require().NoError(suite.State.Create(suite.ctx, NewStrResource(srcNS, "id5", "ok")))
714721

715722
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
716-
suite.assertStrObjects(targetNS, StrResourceType,
723+
suite.assertStrObjects(
724+
targetNS, StrResourceType,
717725
[]string{"id5"},
718726
[]string{"ok"},
719727
),
@@ -730,7 +738,8 @@ func (suite *RuntimeSuite) TestQFailingController() {
730738
makeNoFail("id3")
731739

732740
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
733-
suite.assertStrObjects(targetNS, StrResourceType,
741+
suite.assertStrObjects(
742+
targetNS, StrResourceType,
734743
[]string{"id3", "id5"},
735744
[]string{"no fail", "ok"},
736745
),
@@ -740,7 +749,8 @@ func (suite *RuntimeSuite) TestQFailingController() {
740749
makeNoFail("id2")
741750

742751
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
743-
suite.assertStrObjects(targetNS, StrResourceType,
752+
suite.assertStrObjects(
753+
targetNS, StrResourceType,
744754
[]string{"id2", "id3", "id4", "id5"},
745755
[]string{"no fail", "no fail", "no fail", "ok"},
746756
),
@@ -764,7 +774,8 @@ func (suite *RuntimeSuite) TestQIntToStrSleepingController() {
764774
suite.startRuntime(suite.ctx)
765775

766776
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
767-
suite.assertStrObjects(targetNS, StrResourceType,
777+
suite.assertStrObjects(
778+
targetNS, StrResourceType,
768779
[]string{"id1", "id2"},
769780
[]string{"1", "2"},
770781
),
@@ -773,7 +784,8 @@ func (suite *RuntimeSuite) TestQIntToStrSleepingController() {
773784
suite.Require().NoError(suite.State.Create(suite.ctx, NewIntResource(srcNS, "id3", 3)))
774785

775786
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
776-
suite.assertStrObjects(targetNS, StrResourceType,
787+
suite.assertStrObjects(
788+
targetNS, StrResourceType,
777789
[]string{"id1", "id2", "id3"},
778790
[]string{"1", "2", "3"},
779791
),
@@ -793,7 +805,8 @@ func (suite *RuntimeSuite) TestQIntToStrSleepingController() {
793805

794806
// id4 and id5 won't show up, as the controller is blocked on id10s
795807
suite.Assert().NoError(retry.Constant(10*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
796-
suite.assertStrObjects(targetNS, StrResourceType,
808+
suite.assertStrObjects(
809+
targetNS, StrResourceType,
797810
[]string{"id1", "id2", "id3"},
798811
[]string{"1", "2", "3"},
799812
),
@@ -810,7 +823,8 @@ func (suite *RuntimeSuite) TestQIntToStrSleepingController() {
810823

811824
// id4 and id5 should show up
812825
suite.Assert().NoError(retry.Constant(3*time.Second, retry.WithUnits(10*time.Millisecond)).Retry(
813-
suite.assertStrObjects(targetNS, StrResourceType,
826+
suite.assertStrObjects(
827+
targetNS, StrResourceType,
814828
[]string{"id1", "id2", "id3", "id4", "id5"},
815829
[]string{"1", "2", "3", "4", "5"},
816830
),

pkg/controller/generic/qtransform/qtransform.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ func (ctrl *QController[Input, Output]) reconcileRunning(ctx context.Context, lo
259259

260260
return transformError
261261
}); err != nil {
262-
if state.IsConflictError(err,
262+
if state.IsConflictError(
263+
err,
263264
state.WithResourceNamespace(mappedOut.Metadata().Namespace()),
264265
state.WithResourceType(mappedOut.Metadata().Type()),
265266
) {

0 commit comments

Comments
 (0)