Skip to content

Fix/project update issues - #122

Open
pancysingla-creator wants to merge 2 commits into
mainfrom
fix/project-update-issues
Open

pancysingla-creator wants to merge 2 commits into
mainfrom
fix/project-update-issues

Conversation

@pancysingla-creator

@pancysingla-creator pancysingla-creator commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes two errors when updating a project from the console.

1. Project Info: Submit crashes when the project has no labels

If a project's labels is null, the API leaves the field out and the confirm dialog crashes on labels.map. The page shows "Something Went Wrong" and no PUT is sent.

Fix: default labels to an empty list in UpdateProjectInfoModal.

Before After
img_v3_0217i_c2b19b3d-a264-4e3e-8c7f-4b21120c1chu img_v3_0217i_a5bb9d90-3a31-4ae7-ad27-8bf75a15e3hu

2. User Roles / Project Info: unclear 500 when a webhook rejects the update

When the OnProjectUpdated webhook replies with a 4xx (e.g. 404 team not found), the API returned a 500 with the raw webhook response, which doesn't tell the user what to fix.

Fix:

  • Webhook client: a 4xx reply becomes an invalid-argument error that carries the webhook's own message, and is no longer retried. 5xx replies are unchanged.
  • UpdateProject: adds the project's team and stream to that error, so the API returns a 400 that tells the user what to check.
Before After
image img_v3_0217i_acd18349-f1c9-4524-bbcb-d6a4d859f5hu

pancysingla-creator and others added 2 commits November 18, 2026 14:08
Projects whose labels are null (or omitted by the API) crashed the
Project Info confirm dialog on Submit with "Cannot read properties of
undefined (reading 'map')", so no PUT request was sent. Default both
the original and the edited labels to an empty list before mapping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a webhook replies with a 4xx, the project update now fails with a
400 that carries the webhook's own error message plus the project's team
and stream, instead of a 500 with the raw response. For example, a team
that is not registered in Warden now reads:

  webhook_1 rejected the request (status 404): team not found
  (project team "ds_identity", stream "ds_identity"). Check that the team
  and stream are valid, and change them on the Project Info page if needed

- Webhook client: a 4xx reply becomes an InvalidArgumentError with the
  webhook's message, and is no longer retried. 5xx replies are unchanged.
- UpdateProject: add the project's team and stream to that error, and
  log the correct event name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@anantadwi13 anantadwi13 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

btw i have some concerns below. wdyt?


"github.com/avast/retry-go/v4"
"github.com/caraml-dev/mlp/api/log"
apperror "github.com/caraml-dev/mlp/api/pkg/errors"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

i prefer this package shouldn't import another package, and let's use its internal error instead in errors.go

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alright, sure!

"and change them on the Project Info page if needed",
err, project.Team, project.Stream,
)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

btw, somehow i prefer we are not changing this logic. it should be still returning 500 error instead of 4xx (apperror.NewInvalidArgumentErrorf), because it is the server internal communication with webhook server, and it can be used to call any endpoints (not just related to team & stream management). that means asking the user to check team & stream are valid might lead to misinformation

also, the user is expected not to know this kind of issue. i prefer the error message tells the user to contact the platform owner, and the platform owner add some FAQ docs to help user tackle this kind of issue.

nice to have: adding request id or any reference id to the error message to make debugging process easier

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had a few clarifications regarding this:

  1. QA report mentioned we want the user to see 404 instead of 500, and we should wrap a 4xx response from a webhook as apperror.InvalidArgumentError or apperror.NotFoundError, but as you mentioned above should it be kept 500? Should we append "Please contact the platform owner" directly in webhooks/errors.go (so the API response carries it), or handle that phrasing on the UI side? Is there any specific support channel we should link to in that case?

  2. For request id or any reference id part, does mlp already attach a request ID or headers or should we generate a UUID per webhook call and append it to the error message?

Comment on lines +104 to +108
if resp.StatusCode >= http.StatusBadRequest && resp.StatusCode < http.StatusInternalServerError {
return retry.Unrecoverable(apperror.NewInvalidArgumentErrorf(
"%s rejected the request (status %d): %s", g.Name, resp.StatusCode, webhookErrorMessage(content),
))
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

regarding my comment here https://github.com/caraml-dev/mlp/pull/122/changes#r4623239246

this seems like not necessary

This branch was successfully deployed

1 active deployment
manual — e0338a53 Deployed Nov 18, 2026 by pancysingla-creator via publish-docker #451
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.

2 participants