feat: proper warn & error for exceeding max dataclip size#4555
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4555 +/- ##
==========================================
- Coverage 89.51% 89.49% -0.02%
==========================================
Files 441 441
Lines 21205 21207 +2
==========================================
- Hits 18982 18980 -2
- Misses 2223 2227 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| throw new Error(error.error || 'Failed to submit manual run'); | ||
| if (response.status === 413) { | ||
| throw new Error( | ||
| 'Dataclip is too large. Please reduce the size and try again.' |
There was a problem hiding this comment.
We shouldn't say "please" in an error message like this. We're not asking the user for a favour - we're telling them they've hit a wall.
@brandonjackson do you have opinions on tone and content of error messages? Want to weigh in here?
There was a problem hiding this comment.
I agree with you @josephjclark - the key info they need is the file size limit - would rather that than pleasantries
There was a problem hiding this comment.
any suggestions on what the wording here should be?
Dataclip is too large. Reduce the size and try again.
There was a problem hiding this comment.
Hi @doc-han I think that wording works well. Have you already made this change to the error message? I can do a design review if you have.
There was a problem hiding this comment.
updated @theroinaochieng. you can review
josephjclark
left a comment
There was a problem hiding this comment.
I haven't tested but the solution looks good to me. Thanks @doc-han!
| const error = (await response.json()) as { error?: string }; | ||
| throw new Error(error.error || 'Failed to submit manual run'); | ||
| if (response.status === 413) { | ||
| throw new Error('Dataclip is too large. Reduce the size and try again.'); |
There was a problem hiding this comment.
Is it very difficult to add the file limit to the toast message from app config?
So the error message would be more like:
"Dataclip exceeds the 10 MB limit. Reduce the size and try again"
In case they missed it in the validation message?
| kafka_triggers_enabled: Lightning.Config.kafka_triggers_enabled?() | ||
| kafka_triggers_enabled: Lightning.Config.kafka_triggers_enabled?(), | ||
| max_dataclip_size_bytes: | ||
| Application.get_env(:lightning, :max_dataclip_size_bytes, 10_000_000) |
There was a problem hiding this comment.
I think this would be best if it was in lib/lightning/config, then we could test it more easily. The other values here use Lightning.Config.* functions so that we can let tests stub via Lightning.MockConfig. I'll do a commit as I'm in the code.
There was a problem hiding this comment.
@doc-han I haven't re-tested things since doing this so maybe if you could just give it another test? Thanks
midigofrank
left a comment
There was a problem hiding this comment.
Nicely done @doc-han . Please fix the conflict in the changelog
Description
Show the user a warning when dataclip size exceeds our max limit(currently 10mb). This max limit is set in liveview and hence had to be drilled down to react.
Closes #4524
Validation steps
AI Usage
Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):
You can read more details in our
Responsible AI Policy
Pre-submission checklist
/reviewwith Claude Code)
(e.g.,
:owner,:admin,:editor,:viewer)