Skip to content

Default success conclusion is missing from predicate failure descriptions #1397

Open

Description

@strawberry-little-bear

When has_status or has_workflow_result is configured without an explicit conclusions list, the predicate correctly defaults to success for evaluation, but the failure description still formats the original (empty) field.

For example:

requires:
  conditions:
    has_status:
      statuses:
        - ci/test

If ci/test concludes with failure, the policy is rejected as expected, but the predicate description is:

One or more statuses has not concluded with : ci/test

The same happens for has_workflow_result:

One or more workflow runs have not concluded with : .github/workflows/ci.yml

In both cases, the condition phrase already says success, so the empty value in the failure message is inconsistent and makes the diagnostic less useful. A user looking at the policy result cannot tell from the failure detail that the implicit requirement was success.

The cause appears to be that Evaluate normalizes the empty configuration into a local success slice for the check itself, but the failure branch still calls pred.Conclusions.joinWithOr() instead of using that normalized value. The fix should be small: use the normalized conclusions when building the failure description, and add regression coverage for the default case in both predicates.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions