Skip to content

Commit

Permalink
Rename PolicyChecks{State|Status} to PolicyCheck{State|Status}
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksnyder committed Feb 26, 2024
1 parent ed33e9c commit f42ba0c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
26 changes: 13 additions & 13 deletions buf/registry/module/v1beta1/label.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,20 @@ message Label {
//
// Policy checks are an enterprise-only feature - contact us to learn more!
bool policy_checks_enabled = 10;
// The PolicyChecksState for the Commit the Label points to.
// The PolicyCheckState for the Commit the Label points to.
//
// This field will be set if either:
// - Policy checks were enabled on this Label when this Commit was pushed.
// - This Commit transitively depends on a Commit that has a PolicyChecksState.
PolicyChecksState policy_checks_state = 11;
// - This Commit transitively depends on a Commit that has a PolicyCheckState.
PolicyCheckState policy_check_state = 11;
}

// The state of a Commit's policy checks for a particular Label.
//
// Policy checks are an enterprise-only feature - contact us to learn more!
message PolicyChecksState {
message PolicyCheckState {
// The status of the policy checks.
PolicyChecksStatus status = 1 [(buf.validate.field).enum.defined_only = true];
PolicyCheckStatus status = 1 [(buf.validate.field).enum.defined_only = true];

// The time the status was last updated.
google.protobuf.Timestamp status_updated_at = 3 [(buf.validate.field).required = true];
Expand All @@ -100,27 +100,27 @@ message PolicyChecksState {
repeated string blocked_on_commit_ids = 2 [(buf.validate.field).string.uuid = true];
}

// The status of a PolicyChecksState.
// The status of a PolicyCheckState.
//
// Policy checks are an enterprise-only feature - contact us to learn more!
enum PolicyChecksStatus {
POLICY_CHECKS_STATUS_UNSPECIFIED = 0;
enum PolicyCheckStatus {
POLICY_CHECK_STATUS_UNSPECIFIED = 0;
// The Commit did not fail any policy checks and therefore did not need review.
POLICY_CHECKS_STATUS_PASSED = 1;
POLICY_CHECK_STATUS_PASSED = 1;
// The Commit was reviewed after failing policy checks and was approved.
POLICY_CHECKS_STATUS_APPROVED = 2;
POLICY_CHECK_STATUS_APPROVED = 2;
// The Commit was reviewed after failing policy checks and was rejected.
POLICY_CHECKS_STATUS_REJECTED = 3;
POLICY_CHECK_STATUS_REJECTED = 3;
// The Commit has not yet been reviewed after failing policy checks and is pending.
POLICY_CHECKS_STATUS_PENDING = 4;
POLICY_CHECK_STATUS_PENDING = 4;
// The policy checks for this Commit are blocked on pending policy checks for at least one other Commit.
//
// If at least one dependent Commit is rejected, this Commit will inherit the rejected status.
// If all dependent Commits are passed or approved, then the status for this Commit will transition to:
// - Passed if policy checks are not enabled for this Label.
// - Passed if policy checks are enabled for this Label and all checks passed.
// - Pending if policy checks are enabled for this Label and some checks failed.
POLICY_CHECKS_STATUS_BLOCKED = 5;
POLICY_CHECK_STATUS_BLOCKED = 5;
}

// LabelRef is a reference to a Label, either an id or a fully-qualified name.
Expand Down
14 changes: 7 additions & 7 deletions buf/registry/module/v1beta1/label_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ message ListLabelsRequest {
// - If a Module is referenced, all Labels for the Module are returned.
// - If a Label is referenced, this Label is returned.
// - If a Commit is referenced, all Labels that currently point to the Commit are returned.
// Labels where this Commit has a PolicyChecksStatus that is neither approved nor passed will not be returned.
// Labels where this Commit has a PolicyCheckStatus that is neither approved nor passed will not be returned.
ResourceRef resource_ref = 3 [(buf.validate.field).required = true];
// The order to return the Labels.
//
Expand All @@ -107,10 +107,10 @@ message ListLabelsRequest {
// TODO: We are purposefully not making the default the zero enum value, however
// we may want to consider this.
Order order = 4 [(buf.validate.field).enum.defined_only = true];
// Only return Labels that point to a Commit with one of these PolicyChecksStatus values.
// Only return Labels that point to a Commit with one of these PolicyCheckStatus values.
//
// If not set, Labels that point to a Commit with any PolicyChecksStatus value are returned.
repeated PolicyChecksStatus policy_checks_statuses = 5 [(buf.validate.field).repeated.items.enum.defined_only = true];
// If not set, Labels that point to a Commit with any PolicyCheckStatus value are returned.
repeated PolicyCheckStatus policy_check_statuses = 5 [(buf.validate.field).repeated.items.enum.defined_only = true];
}

message ListLabelsResponse {
Expand Down Expand Up @@ -166,12 +166,12 @@ message ListLabelHistoryResponse {
// The Commit.
Commit commit = 1 [(buf.validate.field).required = true];

// The PolicyChecksState for this Commit on this Label.
// The PolicyCheckState for this Commit on this Label.
//
// This field will be set if either:
// - Policy checks were enabled on this Label when this Commit was pushed.
// - This Commit transitively depends on a Commit that has a PolicyChecksState.
PolicyChecksState policy_checks_state = 2;
// - This Commit transitively depends on a Commit that has a PolicyCheckState.
PolicyCheckState policy_check_state = 2;
}

// The next page token.
Expand Down

0 comments on commit f42ba0c

Please sign in to comment.