Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): source can in fact be undefined #20381

Conversation

blakepettersson
Copy link
Member

@blakepettersson blakepettersson commented Oct 15, 2024

The assumption that a source is always there is not always true. To repro, create an app-of-apps containing a single app without any source present (an example can be found at https://github.com/blakepettersson/broken-app-of-apps). In the UI this will crash, horribly. This PR fixes that so that instead of crashing the user will get useful info indicating what is wrong with the app.

Presumably fixes #15545.

Screenshot 2024-10-15 at 13 56 55

Cherry-pick for at least 2.12 and 2.13, perhaps even lower depending how easy this is to port.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

The assumption that a source is always there is not always true. To
repro, create an app-of-apps containing a single app without any `source`
present. In the UI this will crash, horribly. This PR fixes that so
that instead of crashing the user will get useful info indicating what
is wrong with the app.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
@blakepettersson blakepettersson requested a review from a team as a code owner October 15, 2024 12:05
Copy link

bunnyshell bot commented Oct 15, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link
Member

@gdsoumya gdsoumya left a comment

Choose a reason for hiding this comment

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

I agree that by mistake there can be cases where an app is deployed without source but the UI shouldn't crash, and should throw appropriate errors.

Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

I'm not sure I understand the target experience(s) here. There are a lot of new nil checks which will presumably replace a bad error message with some other behavior, but it's not clear what the other behavior will be. Seems like we should probably be detecting misconfigurations at a high level, showing a tailored error message, and short-circuiting the field access code paths entirely.

@blakepettersson
Copy link
Member Author

blakepettersson commented Oct 16, 2024

I'm not sure I understand the target experience(s) here.

There are a lot of new nil checks which will presumably replace a bad error message with some other behavior, but it's not clear what the other behavior will be.

The target experience is to display what is in the screenshot. When the source is not present, the App Health is Unknown, The Sync Status is also Unknown and the error message which is rendered in this case is spec.source.repoURL and either spec.source.path or spec.source.chart are required, coming from the application controller.

For a bit more context, @34fathombelow got paged by a customer due to this issue (they having misconfigured an application in this manner), which is the driver of this PR.

Granted that I've sprinkled the coalescing operator a bit too liberally here and can do some amendments for that...

Seems like we should probably be detecting misconfigurations at a high level, showing a tailored error message, and short-circuiting the field access code paths entirely.

I agree in principle, but the issue here is that we would need to figure out a whole new flow(s) for that. UX wise this would present a completely different flow than what users usually expect when their apps are misconfigured. Or am I misunderstanding something here?

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
@blakepettersson
Copy link
Member Author

I amended this to disable the details, sync and diff buttons in case the source is not present.

Screenshot 2024-10-16 at 14 41 23

@crenshaw-dev
Copy link
Member

Will review again! Makes sense, gotta be pragmatic about the cost of special error handling vs. just having reasonable fallback behavior.

@crenshaw-dev
Copy link
Member

Merging since we're aligned on design, and @gdsoumya approved. Support has been brutal this week, won't have time to review myself.

@crenshaw-dev crenshaw-dev merged commit ed4c0ee into argoproj:master Oct 17, 2024
23 checks passed
@blakepettersson
Copy link
Member Author

Support has been brutal this week

We feel you, it's been the same for us at Akuity as well 😞

@blakepettersson
Copy link
Member Author

/cherry-pick release-2.13

@blakepettersson
Copy link
Member Author

/cherry-pick release-2.12

gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Oct 17, 2024
* fix(ui): source can in fact be `undefined`

The assumption that a source is always there is not always true. To
repro, create an app-of-apps containing a single app without any `source`
present. In the UI this will crash, horribly. This PR fixes that so
that instead of crashing the user will get useful info indicating what
is wrong with the app.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

* chore(ui): some cr tweaks

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

* chore(ui): some cr tweaks

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

---------

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
@blakepettersson
Copy link
Member Author

/cherry-pick release-2.11

Copy link

Cherry-pick failed with Merge error ed4c0ee7138da579a4392824b0632a7056a1d106 into temp-cherry-pick-82e9b5-release-2.12

Copy link

Cherry-pick failed with Merge error ed4c0ee7138da579a4392824b0632a7056a1d106 into temp-cherry-pick-82e9b5-release-2.11

blakepettersson added a commit to blakepettersson/argo-cd that referenced this pull request Oct 17, 2024
* fix(ui): source can in fact be `undefined`

The assumption that a source is always there is not always true. To
repro, create an app-of-apps containing a single app without any `source`
present. In the UI this will crash, horribly. This PR fixes that so
that instead of crashing the user will get useful info indicating what
is wrong with the app.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

* chore(ui): some cr tweaks

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

* chore(ui): some cr tweaks

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

---------

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
@blakepettersson blakepettersson deleted the fix/source-can-in-fact-be-undefined branch October 17, 2024 11:38
ishitasequeira pushed a commit that referenced this pull request Oct 17, 2024
* fix(ui): source can in fact be `undefined`

The assumption that a source is always there is not always true. To
repro, create an app-of-apps containing a single app without any `source`
present. In the UI this will crash, horribly. This PR fixes that so
that instead of crashing the user will get useful info indicating what
is wrong with the app.



* chore(ui): some cr tweaks



* chore(ui): some cr tweaks



---------

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
ishitasequeira pushed a commit that referenced this pull request Oct 17, 2024
* fix(ui): source can in fact be `undefined`

The assumption that a source is always there is not always true. To
repro, create an app-of-apps containing a single app without any `source`
present. In the UI this will crash, horribly. This PR fixes that so
that instead of crashing the user will get useful info indicating what
is wrong with the app.



* chore(ui): some cr tweaks



* chore(ui): some cr tweaks



---------

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
4ch3los pushed a commit to 4ch3los/argo-cd that referenced this pull request Oct 17, 2024
* fix(ui): source can in fact be `undefined`

The assumption that a source is always there is not always true. To
repro, create an app-of-apps containing a single app without any `source`
present. In the UI this will crash, horribly. This PR fixes that so
that instead of crashing the user will get useful info indicating what
is wrong with the app.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

* chore(ui): some cr tweaks

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

* chore(ui): some cr tweaks

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

---------

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
blakepettersson added a commit to blakepettersson/argo-cd that referenced this pull request Oct 18, 2024
With argoproj#20381 multi-source apps were not taken into account 🤦

Fixes argoproj#20445.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
blakepettersson added a commit that referenced this pull request Oct 18, 2024
With #20381 multi-source apps were not taken into account 🤦

Fixes #20445.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Oct 18, 2024
With #20381 multi-source apps were not taken into account 🤦

Fixes #20445.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Oct 18, 2024
With #20381 multi-source apps were not taken into account 🤦

Fixes #20445.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
crenshaw-dev pushed a commit that referenced this pull request Oct 18, 2024
With #20381 multi-source apps were not taken into account 🤦

Fixes #20445.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
crenshaw-dev pushed a commit that referenced this pull request Oct 18, 2024
With #20381 multi-source apps were not taken into account 🤦

Fixes #20445.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
adriananeci pushed a commit to adriananeci/argo-cd that referenced this pull request Dec 4, 2024
* fix(ui): source can in fact be `undefined`

The assumption that a source is always there is not always true. To
repro, create an app-of-apps containing a single app without any `source`
present. In the UI this will crash, horribly. This PR fixes that so
that instead of crashing the user will get useful info indicating what
is wrong with the app.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

* chore(ui): some cr tweaks

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

* chore(ui): some cr tweaks

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>

---------

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Signed-off-by: Adrian Aneci <aneci@adobe.com>
adriananeci pushed a commit to adriananeci/argo-cd that referenced this pull request Dec 4, 2024
With argoproj#20381 multi-source apps were not taken into account 🤦

Fixes argoproj#20445.

Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
Signed-off-by: Adrian Aneci <aneci@adobe.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash while deleting application ("Cannot read properties of undefined (reading 'chart')")
5 participants