From 315fd5872eee3196c732857f0207e361536c3f82 Mon Sep 17 00:00:00 2001 From: Sylwester Piskozub Date: Tue, 10 Mar 2026 10:54:57 +0100 Subject: [PATCH 1/4] feat(contract): change apply response from unchanged to changed Signed-off-by: Sylwester Piskozub --- app/cli/cmd/apply.go | 6 +++--- app/cli/cmd/workflow_contract_apply.go | 10 +++++----- app/cli/pkg/action/apply.go | 12 ++++++------ app/cli/pkg/action/workflow_contract_apply.go | 6 +++--- .../controlplane/v1/workflow_contract.pb.go | 14 +++++++------- .../controlplane/v1/workflow_contract.proto | 4 ++-- .../controlplane/v1/workflow_contract.ts | 18 +++++++++--------- ...ontractServiceApplyResponse.jsonschema.json | 8 ++++---- ...lowContractServiceApplyResponse.schema.json | 8 ++++---- .../internal/service/workflowcontract.go | 4 ++-- app/controlplane/pkg/biz/workflowcontract.go | 12 ++++++------ 11 files changed, 51 insertions(+), 51 deletions(-) diff --git a/app/cli/cmd/apply.go b/app/cli/cmd/apply.go index a1d1d0504..e8443cd9e 100644 --- a/app/cli/cmd/apply.go +++ b/app/cli/cmd/apply.go @@ -40,9 +40,9 @@ Supports multi-document YAML files. Each document must have a 'kind' field.`, } for _, r := range results { - status := "applied" - if r.Unchanged { - status = "unchanged" + status := "unchanged" + if r.Changed { + status = "applied" } logger.Info().Msgf("%s/%s %s", r.Kind, r.Name, status) } diff --git a/app/cli/cmd/workflow_contract_apply.go b/app/cli/cmd/workflow_contract_apply.go index 70614d43b..2fc60f5bb 100644 --- a/app/cli/cmd/workflow_contract_apply.go +++ b/app/cli/cmd/workflow_contract_apply.go @@ -1,5 +1,5 @@ // -// Copyright 2025 The Chainloop Authors. +// Copyright 2025-2026 The Chainloop Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -48,14 +48,14 @@ or update it if it already exists.`, desc = &description } - res, unchanged, err := action.NewWorkflowContractApply(ActionOpts).Run(cmd.Context(), contractName, contractPath, desc, projectName) + res, changed, err := action.NewWorkflowContractApply(ActionOpts).Run(cmd.Context(), contractName, contractPath, desc, projectName) if err != nil { return err } - status := "applied" - if unchanged { - status = "unchanged" + status := "unchanged" + if changed { + status = "applied" } logger.Info().Msgf("Contract/%s %s", contractName, status) return output.EncodeOutput(flagOutputFormat, res, contractItemTableOutput) diff --git a/app/cli/pkg/action/apply.go b/app/cli/pkg/action/apply.go index 022c31146..dd5977e53 100644 --- a/app/cli/pkg/action/apply.go +++ b/app/cli/pkg/action/apply.go @@ -36,9 +36,9 @@ const ( // ApplyResult holds the outcome of a successfully applied resource document type ApplyResult struct { - Kind string - Name string - Unchanged bool + Kind string + Name string + Changed bool } // YAMLDoc holds a parsed YAML document with its kind and raw bytes @@ -70,11 +70,11 @@ func (a *Apply) Run(ctx context.Context, path string) ([]*ApplyResult, error) { for _, doc := range docs { switch doc.Kind { case KindContract: - unchanged, err := ApplyContractFromRawData(ctx, a.cfg.CPConnection, doc.RawData) + changed, err := ApplyContractFromRawData(ctx, a.cfg.CPConnection, doc.RawData) if err != nil { return results, fmt.Errorf("%s/%s: %w", doc.Kind, doc.Name, err) } - results = append(results, &ApplyResult{Kind: doc.Kind, Name: doc.Name, Unchanged: unchanged}) + results = append(results, &ApplyResult{Kind: doc.Kind, Name: doc.Name, Changed: changed}) default: return results, fmt.Errorf("unsupported kind %q", doc.Kind) } @@ -124,7 +124,7 @@ func ApplyContractFromRawData(ctx context.Context, conn *grpc.ClientConn, rawDat return false, fmt.Errorf("failed to apply contract: %w", err) } - return resp.GetUnchanged(), nil + return resp.GetChanged(), nil } // CollectYAMLFiles returns YAML file paths from the given path. diff --git a/app/cli/pkg/action/workflow_contract_apply.go b/app/cli/pkg/action/workflow_contract_apply.go index a86ae8389..da2de6d68 100644 --- a/app/cli/pkg/action/workflow_contract_apply.go +++ b/app/cli/pkg/action/workflow_contract_apply.go @@ -1,5 +1,5 @@ // -// Copyright 2025 The Chainloop Authors. +// Copyright 2025-2026 The Chainloop Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -64,9 +64,9 @@ func (action *WorkflowContractApply) Run(ctx context.Context, contractName strin return nil, false, fmt.Errorf("failed to update existing contract '%s': %w", contractName, err) } - unchanged := prevRevision == res.Result.GetRevision().GetRevision() + changed := prevRevision != res.Result.GetRevision().GetRevision() - return pbWorkflowContractItemToAction(res.Result.Contract), unchanged, nil + return pbWorkflowContractItemToAction(res.Result.Contract), changed, nil } // Contract doesn't exist, perform create diff --git a/app/controlplane/api/controlplane/v1/workflow_contract.pb.go b/app/controlplane/api/controlplane/v1/workflow_contract.pb.go index c69e06870..070890996 100644 --- a/app/controlplane/api/controlplane/v1/workflow_contract.pb.go +++ b/app/controlplane/api/controlplane/v1/workflow_contract.pb.go @@ -560,8 +560,8 @@ func (x *WorkflowContractServiceApplyRequest) GetRawSchema() []byte { type WorkflowContractServiceApplyResponse struct { state protoimpl.MessageState `protogen:"open.v1"` Result *WorkflowContractItem `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` - // Whether the resource was unchanged - Unchanged bool `protobuf:"varint,2,opt,name=unchanged,proto3" json:"unchanged,omitempty"` + // Whether the resource was changed + Changed bool `protobuf:"varint,2,opt,name=changed,proto3" json:"changed,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -603,9 +603,9 @@ func (x *WorkflowContractServiceApplyResponse) GetResult() *WorkflowContractItem return nil } -func (x *WorkflowContractServiceApplyResponse) GetUnchanged() bool { +func (x *WorkflowContractServiceApplyResponse) GetChanged() bool { if x != nil { - return x.Unchanged + return x.Changed } return false } @@ -757,10 +757,10 @@ const file_controlplane_v1_workflow_contract_proto_rawDesc = "" + "%WorkflowContractServiceDeleteResponse\"D\n" + "#WorkflowContractServiceApplyRequest\x12\x1d\n" + "\n" + - "raw_schema\x18\x01 \x01(\fR\trawSchema\"\x83\x01\n" + + "raw_schema\x18\x01 \x01(\fR\trawSchema\"\x7f\n" + "$WorkflowContractServiceApplyResponse\x12=\n" + - "\x06result\x18\x01 \x01(\v2%.controlplane.v1.WorkflowContractItemR\x06result\x12\x1c\n" + - "\tunchanged\x18\x02 \x01(\bR\tunchanged2\xec\x05\n" + + "\x06result\x18\x01 \x01(\v2%.controlplane.v1.WorkflowContractItemR\x06result\x12\x18\n" + + "\achanged\x18\x02 \x01(\bR\achanged2\xec\x05\n" + "\x17WorkflowContractService\x12q\n" + "\x04List\x123.controlplane.v1.WorkflowContractServiceListRequest\x1a4.controlplane.v1.WorkflowContractServiceListResponse\x12w\n" + "\x06Create\x125.controlplane.v1.WorkflowContractServiceCreateRequest\x1a6.controlplane.v1.WorkflowContractServiceCreateResponse\x12w\n" + diff --git a/app/controlplane/api/controlplane/v1/workflow_contract.proto b/app/controlplane/api/controlplane/v1/workflow_contract.proto index 36f37c027..3b71ebd09 100644 --- a/app/controlplane/api/controlplane/v1/workflow_contract.proto +++ b/app/controlplane/api/controlplane/v1/workflow_contract.proto @@ -123,6 +123,6 @@ message WorkflowContractServiceApplyRequest { message WorkflowContractServiceApplyResponse { WorkflowContractItem result = 1; - // Whether the resource was unchanged - bool unchanged = 2; + // Whether the resource was changed + bool changed = 2; } diff --git a/app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts b/app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts index ef5fbd321..a8025b0dd 100644 --- a/app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts +++ b/app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts @@ -73,8 +73,8 @@ export interface WorkflowContractServiceApplyRequest { export interface WorkflowContractServiceApplyResponse { result?: WorkflowContractItem; - /** Whether the resource was unchanged */ - unchanged: boolean; + /** Whether the resource was changed */ + changed: boolean; } function createBaseWorkflowContractServiceListRequest(): WorkflowContractServiceListRequest { @@ -992,7 +992,7 @@ export const WorkflowContractServiceApplyRequest = { }; function createBaseWorkflowContractServiceApplyResponse(): WorkflowContractServiceApplyResponse { - return { result: undefined, unchanged: false }; + return { result: undefined, changed: false }; } export const WorkflowContractServiceApplyResponse = { @@ -1000,8 +1000,8 @@ export const WorkflowContractServiceApplyResponse = { if (message.result !== undefined) { WorkflowContractItem.encode(message.result, writer.uint32(10).fork()).ldelim(); } - if (message.unchanged === true) { - writer.uint32(16).bool(message.unchanged); + if (message.changed === true) { + writer.uint32(16).bool(message.changed); } return writer; }, @@ -1025,7 +1025,7 @@ export const WorkflowContractServiceApplyResponse = { break; } - message.unchanged = reader.bool(); + message.changed = reader.bool(); continue; } if ((tag & 7) === 4 || tag === 0) { @@ -1039,7 +1039,7 @@ export const WorkflowContractServiceApplyResponse = { fromJSON(object: any): WorkflowContractServiceApplyResponse { return { result: isSet(object.result) ? WorkflowContractItem.fromJSON(object.result) : undefined, - unchanged: isSet(object.unchanged) ? Boolean(object.unchanged) : false, + changed: isSet(object.changed) ? Boolean(object.changed) : false, }; }, @@ -1047,7 +1047,7 @@ export const WorkflowContractServiceApplyResponse = { const obj: any = {}; message.result !== undefined && (obj.result = message.result ? WorkflowContractItem.toJSON(message.result) : undefined); - message.unchanged !== undefined && (obj.unchanged = message.unchanged); + message.changed !== undefined && (obj.changed = message.changed); return obj; }, @@ -1064,7 +1064,7 @@ export const WorkflowContractServiceApplyResponse = { message.result = (object.result !== undefined && object.result !== null) ? WorkflowContractItem.fromPartial(object.result) : undefined; - message.unchanged = object.unchanged ?? false; + message.changed = object.changed ?? false; return message; }, }; diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.jsonschema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.jsonschema.json index bd89a7702..4244a2cb9 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.jsonschema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.jsonschema.json @@ -3,12 +3,12 @@ "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, "properties": { + "changed": { + "description": "Whether the resource was changed", + "type": "boolean" + }, "result": { "$ref": "controlplane.v1.WorkflowContractItem.jsonschema.json" - }, - "unchanged": { - "description": "Whether the resource was unchanged", - "type": "boolean" } }, "title": "Workflow Contract Service Apply Response", diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.schema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.schema.json index 25a2e806b..f28927fa4 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.schema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.schema.json @@ -3,12 +3,12 @@ "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, "properties": { + "changed": { + "description": "Whether the resource was changed", + "type": "boolean" + }, "result": { "$ref": "controlplane.v1.WorkflowContractItem.schema.json" - }, - "unchanged": { - "description": "Whether the resource was unchanged", - "type": "boolean" } }, "title": "Workflow Contract Service Apply Response", diff --git a/app/controlplane/internal/service/workflowcontract.go b/app/controlplane/internal/service/workflowcontract.go index c3c7bdca7..d75be7dc4 100644 --- a/app/controlplane/internal/service/workflowcontract.go +++ b/app/controlplane/internal/service/workflowcontract.go @@ -276,8 +276,8 @@ func (s *WorkflowContractService) Apply(ctx context.Context, req *pb.WorkflowCon } return &pb.WorkflowContractServiceApplyResponse{ - Result: bizWorkFlowContractToPb(schemaWithVersion.Contract), - Unchanged: schemaWithVersion.Unchanged, + Result: bizWorkFlowContractToPb(schemaWithVersion.Contract), + Changed: schemaWithVersion.Changed, }, nil } diff --git a/app/controlplane/pkg/biz/workflowcontract.go b/app/controlplane/pkg/biz/workflowcontract.go index e3a9ab0ad..e538cf37c 100644 --- a/app/controlplane/pkg/biz/workflowcontract.go +++ b/app/controlplane/pkg/biz/workflowcontract.go @@ -90,9 +90,9 @@ func (c *Contract) isV1Schema() bool { } type WorkflowContractWithVersion struct { - Contract *WorkflowContract - Version *WorkflowContractVersion - Unchanged bool + Contract *WorkflowContract + Version *WorkflowContractVersion + Changed bool } type WorkflowContractRepo interface { @@ -426,15 +426,15 @@ func (uc *WorkflowContractUseCase) Update(ctx context.Context, orgID, name strin } // Check if the revisions have changed - unchanged := wfContractPreUpdate.LatestRevision == c.Version.Revision - if !unchanged { + changed := wfContractPreUpdate.LatestRevision != c.Version.Revision + if changed { eventPayload.NewRevision = &c.Version.Revision eventPayload.NewRevisionID = &c.Version.ID } uc.auditorUC.Dispatch(ctx, eventPayload, &orgUUID) - c.Unchanged = unchanged + c.Changed = changed return c, nil } From a2dee0cc6737575e5c656b57ce14b49bf8885fa0 Mon Sep 17 00:00:00 2001 From: Sylwester Piskozub Date: Tue, 10 Mar 2026 11:03:07 +0100 Subject: [PATCH 2/4] proto fix Signed-off-by: Sylwester Piskozub --- .../api/controlplane/v1/workflow_contract.pb.go | 6 +++--- .../api/controlplane/v1/workflow_contract.proto | 3 ++- .../api/gen/frontend/controlplane/v1/workflow_contract.ts | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/controlplane/api/controlplane/v1/workflow_contract.pb.go b/app/controlplane/api/controlplane/v1/workflow_contract.pb.go index 070890996..d5cd27287 100644 --- a/app/controlplane/api/controlplane/v1/workflow_contract.pb.go +++ b/app/controlplane/api/controlplane/v1/workflow_contract.pb.go @@ -561,7 +561,7 @@ type WorkflowContractServiceApplyResponse struct { state protoimpl.MessageState `protogen:"open.v1"` Result *WorkflowContractItem `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` // Whether the resource was changed - Changed bool `protobuf:"varint,2,opt,name=changed,proto3" json:"changed,omitempty"` + Changed bool `protobuf:"varint,3,opt,name=changed,proto3" json:"changed,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -757,10 +757,10 @@ const file_controlplane_v1_workflow_contract_proto_rawDesc = "" + "%WorkflowContractServiceDeleteResponse\"D\n" + "#WorkflowContractServiceApplyRequest\x12\x1d\n" + "\n" + - "raw_schema\x18\x01 \x01(\fR\trawSchema\"\x7f\n" + + "raw_schema\x18\x01 \x01(\fR\trawSchema\"\x85\x01\n" + "$WorkflowContractServiceApplyResponse\x12=\n" + "\x06result\x18\x01 \x01(\v2%.controlplane.v1.WorkflowContractItemR\x06result\x12\x18\n" + - "\achanged\x18\x02 \x01(\bR\achanged2\xec\x05\n" + + "\achanged\x18\x03 \x01(\bR\achangedJ\x04\b\x02\x10\x032\xec\x05\n" + "\x17WorkflowContractService\x12q\n" + "\x04List\x123.controlplane.v1.WorkflowContractServiceListRequest\x1a4.controlplane.v1.WorkflowContractServiceListResponse\x12w\n" + "\x06Create\x125.controlplane.v1.WorkflowContractServiceCreateRequest\x1a6.controlplane.v1.WorkflowContractServiceCreateResponse\x12w\n" + diff --git a/app/controlplane/api/controlplane/v1/workflow_contract.proto b/app/controlplane/api/controlplane/v1/workflow_contract.proto index 3b71ebd09..3846c20aa 100644 --- a/app/controlplane/api/controlplane/v1/workflow_contract.proto +++ b/app/controlplane/api/controlplane/v1/workflow_contract.proto @@ -123,6 +123,7 @@ message WorkflowContractServiceApplyRequest { message WorkflowContractServiceApplyResponse { WorkflowContractItem result = 1; + reserved 2; // Whether the resource was changed - bool changed = 2; + bool changed = 3; } diff --git a/app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts b/app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts index a8025b0dd..b7b839acf 100644 --- a/app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts +++ b/app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts @@ -1001,7 +1001,7 @@ export const WorkflowContractServiceApplyResponse = { WorkflowContractItem.encode(message.result, writer.uint32(10).fork()).ldelim(); } if (message.changed === true) { - writer.uint32(16).bool(message.changed); + writer.uint32(24).bool(message.changed); } return writer; }, @@ -1020,8 +1020,8 @@ export const WorkflowContractServiceApplyResponse = { message.result = WorkflowContractItem.decode(reader, reader.uint32()); continue; - case 2: - if (tag !== 16) { + case 3: + if (tag !== 24) { break; } From c4aadb1ff2007072a332c7ca79e274307ae2dcb9 Mon Sep 17 00:00:00 2001 From: Sylwester Piskozub Date: Tue, 10 Mar 2026 11:09:19 +0100 Subject: [PATCH 3/4] proto fix Signed-off-by: Sylwester Piskozub --- .../controlplane/v1/workflow_contract.pb.go | 19 ++++++++++++++--- .../controlplane/v1/workflow_contract.proto | 3 ++- .../controlplane/v1/workflow_contract.ts | 21 ++++++++++++++++++- ...ntractServiceApplyResponse.jsonschema.json | 4 ++++ ...owContractServiceApplyResponse.schema.json | 4 ++++ 5 files changed, 46 insertions(+), 5 deletions(-) diff --git a/app/controlplane/api/controlplane/v1/workflow_contract.pb.go b/app/controlplane/api/controlplane/v1/workflow_contract.pb.go index d5cd27287..67177e354 100644 --- a/app/controlplane/api/controlplane/v1/workflow_contract.pb.go +++ b/app/controlplane/api/controlplane/v1/workflow_contract.pb.go @@ -560,6 +560,10 @@ func (x *WorkflowContractServiceApplyRequest) GetRawSchema() []byte { type WorkflowContractServiceApplyResponse struct { state protoimpl.MessageState `protogen:"open.v1"` Result *WorkflowContractItem `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` + // Deprecated: use changed instead + // + // Deprecated: Marked as deprecated in controlplane/v1/workflow_contract.proto. + Unchanged bool `protobuf:"varint,2,opt,name=unchanged,proto3" json:"unchanged,omitempty"` // Whether the resource was changed Changed bool `protobuf:"varint,3,opt,name=changed,proto3" json:"changed,omitempty"` unknownFields protoimpl.UnknownFields @@ -603,6 +607,14 @@ func (x *WorkflowContractServiceApplyResponse) GetResult() *WorkflowContractItem return nil } +// Deprecated: Marked as deprecated in controlplane/v1/workflow_contract.proto. +func (x *WorkflowContractServiceApplyResponse) GetUnchanged() bool { + if x != nil { + return x.Unchanged + } + return false +} + func (x *WorkflowContractServiceApplyResponse) GetChanged() bool { if x != nil { return x.Changed @@ -757,10 +769,11 @@ const file_controlplane_v1_workflow_contract_proto_rawDesc = "" + "%WorkflowContractServiceDeleteResponse\"D\n" + "#WorkflowContractServiceApplyRequest\x12\x1d\n" + "\n" + - "raw_schema\x18\x01 \x01(\fR\trawSchema\"\x85\x01\n" + + "raw_schema\x18\x01 \x01(\fR\trawSchema\"\xa1\x01\n" + "$WorkflowContractServiceApplyResponse\x12=\n" + - "\x06result\x18\x01 \x01(\v2%.controlplane.v1.WorkflowContractItemR\x06result\x12\x18\n" + - "\achanged\x18\x03 \x01(\bR\achangedJ\x04\b\x02\x10\x032\xec\x05\n" + + "\x06result\x18\x01 \x01(\v2%.controlplane.v1.WorkflowContractItemR\x06result\x12 \n" + + "\tunchanged\x18\x02 \x01(\bB\x02\x18\x01R\tunchanged\x12\x18\n" + + "\achanged\x18\x03 \x01(\bR\achanged2\xec\x05\n" + "\x17WorkflowContractService\x12q\n" + "\x04List\x123.controlplane.v1.WorkflowContractServiceListRequest\x1a4.controlplane.v1.WorkflowContractServiceListResponse\x12w\n" + "\x06Create\x125.controlplane.v1.WorkflowContractServiceCreateRequest\x1a6.controlplane.v1.WorkflowContractServiceCreateResponse\x12w\n" + diff --git a/app/controlplane/api/controlplane/v1/workflow_contract.proto b/app/controlplane/api/controlplane/v1/workflow_contract.proto index 3846c20aa..e5a9f42b2 100644 --- a/app/controlplane/api/controlplane/v1/workflow_contract.proto +++ b/app/controlplane/api/controlplane/v1/workflow_contract.proto @@ -123,7 +123,8 @@ message WorkflowContractServiceApplyRequest { message WorkflowContractServiceApplyResponse { WorkflowContractItem result = 1; - reserved 2; + // Deprecated: use changed instead + bool unchanged = 2 [deprecated = true]; // Whether the resource was changed bool changed = 3; } diff --git a/app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts b/app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts index b7b839acf..bef4b4026 100644 --- a/app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts +++ b/app/controlplane/api/gen/frontend/controlplane/v1/workflow_contract.ts @@ -73,6 +73,12 @@ export interface WorkflowContractServiceApplyRequest { export interface WorkflowContractServiceApplyResponse { result?: WorkflowContractItem; + /** + * Deprecated: use changed instead + * + * @deprecated + */ + unchanged: boolean; /** Whether the resource was changed */ changed: boolean; } @@ -992,7 +998,7 @@ export const WorkflowContractServiceApplyRequest = { }; function createBaseWorkflowContractServiceApplyResponse(): WorkflowContractServiceApplyResponse { - return { result: undefined, changed: false }; + return { result: undefined, unchanged: false, changed: false }; } export const WorkflowContractServiceApplyResponse = { @@ -1000,6 +1006,9 @@ export const WorkflowContractServiceApplyResponse = { if (message.result !== undefined) { WorkflowContractItem.encode(message.result, writer.uint32(10).fork()).ldelim(); } + if (message.unchanged === true) { + writer.uint32(16).bool(message.unchanged); + } if (message.changed === true) { writer.uint32(24).bool(message.changed); } @@ -1020,6 +1029,13 @@ export const WorkflowContractServiceApplyResponse = { message.result = WorkflowContractItem.decode(reader, reader.uint32()); continue; + case 2: + if (tag !== 16) { + break; + } + + message.unchanged = reader.bool(); + continue; case 3: if (tag !== 24) { break; @@ -1039,6 +1055,7 @@ export const WorkflowContractServiceApplyResponse = { fromJSON(object: any): WorkflowContractServiceApplyResponse { return { result: isSet(object.result) ? WorkflowContractItem.fromJSON(object.result) : undefined, + unchanged: isSet(object.unchanged) ? Boolean(object.unchanged) : false, changed: isSet(object.changed) ? Boolean(object.changed) : false, }; }, @@ -1047,6 +1064,7 @@ export const WorkflowContractServiceApplyResponse = { const obj: any = {}; message.result !== undefined && (obj.result = message.result ? WorkflowContractItem.toJSON(message.result) : undefined); + message.unchanged !== undefined && (obj.unchanged = message.unchanged); message.changed !== undefined && (obj.changed = message.changed); return obj; }, @@ -1064,6 +1082,7 @@ export const WorkflowContractServiceApplyResponse = { message.result = (object.result !== undefined && object.result !== null) ? WorkflowContractItem.fromPartial(object.result) : undefined; + message.unchanged = object.unchanged ?? false; message.changed = object.changed ?? false; return message; }, diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.jsonschema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.jsonschema.json index 4244a2cb9..8a8849ae0 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.jsonschema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.jsonschema.json @@ -9,6 +9,10 @@ }, "result": { "$ref": "controlplane.v1.WorkflowContractItem.jsonschema.json" + }, + "unchanged": { + "description": "Deprecated: use changed instead", + "type": "boolean" } }, "title": "Workflow Contract Service Apply Response", diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.schema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.schema.json index f28927fa4..bff86e520 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.schema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowContractServiceApplyResponse.schema.json @@ -9,6 +9,10 @@ }, "result": { "$ref": "controlplane.v1.WorkflowContractItem.schema.json" + }, + "unchanged": { + "description": "Deprecated: use changed instead", + "type": "boolean" } }, "title": "Workflow Contract Service Apply Response", From 7449a9a87ea9dc4cc19e6caed6bf5fabc3ba6093 Mon Sep 17 00:00:00 2001 From: Sylwester Piskozub Date: Tue, 10 Mar 2026 12:12:59 +0100 Subject: [PATCH 4/4] update create path Signed-off-by: Sylwester Piskozub --- app/cli/pkg/action/workflow_contract_apply.go | 2 +- app/controlplane/internal/service/workflowcontract.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/cli/pkg/action/workflow_contract_apply.go b/app/cli/pkg/action/workflow_contract_apply.go index da2de6d68..764556769 100644 --- a/app/cli/pkg/action/workflow_contract_apply.go +++ b/app/cli/pkg/action/workflow_contract_apply.go @@ -87,5 +87,5 @@ func (action *WorkflowContractApply) Run(ctx context.Context, contractName strin return nil, false, fmt.Errorf("failed to create new contract '%s': %w", contractName, err) } - return pbWorkflowContractItemToAction(res.Result), false, nil + return pbWorkflowContractItemToAction(res.Result), true, nil } diff --git a/app/controlplane/internal/service/workflowcontract.go b/app/controlplane/internal/service/workflowcontract.go index d75be7dc4..b0f9f9596 100644 --- a/app/controlplane/internal/service/workflowcontract.go +++ b/app/controlplane/internal/service/workflowcontract.go @@ -1,5 +1,5 @@ // -// Copyright 2024-2025 The Chainloop Authors. +// Copyright 2024-2026 The Chainloop Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -304,7 +304,7 @@ func (s *WorkflowContractService) Apply(ctx context.Context, req *pb.WorkflowCon return nil, handleUseCaseErr(err, s.log) } - return &pb.WorkflowContractServiceApplyResponse{Result: bizWorkFlowContractToPb(schema)}, nil + return &pb.WorkflowContractServiceApplyResponse{Result: bizWorkFlowContractToPb(schema), Changed: true}, nil } func (s *WorkflowContractService) Delete(ctx context.Context, req *pb.WorkflowContractServiceDeleteRequest) (*pb.WorkflowContractServiceDeleteResponse, error) {