Skip to content

Commit 58e3deb

Browse files
committed
feat(api): add has_gates flag and PolicyGatesFilter to workflow run list
Surfaces whether a run had gates in effect (any policy marked gate:true or contract using ENFORCED strategy) on both PolicyStatusSummary and WorkflowRunServiceListRequest. Independent of policy status — a PASSED run can still have has_gates=true. Materialized on workflow_run via a partial index so the list filter is cheap. Also refactored the renderer backfill for historic envelopes to a single pass that derives skipped/passed counts and gate presence together. Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
1 parent e1590b7 commit 58e3deb

28 files changed

Lines changed: 942 additions & 196 deletions

app/controlplane/api/controlplane/v1/response_messages.pb.go

Lines changed: 193 additions & 126 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/response_messages.proto

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,17 @@ message PolicyStatusSummary {
143143
int32 skipped = 4;
144144
// Total number of violations across all evaluations
145145
int32 violated = 5;
146+
// Whether this run had gates in effect — any policy marked gate:true or
147+
// the contract using the ENFORCED blocking strategy. Independent of status:
148+
// a PASSED run can still have has_gates=true.
149+
bool has_gates = 6;
150+
}
151+
152+
// Server-side filter aligned with PolicyStatusSummary.has_gates.
153+
enum PolicyGatesFilter {
154+
POLICY_GATES_FILTER_UNSPECIFIED = 0;
155+
POLICY_GATES_FILTER_WITH_GATES = 1;
156+
POLICY_GATES_FILTER_WITHOUT_GATES = 2;
146157
}
147158

148159
// Server-side filter aligned 1:1 with PolicyStatus values.

app/controlplane/api/controlplane/v1/workflow_run.pb.go

Lines changed: 59 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/workflow_run.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ message WorkflowRunServiceListRequest {
220220
PolicyViolationsFilter policy_violations = 6 [deprecated = true];
221221
// by canonical policy status
222222
PolicyStatusFilter policy_status = 7;
223+
// by whether the run had gates in effect (either a policy marked gate:true
224+
// or the contract using the ENFORCED blocking strategy)
225+
PolicyGatesFilter policy_gates = 8;
223226
// pagination options
224227
CursorPaginationRequest pagination = 2;
225228

app/controlplane/api/gen/frontend/controlplane/v1/response_messages.ts

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

0 commit comments

Comments
 (0)