diff --git a/internal/apiclient/client.gen.go b/internal/apiclient/client.gen.go index 30fd386e..e5512f1c 100644 --- a/internal/apiclient/client.gen.go +++ b/internal/apiclient/client.gen.go @@ -10661,7 +10661,7 @@ type LavaflowMergePolicyUpdate struct { HumanReviewPaths *[]string `json:"human_review_paths,omitempty"` } -// LavaflowMergeReason Why the merge stopped, or what a waiting merge is paused for. `review_unresolved`: LavaFlow's review did not pass the fix. `checks_failed`: a check failed. `checks_timed_out`: checks did not finish in time. `blocked_by_rules`: the repository's rules hold the merge. `not_mergeable`: GitHub can't merge the pull request, for example because it conflicts. `branch_behind`: the base branch requires the fix to be up to date with it, and LavaFlow doesn't update fix branches. `removed_from_queue`: the fix isn't in the merge queue, and LavaFlow can't tell why, for example because its checks failed there or someone removed it. `reads_failed`: LavaFlow failed to read the pull request for about an hour while the fix may have been queued, so it took the fix out of the merge queue, when it could still reach it, and stopped, or failed to read the project's settings or repository for about a day while merging was paused. `handed_off`: someone else changed or took over the pull request. `unreadable`: GitHub's state could not be read. `permission_missing`: the Volcano GitHub App, or the project owner's GitHub account, lacks a permission the merge needs. `repository_changed`: the project now deploys from another repository. `settings_changed`: the project's settings no longer allow the merge. `request_rejected`: GitHub refused LavaFlow's request to start the checks on the fix. `ci_start_commit_mismatch`: GitHub reports a different commit from the one LavaFlow made to start the checks. `branch_refused`: LavaFlow starts checks only on a LavaFlow branch of an open pull request it opened, never the default or production branch, so it didn't start them on this one. `head_unverified`: GitHub doesn't report the fix's head as the signed commit LavaFlow pushed, so LavaFlow didn't start its checks. `checks_not_started`: LavaFlow couldn't give the fix a commit message that runs CI. `queue_carries_ci_skip`: the repository's merge queue could carry an instruction to skip checks, from the fix's commits or its pull request's title or description, into the base branch. `merge_carries_ci_skip`: merging would carry an instruction to skip checks into the base branch, for example because the repository allows no squash merge. Each of these seven hands the fix to you for good. `manual_deploy`: the fix merged and waits for you to deploy it. `paused`: merging is paused, and the merge waits. LavaFlow takes a queued fix out of the merge queue, so it shows `waiting_for_checks`, and queues it again when merging resumes. `paused_too_long`: merging stayed paused for more than 7 days. `cancelled`: the project is being deleted, so LavaFlow stopped waiting on the merge. New reasons may appear. +// LavaflowMergeReason Why the merge stopped, or what a waiting merge is paused for. `review_unresolved`: LavaFlow's review did not pass the fix. `checks_failed`: a check failed. `checks_timed_out`: checks did not finish in time. `blocked_by_rules`: the repository's rules hold the merge. `not_mergeable`: GitHub can't merge the pull request, for example because it conflicts. `branch_behind`: the base branch requires the fix to be up to date with it, and LavaFlow doesn't update fix branches. `removed_from_queue`: the fix isn't in the merge queue, and LavaFlow can't tell why, for example because its checks failed there or someone removed it. `reads_failed`: LavaFlow failed to read the pull request for about an hour while the fix may have been queued, so it took the fix out of the merge queue, when it could still reach it, and stopped, or failed to read the project's settings or repository for about a day while merging was paused. `handed_off`: someone else changed or took over the pull request. `unreadable`: GitHub's state could not be read. `permission_missing`: the Volcano GitHub App, or the project owner's GitHub account, lacks a permission the merge needs. `repository_changed`: the project now deploys from another repository. `settings_changed`: the project's settings no longer allow the merge. `request_rejected`: GitHub refused LavaFlow's request to start the checks on the fix. `ci_start_commit_mismatch`: GitHub reports a different commit from the one LavaFlow made to start the checks. `branch_refused`: LavaFlow starts checks only on a LavaFlow branch of an open pull request it opened, never the default or production branch, so it didn't start them on this one. `head_unverified`: GitHub doesn't report the fix's head as the signed commit LavaFlow pushed, so LavaFlow didn't start its checks. `checks_not_started`: LavaFlow couldn't give the fix a commit message that runs CI. `queue_carries_ci_skip`: the repository's merge queue could carry an instruction to skip checks, from the fix's commits or its pull request's title or description, into the base branch. `merge_carries_ci_skip`: merging would carry an instruction to skip checks into the base branch, for example because the repository allows no squash merge. Each of these seven hands the fix to you for good. `paused`: merging is paused, and the merge waits. LavaFlow takes a queued fix out of the merge queue, so it shows `waiting_for_checks`, and queues it again when merging resumes. `paused_too_long`: merging stayed paused for more than 7 days. `cancelled`: the project is being deleted, so LavaFlow stopped waiting on the merge. New reasons may appear. type LavaflowMergeReason = string // LavaflowMergeStatus `waiting_for_checks`: LavaFlow waits for the checks on the fix's commit. `waiting_for_approval`: checks passed and GitHub still requires an approving review. LavaFlow keeps watching and merges or queues the fix once GitHub reports required reviews satisfied and checks still pass. A new or dismissed approval is noticed on the next read, normally within five minutes. This wait does not consume the CI timeout. `queued`: the fix is in the repository's merge queue. `merged`: the pull request merged. `held`: something in `hold_reasons` needs a person. LavaFlow commented on the pull request once and never merges, pushes to, rebases or dequeues it again; review it and merge it yourself if you want it. A fix a person merges (its autonomy is `open_pr`, merging was unavailable when it opened, or its run may only open a pull request) is always `held` for `person_merges` once LavaFlow has started its CI, or found it may not. `stopped`: LavaFlow left the pull request open for you, for `reason`. diff --git a/internal/output/lavaflow.go b/internal/output/lavaflow.go index d6dae77f..79fb7b35 100644 --- a/internal/output/lavaflow.go +++ b/internal/output/lavaflow.go @@ -510,9 +510,6 @@ func lavaflowFix(w io.Writer, on bool, run *apiclient.LavaflowRun) { if cover := delivery.Coverage; cover != nil && pr == nil { fixKV(w, on, "Covering pull request", "#%d %s", cover.Number, clean(cover.Url)) fixKV(w, on, "State", "%s", clean(string(cover.State))) - if cover.State == apiclient.LavaflowDeliveryCoverageStateMerged { - fixKV(w, on, "Deployment", "%s", formatLavaflowTimePtr(cover.DeployedAt, "unconfirmed")) - } return } if state := lavaflowDeliveryStatus(delivery.State); state != "" && pr == nil { @@ -538,8 +535,6 @@ func lavaflowFix(w io.Writer, on bool, run *apiclient.LavaflowRun) { if run.Merge != nil { lavaflowMergeLines(w, on, run.Merge, pr) } - // The API doesn't say yet whether a merged fix deployed. Print it here - // once the pull request carries deployed_at. } // fixKV writes a "Label: value" line inside the Fix block. diff --git a/internal/output/lavaflow_test.go b/internal/output/lavaflow_test.go index ed21e70d..427e8e60 100644 --- a/internal/output/lavaflow_test.go +++ b/internal/output/lavaflow_test.go @@ -3,6 +3,7 @@ package output import ( "bytes" "testing" + "time" "github.com/stretchr/testify/require" @@ -38,3 +39,18 @@ func TestLavaflowDeliveryStatus(t *testing.T) { }) } } + +func TestLavaflowFixPrintsCoveringPullRequestState(t *testing.T) { + t.Parallel() + + deployed := time.Date(2026, time.November, 19, 18, 15, 0, 0, time.UTC) + run := &apiclient.LavaflowRun{Delivery: &apiclient.LavaflowDelivery{ + Coverage: &apiclient.LavaflowDeliveryCoverage{ + Number: 24, Url: "https://github.com/example/project/pull/24", + State: apiclient.LavaflowDeliveryCoverageStateMerged, DeployedAt: &deployed, + }, + }} + var out bytes.Buffer + lavaflowFix(&out, false, run) + require.Equal(t, "Fix:\n Covering pull request: #24 https://github.com/example/project/pull/24\n State: merged\n", out.String()) +} diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 30183b72..056c4f04 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -31086,7 +31086,7 @@ components: description: '`waiting_for_checks`: LavaFlow waits for the checks on the fix''s commit. `waiting_for_approval`: checks passed and GitHub still requires an approving review. LavaFlow keeps watching and merges or queues the fix once GitHub reports required reviews satisfied and checks still pass. A new or dismissed approval is noticed on the next read, normally within five minutes. This wait does not consume the CI timeout. `queued`: the fix is in the repository''s merge queue. `merged`: the pull request merged. `held`: something in `hold_reasons` needs a person. LavaFlow commented on the pull request once and never merges, pushes to, rebases or dequeues it again; review it and merge it yourself if you want it. A fix a person merges (its autonomy is `open_pr`, merging was unavailable when it opened, or its run may only open a pull request) is always `held` for `person_merges` once LavaFlow has started its CI, or found it may not. `stopped`: LavaFlow left the pull request open for you, for `reason`.' LavaflowMergeReason: type: string - description: 'Why the merge stopped, or what a waiting merge is paused for. `review_unresolved`: LavaFlow''s review did not pass the fix. `checks_failed`: a check failed. `checks_timed_out`: checks did not finish in time. `blocked_by_rules`: the repository''s rules hold the merge. `not_mergeable`: GitHub can''t merge the pull request, for example because it conflicts. `branch_behind`: the base branch requires the fix to be up to date with it, and LavaFlow doesn''t update fix branches. `removed_from_queue`: the fix isn''t in the merge queue, and LavaFlow can''t tell why, for example because its checks failed there or someone removed it. `reads_failed`: LavaFlow failed to read the pull request for about an hour while the fix may have been queued, so it took the fix out of the merge queue, when it could still reach it, and stopped, or failed to read the project''s settings or repository for about a day while merging was paused. `handed_off`: someone else changed or took over the pull request. `unreadable`: GitHub''s state could not be read. `permission_missing`: the Volcano GitHub App, or the project owner''s GitHub account, lacks a permission the merge needs. `repository_changed`: the project now deploys from another repository. `settings_changed`: the project''s settings no longer allow the merge. `request_rejected`: GitHub refused LavaFlow''s request to start the checks on the fix. `ci_start_commit_mismatch`: GitHub reports a different commit from the one LavaFlow made to start the checks. `branch_refused`: LavaFlow starts checks only on a LavaFlow branch of an open pull request it opened, never the default or production branch, so it didn''t start them on this one. `head_unverified`: GitHub doesn''t report the fix''s head as the signed commit LavaFlow pushed, so LavaFlow didn''t start its checks. `checks_not_started`: LavaFlow couldn''t give the fix a commit message that runs CI. `queue_carries_ci_skip`: the repository''s merge queue could carry an instruction to skip checks, from the fix''s commits or its pull request''s title or description, into the base branch. `merge_carries_ci_skip`: merging would carry an instruction to skip checks into the base branch, for example because the repository allows no squash merge. Each of these seven hands the fix to you for good. `manual_deploy`: the fix merged and waits for you to deploy it. `paused`: merging is paused, and the merge waits. LavaFlow takes a queued fix out of the merge queue, so it shows `waiting_for_checks`, and queues it again when merging resumes. `paused_too_long`: merging stayed paused for more than 7 days. `cancelled`: the project is being deleted, so LavaFlow stopped waiting on the merge. New reasons may appear.' + description: 'Why the merge stopped, or what a waiting merge is paused for. `review_unresolved`: LavaFlow''s review did not pass the fix. `checks_failed`: a check failed. `checks_timed_out`: checks did not finish in time. `blocked_by_rules`: the repository''s rules hold the merge. `not_mergeable`: GitHub can''t merge the pull request, for example because it conflicts. `branch_behind`: the base branch requires the fix to be up to date with it, and LavaFlow doesn''t update fix branches. `removed_from_queue`: the fix isn''t in the merge queue, and LavaFlow can''t tell why, for example because its checks failed there or someone removed it. `reads_failed`: LavaFlow failed to read the pull request for about an hour while the fix may have been queued, so it took the fix out of the merge queue, when it could still reach it, and stopped, or failed to read the project''s settings or repository for about a day while merging was paused. `handed_off`: someone else changed or took over the pull request. `unreadable`: GitHub''s state could not be read. `permission_missing`: the Volcano GitHub App, or the project owner''s GitHub account, lacks a permission the merge needs. `repository_changed`: the project now deploys from another repository. `settings_changed`: the project''s settings no longer allow the merge. `request_rejected`: GitHub refused LavaFlow''s request to start the checks on the fix. `ci_start_commit_mismatch`: GitHub reports a different commit from the one LavaFlow made to start the checks. `branch_refused`: LavaFlow starts checks only on a LavaFlow branch of an open pull request it opened, never the default or production branch, so it didn''t start them on this one. `head_unverified`: GitHub doesn''t report the fix''s head as the signed commit LavaFlow pushed, so LavaFlow didn''t start its checks. `checks_not_started`: LavaFlow couldn''t give the fix a commit message that runs CI. `queue_carries_ci_skip`: the repository''s merge queue could carry an instruction to skip checks, from the fix''s commits or its pull request''s title or description, into the base branch. `merge_carries_ci_skip`: merging would carry an instruction to skip checks into the base branch, for example because the repository allows no squash merge. Each of these seven hands the fix to you for good. `paused`: merging is paused, and the merge waits. LavaFlow takes a queued fix out of the merge queue, so it shows `waiting_for_checks`, and queues it again when merging resumes. `paused_too_long`: merging stayed paused for more than 7 days. `cancelled`: the project is being deleted, so LavaFlow stopped waiting on the merge. New reasons may appear.' LavaflowHoldReason: type: object description: One reason LavaFlow holds the fix for a person.