Skip to content

feat: proper warn & error for exceeding max dataclip size#4555

Merged
doc-han merged 7 commits intomainfrom
4524-huge-custom-dataclips-will-refuse-to-trigger-a-run
Mar 30, 2026
Merged

feat: proper warn & error for exceeding max dataclip size#4555
doc-han merged 7 commits intomainfrom
4524-huge-custom-dataclips-will-refuse-to-trigger-a-run

Conversation

@doc-han
Copy link
Copy Markdown
Contributor

@doc-han doc-han commented Mar 23, 2026

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.

huge JSON in dataclip input Error message on submit of huge JSON
Screenshot 2026-03-23 at 5 14 19 PM Screenshot 2026-03-23 at 5 14 32 PM

Closes #4524

Validation steps

  1. Get a very huge JSON(greater than 10mb)
  2. copy to clipboard
  3. paste into custom dataclip input box
  4. It should show you a warning that you've exceeded the size limit.

AI Usage

Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Pre-submission checklist

  • I have performed an AI review of my code (we recommend using /review
    with Claude Code)
  • I have implemented and tested all related authorization policies.
    (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

@doc-han doc-han linked an issue Mar 23, 2026 that may be closed by this pull request
@github-project-automation github-project-automation bot moved this to New Issues in Core Mar 23, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.49%. Comparing base (7a47ef2) to head (67d036a).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with you @josephjclark - the key info they need is the file size limit - would rather that than pleasantries

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.

any suggestions on what the wording here should be?
Dataclip is too large. Reduce the size and try again.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

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.

updated @theroinaochieng. you can review

Copy link
Copy Markdown
Collaborator

@josephjclark josephjclark left a comment

Choose a reason for hiding this comment

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

I haven't tested but the solution looks good to me. Thanks @doc-han!

@doc-han doc-han requested a review from theroinaochieng March 26, 2026 08:59
Copy link
Copy Markdown
Collaborator

@lmac-1 lmac-1 left a comment

Choose a reason for hiding this comment

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

Hiya @doc-han I just made one change to move max_dataclip_size_bytes into config. Also I left a comment about the toast message but it shouldn't block the merge. Apart from that looks good to me.

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.');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@doc-han I haven't re-tested things since doing this so maybe if you could just give it another test? Thanks

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great catch @lmac-1

Copy link
Copy Markdown
Collaborator

@midigofrank midigofrank left a comment

Choose a reason for hiding this comment

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

Nicely done @doc-han . Please fix the conflict in the changelog

@doc-han doc-han merged commit ddd3d00 into main Mar 30, 2026
7 of 8 checks passed
@doc-han doc-han deleted the 4524-huge-custom-dataclips-will-refuse-to-trigger-a-run branch March 30, 2026 08:21
@github-project-automation github-project-automation bot moved this from New Issues to Done in Core Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Huge custom dataclips will refuse to trigger a run

7 participants