From 113174dcab9d6c6fdae0a7d544a42f49198542cc Mon Sep 17 00:00:00 2001 From: Sylwester Piskozub Date: Wed, 11 Feb 2026 09:52:12 +0100 Subject: [PATCH 1/3] hide multiple skip reasons for the same kind Signed-off-by: Sylwester Piskozub --- app/cli/cmd/attestation_add.go | 2 +- app/cli/cmd/attestation_status.go | 4 ++-- app/cli/cmd/workflow_workflow_run_describe.go | 15 +++++++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/cli/cmd/attestation_add.go b/app/cli/cmd/attestation_add.go index c8b1720cb..84e2f73ab 100644 --- a/app/cli/cmd/attestation_add.go +++ b/app/cli/cmd/attestation_add.go @@ -209,7 +209,7 @@ func displayMaterialInfo(status *action.AttestationStatusMaterial, policyEvaluat mt.AppendRow(table.Row{"Policy evaluations", "------"}) } - policiesTable(policyEvaluations, mt) + policiesTable(policyEvaluations, mt, flagDebug) mt.SetStyle(table.StyleLight) mt.Style().Options.SeparateRows = true mt.Render() diff --git a/app/cli/cmd/attestation_status.go b/app/cli/cmd/attestation_status.go index b6530a37e..382ac3755 100644 --- a/app/cli/cmd/attestation_status.go +++ b/app/cli/cmd/attestation_status.go @@ -138,7 +138,7 @@ func attestationStatusTableOutput(status *action.AttestationStatusResult, w io.W evs := status.PolicyEvaluations[chainloop.AttPolicyEvaluation] if len(evs) > 0 { gt.AppendRow(table.Row{"Policies", "------"}) - policiesTable(evs, gt) + policiesTable(evs, gt, flagDebug) } // Add the Attestation View URL if available @@ -242,7 +242,7 @@ func materialsTable(status *action.AttestationStatusResult, w io.Writer, full bo evs := status.PolicyEvaluations[m.Name] if len(evs) > 0 { mt.AppendRow(table.Row{"Policies", "------"}) - policiesTable(evs, mt) + policiesTable(evs, mt, flagDebug) } mt.AppendSeparator() diff --git a/app/cli/cmd/workflow_workflow_run_describe.go b/app/cli/cmd/workflow_workflow_run_describe.go index 0e2ede462..3c83ca0cf 100644 --- a/app/cli/cmd/workflow_workflow_run_describe.go +++ b/app/cli/cmd/workflow_workflow_run_describe.go @@ -175,7 +175,7 @@ func workflowRunDescribeTableOutput(run *action.WorkflowRunItemFull) error { evs := att.PolicyEvaluations[chainloop.AttPolicyEvaluation] if len(evs) > 0 { gt.AppendRow(table.Row{"Policies", "------"}) - policiesTable(evs, gt) + policiesTable(evs, gt, flagDebug) } if run.Attestation.AttestationViewURL != "" { @@ -227,7 +227,7 @@ func predicateV1Table(att *action.WorkflowRunAttestationItem) { evs := att.PolicyEvaluations[m.Name] if len(evs) > 0 { mt.AppendRow(table.Row{"Policies", "------"}) - policiesTable(evs, mt) + policiesTable(evs, mt, flagDebug) } mt.AppendSeparator() } @@ -249,13 +249,20 @@ func predicateV1Table(att *action.WorkflowRunAttestationItem) { } } -func policiesTable(evs []*action.PolicyEvaluation, mt table.Writer) { +func policiesTable(evs []*action.PolicyEvaluation, mt table.Writer, debugMode bool) { for _, ev := range evs { msg := "" switch { case ev.Skipped: - msg = text.Colors{text.FgHiYellow}.Sprintf("skipped - %s", strings.Join(ev.SkipReasons, ", ")) + if len(ev.SkipReasons) == 1 { + msg = text.Colors{text.FgHiYellow}.Sprintf("skipped - %s", ev.SkipReasons[0]) + } else if debugMode { + msg = text.Colors{text.FgHiYellow}.Sprintf("skipped - multiple reasons:\n - %s", + strings.Join(ev.SkipReasons, "\n - ")) + } else { + msg = text.Colors{text.FgHiYellow}.Sprint("WARN: the policy was skipped in all execution paths") + } case len(ev.Violations) == 0: msg = text.Colors{text.FgHiGreen}.Sprint("Ok") case len(ev.Violations) > 0: From 24244cf0ffb83ac7030660b7a368aff0fb11e842 Mon Sep 17 00:00:00 2001 From: Sylwester Piskozub Date: Wed, 11 Feb 2026 09:58:30 +0100 Subject: [PATCH 2/3] change msg text Signed-off-by: Sylwester Piskozub --- app/cli/cmd/workflow_workflow_run_describe.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/cli/cmd/workflow_workflow_run_describe.go b/app/cli/cmd/workflow_workflow_run_describe.go index 3c83ca0cf..f4bde0c7f 100644 --- a/app/cli/cmd/workflow_workflow_run_describe.go +++ b/app/cli/cmd/workflow_workflow_run_describe.go @@ -261,7 +261,7 @@ func policiesTable(evs []*action.PolicyEvaluation, mt table.Writer, debugMode bo msg = text.Colors{text.FgHiYellow}.Sprintf("skipped - multiple reasons:\n - %s", strings.Join(ev.SkipReasons, "\n - ")) } else { - msg = text.Colors{text.FgHiYellow}.Sprint("WARN: the policy was skipped in all execution paths") + msg = text.Colors{text.FgHiYellow}.Sprint("the policy was skipped in all execution paths") } case len(ev.Violations) == 0: msg = text.Colors{text.FgHiGreen}.Sprint("Ok") From f416195b71a30140a00a946b7937f7d8789f5af4 Mon Sep 17 00:00:00 2001 From: Sylwester Piskozub Date: Wed, 11 Feb 2026 10:13:55 +0100 Subject: [PATCH 3/3] lint Signed-off-by: Sylwester Piskozub --- app/cli/cmd/workflow_workflow_run_describe.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/cli/cmd/workflow_workflow_run_describe.go b/app/cli/cmd/workflow_workflow_run_describe.go index f4bde0c7f..2f920094c 100644 --- a/app/cli/cmd/workflow_workflow_run_describe.go +++ b/app/cli/cmd/workflow_workflow_run_describe.go @@ -255,12 +255,13 @@ func policiesTable(evs []*action.PolicyEvaluation, mt table.Writer, debugMode bo switch { case ev.Skipped: - if len(ev.SkipReasons) == 1 { + switch { + case len(ev.SkipReasons) == 1: msg = text.Colors{text.FgHiYellow}.Sprintf("skipped - %s", ev.SkipReasons[0]) - } else if debugMode { + case debugMode: msg = text.Colors{text.FgHiYellow}.Sprintf("skipped - multiple reasons:\n - %s", strings.Join(ev.SkipReasons, "\n - ")) - } else { + default: msg = text.Colors{text.FgHiYellow}.Sprint("the policy was skipped in all execution paths") } case len(ev.Violations) == 0: