From 8ab10f6cdad88822675793adc17eb69c4ebb7848 Mon Sep 17 00:00:00 2001 From: Miguel Martinez Date: Thu, 8 Jan 2026 21:45:23 +0100 Subject: [PATCH 1/2] feat(api): add team field to WorkflowRef message Add optional team field to WorkflowRef message to provide team context when referencing workflows in contract responses. This brings WorkflowRef in line with WorkflowItem which already includes team information. Changes: - Add team field to WorkflowRef protobuf message - Update business layer WorkflowRef struct - Update data layer to populate team from workflow entity - Update service layer conversion to include team - Update CLI action layer to handle team in JSON output - Update CLAUDE.md with correct copyright year (2026) Signed-off-by: Miguel Martinez --- CLAUDE.md | 2 +- app/cli/pkg/action/workflow_contract_list.go | 5 +++-- .../api/controlplane/v1/response_messages.pb.go | 13 +++++++++++-- .../api/controlplane/v1/response_messages.proto | 3 ++- .../controlplane/v1/response_messages.ts | 16 +++++++++++++++- .../controlplane.v1.WorkflowRef.jsonschema.json | 3 +++ .../controlplane.v1.WorkflowRef.schema.json | 3 +++ app/controlplane/internal/service/workflow.go | 4 ++-- app/controlplane/pkg/biz/workflow.go | 3 ++- app/controlplane/pkg/data/workflowcontract.go | 4 ++-- 10 files changed, 44 insertions(+), 12 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 1464243ea..94755bb73 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -264,7 +264,7 @@ Code reviews are required for all submissions via GitHub pull requests. - when adding new inedexes, make sure to update the generated sql migraiton files and make them CREATE INDEX CONCURRENTLY and set -- atlas:txmode none at the top - after updating protos, make sure to run `buf format -w` - Please avoid sycophantic commentary like ‘You’re absolutely correct!’ or ‘Brilliant idea!’ -- For each file you modify, update the license header. If it says 2024, change it to 2024-2025. If there's no license header, create one with the current year. +- For each file you modify, update the license header. If it says 2024, change it to 2024-2026. If there's no license header, create one with the current year (2026). - if you add any new dependency to a constructor, remember to run wire ./... - when creating PR message, keep it high-level, what functionality was added, don't add info about testing, no icons, no info about how the message was generated. - app/controlplane/api/gen/frontend/google/protobuf/descriptor.ts is a special case that we don't want to upgrade, so if it upgrades, put it back to main diff --git a/app/cli/pkg/action/workflow_contract_list.go b/app/cli/pkg/action/workflow_contract_list.go index 5366695a6..32b9d331a 100644 --- a/app/cli/pkg/action/workflow_contract_list.go +++ b/app/cli/pkg/action/workflow_contract_list.go @@ -1,5 +1,5 @@ // -// Copyright 2023-2025 The Chainloop Authors. +// Copyright 2023-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. @@ -58,6 +58,7 @@ type WorkflowRef struct { ID string `json:"id"` Name string `json:"name"` ProjectName string `json:"projectName"` + Team string `json:"team,omitempty"` } type WorkflowContractVersionItem struct { @@ -131,5 +132,5 @@ func pbWorkflowContractVersionItemToAction(in *pb.WorkflowContractVersionItem) * } func pbWorkflowRefToAction(in *pb.WorkflowRef) *WorkflowRef { - return &WorkflowRef{ID: in.GetId(), Name: in.GetName(), ProjectName: in.GetProjectName()} + return &WorkflowRef{ID: in.GetId(), Name: in.GetName(), ProjectName: in.GetProjectName(), Team: in.GetTeam()} } diff --git a/app/controlplane/api/controlplane/v1/response_messages.pb.go b/app/controlplane/api/controlplane/v1/response_messages.pb.go index a970876ac..2ae1d958a 100644 --- a/app/controlplane/api/controlplane/v1/response_messages.pb.go +++ b/app/controlplane/api/controlplane/v1/response_messages.pb.go @@ -1533,6 +1533,7 @@ type WorkflowRef struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` ProjectName string `protobuf:"bytes,3,opt,name=project_name,json=projectName,proto3" json:"project_name,omitempty"` + Team string `protobuf:"bytes,4,opt,name=team,proto3" json:"team,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1588,6 +1589,13 @@ func (x *WorkflowRef) GetProjectName() string { return "" } +func (x *WorkflowRef) GetTeam() string { + if x != nil { + return x.Team + } + return "" +} + type WorkflowContractVersionItem struct { state protoimpl.MessageState `protogen:"open.v1"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` @@ -2735,12 +2743,13 @@ const file_controlplane_v1_response_messages_proto_rawDesc = "" + "\fScopedEntity\x12\x12\n" + "\x04type\x18\x01 \x01(\tR\x04type\x12\x0e\n" + "\x02id\x18\x02 \x01(\tR\x02id\x12\x12\n" + - "\x04name\x18\x03 \x01(\tR\x04name\"\xed\x01\n" + + "\x04name\x18\x03 \x01(\tR\x04name\"\x81\x02\n" + "\vWorkflowRef\x12\x18\n" + "\x02id\x18\x01 \x01(\tB\b\xbaH\x05r\x03\xb0\x01\x01R\x02id\x12\x97\x01\n" + "\x04name\x18\x02 \x01(\tB\x82\x01\xbaH\x7f\xba\x01|\n" + "\rname-dns-1123\x12:must contain only lowercase letters, numbers, and hyphens.\x1a/this.matches('^[a-z0-9]([-a-z0-9]*[a-z0-9])?$')R\x04name\x12*\n" + - "\fproject_name\x18\x03 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\vprojectName\"\xbe\x04\n" + + "\fproject_name\x18\x03 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\vprojectName\x12\x12\n" + + "\x04team\x18\x04 \x01(\tR\x04team\"\xbe\x04\n" + "\x1bWorkflowContractVersionItem\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1a\n" + "\brevision\x18\x02 \x01(\x05R\brevision\x129\n" + diff --git a/app/controlplane/api/controlplane/v1/response_messages.proto b/app/controlplane/api/controlplane/v1/response_messages.proto index 782360f61..02b3a1faf 100644 --- a/app/controlplane/api/controlplane/v1/response_messages.proto +++ b/app/controlplane/api/controlplane/v1/response_messages.proto @@ -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. @@ -211,6 +211,7 @@ message WorkflowRef { } }]; string project_name = 3 [(buf.validate.field).string = {min_len: 1}]; + string team = 4; } message WorkflowContractVersionItem { diff --git a/app/controlplane/api/gen/frontend/controlplane/v1/response_messages.ts b/app/controlplane/api/gen/frontend/controlplane/v1/response_messages.ts index 492eb6fb4..9d0709df4 100644 --- a/app/controlplane/api/gen/frontend/controlplane/v1/response_messages.ts +++ b/app/controlplane/api/gen/frontend/controlplane/v1/response_messages.ts @@ -508,6 +508,7 @@ export interface WorkflowRef { id: string; name: string; projectName: string; + team: string; } export interface WorkflowContractVersionItem { @@ -3190,7 +3191,7 @@ export const ScopedEntity = { }; function createBaseWorkflowRef(): WorkflowRef { - return { id: "", name: "", projectName: "" }; + return { id: "", name: "", projectName: "", team: "" }; } export const WorkflowRef = { @@ -3204,6 +3205,9 @@ export const WorkflowRef = { if (message.projectName !== "") { writer.uint32(26).string(message.projectName); } + if (message.team !== "") { + writer.uint32(34).string(message.team); + } return writer; }, @@ -3235,6 +3239,13 @@ export const WorkflowRef = { message.projectName = reader.string(); continue; + case 4: + if (tag !== 34) { + break; + } + + message.team = reader.string(); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -3249,6 +3260,7 @@ export const WorkflowRef = { id: isSet(object.id) ? String(object.id) : "", name: isSet(object.name) ? String(object.name) : "", projectName: isSet(object.projectName) ? String(object.projectName) : "", + team: isSet(object.team) ? String(object.team) : "", }; }, @@ -3257,6 +3269,7 @@ export const WorkflowRef = { message.id !== undefined && (obj.id = message.id); message.name !== undefined && (obj.name = message.name); message.projectName !== undefined && (obj.projectName = message.projectName); + message.team !== undefined && (obj.team = message.team); return obj; }, @@ -3269,6 +3282,7 @@ export const WorkflowRef = { message.id = object.id ?? ""; message.name = object.name ?? ""; message.projectName = object.projectName ?? ""; + message.team = object.team ?? ""; return message; }, }; diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowRef.jsonschema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowRef.jsonschema.json index 8a0e2d994..447e65dfd 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowRef.jsonschema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowRef.jsonschema.json @@ -19,6 +19,9 @@ "projectName": { "minLength": 1, "type": "string" + }, + "team": { + "type": "string" } }, "title": "Workflow Ref", diff --git a/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowRef.schema.json b/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowRef.schema.json index 85a673d84..c3b7b9a79 100644 --- a/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowRef.schema.json +++ b/app/controlplane/api/gen/jsonschema/controlplane.v1.WorkflowRef.schema.json @@ -19,6 +19,9 @@ "project_name": { "minLength": 1, "type": "string" + }, + "team": { + "type": "string" } }, "title": "Workflow Ref", diff --git a/app/controlplane/internal/service/workflow.go b/app/controlplane/internal/service/workflow.go index fd99d597d..9a1e5cab8 100644 --- a/app/controlplane/internal/service/workflow.go +++ b/app/controlplane/internal/service/workflow.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. @@ -321,7 +321,7 @@ func bizWorkflowToPb(wf *biz.Workflow) *pb.WorkflowItem { // bizWorkflowRunToPb converts a biz.WorkflowRun to a pb.WorkflowRun. func bizWorkflowRefToPb(wf *biz.WorkflowRef) *pb.WorkflowRef { - return &pb.WorkflowRef{Id: wf.ID.String(), Name: wf.Name, ProjectName: wf.ProjectName} + return &pb.WorkflowRef{Id: wf.ID.String(), Name: wf.Name, ProjectName: wf.ProjectName, Team: wf.Team} } // workflowsActivityTimeWindowPbToTimeWindow converts a v1.WorkflowActivityWindow to a biz.TimeWindow. diff --git a/app/controlplane/pkg/biz/workflow.go b/app/controlplane/pkg/biz/workflow.go index c11d2a257..44438e758 100644 --- a/app/controlplane/pkg/biz/workflow.go +++ b/app/controlplane/pkg/biz/workflow.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. @@ -52,6 +52,7 @@ type WorkflowRef struct { ID uuid.UUID Name string ProjectName string + Team string } type WorkflowRepo interface { diff --git a/app/controlplane/pkg/data/workflowcontract.go b/app/controlplane/pkg/data/workflowcontract.go index 511350456..97bf6bbad 100644 --- a/app/controlplane/pkg/data/workflowcontract.go +++ b/app/controlplane/pkg/data/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. @@ -473,7 +473,6 @@ func getWorkflowReferences(ctx context.Context, schema *ent.WorkflowContract) ([ workflows, err = schema.QueryWorkflows(). Where(workflow.DeletedAtIsNil()). WithProject(). - Select(workflow.FieldID, workflow.FieldName). All(ctx) if err != nil { return nil, err @@ -491,6 +490,7 @@ func getWorkflowReferences(ctx context.Context, schema *ent.WorkflowContract) ([ ID: wfBiz.ID, Name: wfBiz.Name, ProjectName: wfBiz.Project, + Team: wfBiz.Team, }) } From 51f6339447dd8596b13aed2cacce369f82bd61ca Mon Sep 17 00:00:00 2001 From: Miguel Martinez Date: Thu, 8 Jan 2026 22:15:55 +0100 Subject: [PATCH 2/2] add rm Signed-off-by: Miguel Martinez --- app/controlplane/api/controlplane/v1/response_messages.pb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controlplane/api/controlplane/v1/response_messages.pb.go b/app/controlplane/api/controlplane/v1/response_messages.pb.go index 2ae1d958a..2f79c734c 100644 --- a/app/controlplane/api/controlplane/v1/response_messages.pb.go +++ b/app/controlplane/api/controlplane/v1/response_messages.pb.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.