fix: honor deprecated BuildRun status failedAt on conversion - #2306
fix: honor deprecated BuildRun status failedAt on conversion#2306Ryntak94 wants to merge 2 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
5b1aa15 to
797572c
Compare
|
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 Once #2305 merges, this will rebase down to the single commit. Happy to rebase onto |
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>
797572c to
a6f30c6
Compare
|
Rebased ^^ |
SaschaSchwarze0
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
|
@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>
|
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: 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 @SaschaSchwarze0 does that address your concern? Happy to adjust if you'd rather the fallback not construct a |
|
Hey @kaizakin and @SaschaSchwarze0 I just wanted to bump this one since it seems like it's on the verge of being merged :) |
|
Let's listen @qu1queee 's opinion on this one :) |
|
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? meeting minutes: https://docs.google.com/document/d/1o0wdu6njw3mgVXXRHoi64lhaokLcIV2H0X5o8DoWKAM/edit?tab=t.0#heading=h.y6cwrxw5b3qq |
|
I'd second Sascha's point. A non-nil |
Changes
BuildRunconversion handled the deprecated.status.failedAtfield in one direction only.ConvertTodeliberately mirrorsFailureDetails.LocationintofailedAtso that users get some time to adoptfailureDetails, butConvertFromnever read it back. Av1alpha1BuildRunthat only reported.status.failedAt— which is what clients written beforefailureDetailsexisted do, and what this codebase itself emitted — converted to av1beta1object with no failure location at all, and the loss was silent.ConvertFromnow falls back to the deprecatedfailedAtfor the failure location.failureDetailsstays authoritative:failedAtis only consulted whenfailureDetailscarries no location, so it can never override the newer field.Only the location is recovered.
failureDetails.reasonandfailureDetails.messageare left unset, because av1alpha1object that reportsfailedAton 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 docs if changes are user-facing— no API surface change; this makes an already-deprecated field round-trip instead of being droppedRelease Notes