Skip to content

fix: honor deprecated BuildRun status failedAt on conversion - #2306

Open
Ryntak94 wants to merge 2 commits into
shipwright-io:mainfrom
Ryntak94:fix/buildrun-failedat-conversion-2304
Open

fix: honor deprecated BuildRun status failedAt on conversion#2306
Ryntak94 wants to merge 2 commits into
shipwright-io:mainfrom
Ryntak94:fix/buildrun-failedat-conversion-2304

Conversation

@Ryntak94

@Ryntak94 Ryntak94 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Changes

BuildRun conversion handled the deprecated .status.failedAt field in one direction only. ConvertTo deliberately mirrors FailureDetails.Location into failedAt so that users get some time to adopt failureDetails, but ConvertFrom never read it back. A v1alpha1 BuildRun that only reported .status.failedAt — which is what clients written before failureDetails existed do, and what this codebase itself emitted — converted to a v1beta1 object with no failure location at all, and the loss was silent.

ConvertFrom now falls back to the deprecated failedAt for the failure location. failureDetails stays authoritative: failedAt is only consulted when failureDetails carries no location, so it can never override the newer field.

Only the location is recovered. failureDetails.reason and failureDetails.message are left unset, because a v1alpha1 object that reports failedAt on its own carries no such data and synthesising values would be worse than leaving them empty. Whether those two fields should be required rather than optional is a status schema question that is deliberately out of scope here; it is tracked separately in #2308.

Related Issue

Fixes #2304

Type of PR

/kind bug

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing — no API surface change; this makes an already-deprecated field round-trip instead of being dropped
  • Kind label has been set
  • Release notes block has been filled in, or marked NONE

Release Notes

Fixed BuildRun conversion ignoring the deprecated `.status.failedAt` field when converting from v1alpha1. The failure location is now carried into `.status.failureDetails.location` when `failureDetails` does not already provide one, so failure information from older clients is no longer lost.

@openshift-ci openshift-ci Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Label for when a PR has specified a release note labels Aug 25, 2026
@pull-request-size pull-request-size Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 25, 2026
@openshift-ci openshift-ci Bot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 25, 2026
@openshift-ci

openshift-ci Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign irvingmg for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Ryntak94
Ryntak94 marked this pull request as ready for review August 25, 2026 03:10
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 25, 2026
@openshift-ci
openshift-ci Bot requested review from karanibm6 and rxinui August 25, 2026 03:10
@Ryntak94
Ryntak94 force-pushed the fix/buildrun-failedat-conversion-2304 branch from 5b1aa15 to 797572c Compare August 25, 2026 03:13
@Ryntak94

Copy link
Copy Markdown
Contributor Author

Note on the commit list: this branch is stacked on #2305, so the diff here currently includes that PR's commit as well.

Both changes touch pkg/apis/build/v1beta1/buildrun_conversion.go, in different places, which is why I stacked them rather than developing them independently and hitting a conflict. 797572c5 reviews cleanly on its own if that is easier.

Once #2305 merges, this will rebase down to the single commit. Happy to rebase onto main sooner instead if you would rather the two PRs were fully independent, or to close this and re-open it after #2305 lands — whichever suits your review order.

BuildRun conversion handled the deprecated .status.failedAt field in one
direction only. ConvertTo mirrors FailureDetails.Location into failedAt so
that users get some time to adopt failureDetails, but ConvertFrom never read
it back. A v1alpha1 BuildRun that only reported .status.failedAt, which is
what clients written before failureDetails existed do, converted to a v1beta1
object without any failure location at all, and the loss was silent.

ConvertFrom now falls back to the deprecated failedAt for the failure
location. failureDetails stays authoritative: failedAt is only consulted when
failureDetails carries no location, so it can never override the newer field.

Closes shipwright-io#2304

Signed-off-by: Ryan Matthews <ryan.matthews.professional@gmail.com>
@SaschaSchwarze0
SaschaSchwarze0 force-pushed the fix/buildrun-failedat-conversion-2304 branch from 797572c to a6f30c6 Compare August 25, 2026 14:30
@SaschaSchwarze0

Copy link
Copy Markdown
Member

Rebased ^^

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea of the FailureDetails was to have always a reason and a message. I do not know why we missed to annotate the two structs and why they have omitempty for reason and message. Our usual guidance is that required fields are not a pointer (is the case for them) and then omitempty also makes no sense. But it seems that we have not really been consistent in status types, should be better in spec types.

So, not sure if we want to add conversion code that builds FailureDetails where fields one could consider required, are not set.

@kaizakin kaizakin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old alpha objects can only preserve the failure location, and i think dropping it would be real data loss.

I do agree the status model is a bit inconsistent, especially around whether FailureDetails.reason and message are semantically required. my suggestion is to keep this PR scoped to backward compatibility and track the status-schema cleanup in a separate follow-up issue.

@kaizakin

Copy link
Copy Markdown
Member

@SaschaSchwarze0 I've created an issue for this #2308

Expand the comment at the ConvertFrom fallback to record that only the
failure location is recovered from the deprecated failedAt field, and that
FailureDetails.Reason and FailureDetails.Message are intentionally left
unset because a v1alpha1 object reporting failedAt alone carries no such
data.

The question of whether those two fields should be required rather than
optional is a status schema concern that is out of scope here and is
tracked in shipwright-io#2308.

Signed-off-by: Ryan Matthews <ryan.matthews.professional@gmail.com>
@Ryntak94

Copy link
Copy Markdown
Contributor Author

Thanks @kaizakin, that matches what I had in mind, so I've kept this PR scoped to backward compatibility.

To be explicit about what the conversion does: ConvertFrom only recovers failureDetails.location from the deprecated failedAt, and only when failureDetails does not already carry a location, so it can never override the newer field. reason and message are left untouched — a v1alpha1 object that reports failedAt on its own has no such data, and synthesising values would be worse than leaving them empty. No API types change here.

I've pushed a commit that spells that out in a comment at the conversion site and pointed it at #2308, and updated the PR description to say the required-vs-optional question on FailureDetails.reason/message is out of scope here and tracked in that issue.

@SaschaSchwarze0 does that address your concern? Happy to adjust if you'd rather the fallback not construct a FailureDetails at all when only failedAt is present.

@Ryntak94 Ryntak94 closed this Aug 25, 2026
@Ryntak94 Ryntak94 reopened this Aug 25, 2026
@github-project-automation github-project-automation Bot moved this to Done in Issues Aug 25, 2026
@Ryntak94

Copy link
Copy Markdown
Contributor Author

Hey @kaizakin and @SaschaSchwarze0 I just wanted to bump this one since it seems like it's on the verge of being merged :)

@kaizakin

Copy link
Copy Markdown
Member

Let's listen @qu1queee 's opinion on this one :)

@kaizakin

kaizakin commented Sep 6, 2026

Copy link
Copy Markdown
Member

Hi @Ryntak94 this PR is taking more time for approval because we want to hear opinion from other maintainers.

can you come to tomorrow's community meeting if you have time?
maybe we could discuss more.

meeting minutes: https://docs.google.com/document/d/1o0wdu6njw3mgVXXRHoi64lhaokLcIV2H0X5o8DoWKAM/edit?tab=t.0#heading=h.y6cwrxw5b3qq

@qu1queee

qu1queee commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

I'd second Sascha's point. A non-nil br.Status.FailureDetails is meant to mean reason and message are present; in the conversion case they would not be. I also would not expect users to still have a BuildRun old enough for that gap (failedAt only, no failureDetails). There is no technical reason to block the conversion. I'd leave the product call to consensus in the community meeting.

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

Labels

kind/bug Categorizes issue or PR as related to a bug. release-note Label for when a PR has specified a release note size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] BuildRun conversion ignores deprecated .status.failedAt from v1alpha1

5 participants