Skip to content

fix(frontend): improve static error msgs to be user-friendly for unco… - #6288

Merged
aglinxinyuan merged 12 commits into
apache:mainfrom
roshiiiz:fix/user-friendly-error-messages
Jul 10, 2026
Merged

fix(frontend): improve static error msgs to be user-friendly for unco…#6288
aglinxinyuan merged 12 commits into
apache:mainfrom
roshiiiz:fix/user-friendly-error-messages

Conversation

@roshiiiz

@roshiiiz roshiiiz commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

This PR overhauls the static error validation and error messaging across Texera operators to drastically improve the experience for new users during workflow editing.

Previously, if a user dragged an operator (like Projection, MySQL, or CSV File Scan) onto the canvas without configuring it yet, the system would immediately throw intimidating and cryptic Java exceptions (e.g., IllegalArgumentException, SQLException: No suitable driver found, or /texera (Is a directory)).

Changes proposed:

  1. Frontend Global Catch-all: Updated the regex logic in error-frame.component.ts to cleanly strip internal Java prefixes (like java.lang.IllegalArgumentException: or requirement failed:) so the user only sees the human-readable part of the error message.
  2. Projection Operator: Updated ProjectionOpDesc to explicitly prompt the user to select an attribute.
  3. Database Sources: Updated SQLSourceOpDesc (and AsterixDBSourceOpDesc) to intercept empty database configuration fields and return actionable UI instructions (e.g., "Please enter a valid host name for the database in the properties panel").
  4. File Scan Sources: Updated all file scan operators (ParallelCSV, JSONL, Arrow, etc.) to gracefully catch directory selections and missing files before attempting physical reads, replacing IOExceptions with clear prompts to select a valid file from the right-hand panel.

Any related issues, documentation, discussions?

Closes #2735

How was this PR tested?

Tested manually by rebuilding the workflow-compiling-service and dragging every modified operator (Projection, MySQL, PostgreSQL, AsterixDB, CSV, JSONL, Arrow) onto a new workflow canvas. Verified that the Result Panel correctly displays the newly formatted, user-friendly instructions instead of raw Java exceptions.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Antigravity (DeepMind)

Tests:
WhatsApp Image 2026-07-09 at 12 56 49

image -------------------------------------------------------------------------------------------------------------------------------------- image -------------------------------------------------------------------------------------------------------------------------------------- image --------------------------------------------------------------------------------------------------------------------------------------

@github-actions github-actions Bot added fix frontend Changes related to the frontend GUI common labels Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @Yicong-Huang, @aglinxinyuan, @mengw15
    You can notify them by mentioning @Yicong-Huang, @aglinxinyuan, @mengw15 in a comment.

@codecov-commenter

codecov-commenter commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.80%. Comparing base (12f9f1a) to head (81bf4a3).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
.../result-panel/error-frame/error-frame.component.ts 0.00% 14 Missing ⚠️
...ra/amber/operator/source/sql/SQLSourceOpDesc.scala 66.66% 0 Missing and 6 partials ⚠️
...r/source/sql/asterixdb/AsterixDBSourceOpDesc.scala 0.00% 5 Missing and 1 partial ⚠️
...operator/source/scan/arrow/ArrowSourceOpDesc.scala 86.66% 0 Missing and 2 partials ⚠️
...operator/source/scan/csv/CSVScanSourceOpDesc.scala 90.90% 0 Missing and 1 partial ⚠️
.../source/scan/csv/ParallelCSVScanSourceOpDesc.scala 90.90% 0 Missing and 1 partial ⚠️
...or/source/scan/csvOld/CSVOldScanSourceOpDesc.scala 90.90% 0 Missing and 1 partial ⚠️
...rator/source/scan/json/JSONLScanSourceOpDesc.scala 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6288      +/-   ##
============================================
+ Coverage     60.77%   60.80%   +0.02%     
+ Complexity     3367     3366       -1     
============================================
  Files          1135     1135              
  Lines         44191    44263      +72     
  Branches       4830     4848      +18     
============================================
+ Hits          26855    26912      +57     
- Misses        15878    15885       +7     
- Partials       1458     1466       +8     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø)
agent-service 44.59% <ø> (ø) Carriedforward from faa965a
amber 66.24% <77.77%> (+0.10%) ⬆️
computing-unit-managing-service 0.00% <ø> (ø)
config-service 52.30% <ø> (ø)
file-service 63.97% <ø> (ø)
frontend 52.67% <0.00%> (-0.04%) ⬇️
notebook-migration-service 78.94% <ø> (ø)
pyamber 91.18% <ø> (ø) Carriedforward from faa965a
workflow-compiling-service 55.14% <100.00%> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@roshiiiz

roshiiiz commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@aglinxinyuan Can you please review it

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 4 better · 🔴 7 worse · ⚪ 4 noise (<±5%) · 0 without baseline

Compared against main 12f9f1a benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 400 0.244 24,351/35,054/35,054 us 🔴 +8.2% / 🔴 +131.9%
🔴 bs=100 sw=10 sl=64 787 0.48 125,191/158,096/158,096 us 🔴 +23.6% / 🔴 +47.7%
🟢 bs=1000 sw=10 sl=64 921 0.562 1,084,863/1,128,394/1,128,394 us 🟢 -5.3% / 🔴 +9.9%
Baseline details

Latest main 12f9f1a from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 400 tuples/sec 425 tuples/sec 779.42 tuples/sec -5.9% -48.7%
bs=10 sw=10 sl=64 MB/s 0.244 MB/s 0.26 MB/s 0.476 MB/s -6.2% -48.7%
bs=10 sw=10 sl=64 p50 24,351 us 22,513 us 12,550 us +8.2% +94.0%
bs=10 sw=10 sl=64 p95 35,054 us 38,200 us 15,115 us -8.2% +131.9%
bs=10 sw=10 sl=64 p99 35,054 us 38,200 us 18,652 us -8.2% +87.9%
bs=100 sw=10 sl=64 throughput 787 tuples/sec 832 tuples/sec 1,000 tuples/sec -5.4% -21.3%
bs=100 sw=10 sl=64 MB/s 0.48 MB/s 0.508 MB/s 0.61 MB/s -5.5% -21.4%
bs=100 sw=10 sl=64 p50 125,191 us 124,193 us 99,872 us +0.8% +25.4%
bs=100 sw=10 sl=64 p95 158,096 us 127,890 us 107,073 us +23.6% +47.7%
bs=100 sw=10 sl=64 p99 158,096 us 127,890 us 114,377 us +23.6% +38.2%
bs=1000 sw=10 sl=64 throughput 921 tuples/sec 911 tuples/sec 1,020 tuples/sec +1.1% -9.7%
bs=1000 sw=10 sl=64 MB/s 0.562 MB/s 0.556 MB/s 0.622 MB/s +1.1% -9.7%
bs=1000 sw=10 sl=64 p50 1,084,863 us 1,096,140 us 987,499 us -1.0% +9.9%
bs=1000 sw=10 sl=64 p95 1,128,394 us 1,191,011 us 1,028,784 us -5.3% +9.7%
bs=1000 sw=10 sl=64 p99 1,128,394 us 1,191,011 us 1,057,136 us -5.3% +6.7%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,500.18,200,128000,400,0.244,24351.31,35053.55,35053.55
1,100,10,64,20,2541.28,2000,1280000,787,0.480,125190.76,158095.55,158095.55
2,1000,10,64,20,21710.91,20000,12800000,921,0.562,1084863.37,1128393.66,1128393.66

@aglinxinyuan

Copy link
Copy Markdown
Contributor

@aglinxinyuan Can you please review it

You can use the bot comment to request a review. Please also fix the format issue. You can click each CI to view the issue.

Copilot AI left a comment

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.

Pull request overview

This PR improves the workflow-editing experience by replacing cryptic backend exception strings with more actionable, user-facing validation messages for common “operator added but not configured” scenarios, primarily during compilation-time schema propagation.

Changes:

  • Frontend: normalize compilation-error display by stripping Java/Scala exception prefixes and grouping them under a friendlier category.
  • Backend operators: add explicit validation (require) messages for Projection and SQL/AsterixDB source configuration fields.
  • File-based sources: add early checks and clearer messaging when schema inference tries to read an invalid selection (e.g., folder vs. file) and when Arrow schema inference fails.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
frontend/src/app/workspace/component/result-panel/error-frame/error-frame.component.ts Strips common exception prefixes from compilation errors and groups them for display.
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/sql/SQLSourceOpDesc.scala Adds required-field validation messages for SQL source configuration.
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/sql/asterixdb/AsterixDBSourceOpDesc.scala Adds required-field validation messages specific to AsterixDB configuration.
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/scan/json/JSONLScanSourceOpDesc.scala Adds user-friendly validation/message when schema inference reads JSONL inputs.
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/scan/csvOld/CSVOldScanSourceOpDesc.scala Adds user-friendly validation/message when schema inference reads legacy CSV inputs.
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/scan/csv/ParallelCSVScanSourceOpDesc.scala Adds user-friendly validation/message when schema inference reads parallel CSV inputs.
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/scan/csv/CSVScanSourceOpDesc.scala Adds user-friendly validation/message when schema inference reads CSV inputs.
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/scan/arrow/ArrowSourceOpDesc.scala Adds user-friendly validation for Arrow file selection and a clearer schema inference failure message.
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/projection/ProjectionOpDesc.scala Improves the validation message when no projection attributes are selected.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@roshiiiz
roshiiiz requested a review from Copilot July 9, 2026 15:39

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

@github-actions github-actions Bot added the engine label Jul 9, 2026

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/scan/arrow/ArrowSourceOpDesc.scala:92

  • RootAllocator is allocated but never closed. Since this code can run during schema inference (potentially multiple times while editing workflows), leaving the allocator open can leak off-heap memory. Consider managing it via Using.Manager so it’s always closed even on exceptions.
    val allocator = new RootAllocator()

    Using
      .Manager { use =>
        val channel = use(Files.newByteChannel(file.toPath, StandardOpenOption.READ))

@roshiiiz
roshiiiz requested a review from Copilot July 9, 2026 17:58

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

@roshiiiz
roshiiiz requested a review from Copilot July 9, 2026 23:55

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@roshiiiz

Copy link
Copy Markdown
Contributor Author

@aglinxinyuan This PR is ready for final review and merge!

I've gone through several rounds of Copilot AI reviews and addressed all of the architectural feedback. (Honestly, I had to stop because it kept nitpicking unrelated code until I literally hit my quota limit for reviews ).

To summarize the final state of this PR:

Frontend: Normalized compilation and execution errors by stripping out the raw Java/Scala exception prefixes so users get clean, readable validation messages.
Backend Validation: Added explicit require() validations to Projection, SQL, and AsterixDB sources so they fail gracefully with actionable UI messages when an operator is added but left unconfigured.
File Sources: Hardened the file-based sources (Arrow, CSV) to catch invalid selections (like selecting a folder instead of a file) early during schema inference.
State Cleanups: Refactored the CSV operators (CSVScanSourceOpDesc, ParallelCSVScanSourceOpDesc, CSVOldScanSourceOpDesc) to remove side-effect mutations during sourceSchema() inference (which was the final thing Copilot was complaining about).

The local dev stack is passing all tests. Could you please take a look and approve? Thanks!

@github-actions github-actions Bot added docs Changes related to documentations infra labels Jul 10, 2026
@roshiiiz
roshiiiz force-pushed the fix/user-friendly-error-messages branch from 1c7c1fd to 1af7927 Compare July 10, 2026 00:14
@github-actions github-actions Bot removed docs Changes related to documentations infra labels Jul 10, 2026
@roshiiiz
roshiiiz force-pushed the fix/user-friendly-error-messages branch from 1af7927 to faa965a Compare July 10, 2026 00:17

@aglinxinyuan aglinxinyuan left a comment

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.

LGTM! I kinda agree that Copilot is nitpicking on this one.

- reformat the over-100-column require() in AsterixDBSourceOpDesc so
  scalafmtCheckAll passes
- align the scan-source missing-fileName error in both LogicalPlan
  copies (amber + workflow-compiling-service) with the new
  'No file selected...' wording that the updated specs expect
- WorkflowCompiler: keep the first error recorded per operator so the
  root-cause resolution failure (e.g. FileNotFoundException with the
  bad path) is not overwritten by follow-on schema-propagation
  failures on the same operator
- update workflow-operator DescSpecs that pinned the old contracts:
  sourceSchema() returning null before configuration
  (CSVOld/JSONL/MySQL/PostgreSQL/AsterixDB/SQL) and
  ArrowSourceOpDesc.inferSchema throwing a bare IOException
@aglinxinyuan
aglinxinyuan enabled auto-merge July 10, 2026 00:52
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Jul 10, 2026
@aglinxinyuan
aglinxinyuan removed this pull request from the merge queue due to a manual request Jul 10, 2026
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Jul 10, 2026
Merged via the queue into apache:main with commit 8a51c56 Jul 10, 2026
26 checks passed
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Jul 27, 2026
…rkflow-compiler (apache#6143)

### What changes were proposed in this PR?

**This is a source-level de-duplication only — the runtime behavior of
two compilations stays.** A workflow is still compiled twice: once at
editing time (through workflow-compiling-service) and once at execution
time (through amber). This PR only makes both paths share one compiler
implementation instead of two hand-synced copies.

amber and workflow-compiling-service each maintained a separate copy of
the workflow compiler and its models (`WorkflowCompiler`, `LogicalPlan`,
`LogicalLink`, `LogicalPlanPojo`), which had to be kept in sync by hand
(e.g. apache#6288 had to patch both copies). This PR consolidates them into a
single shared `common/workflow-compiler` module that both services
depend on; the old per-service copies are removed.

The unified `WorkflowCompiler.compile` returns a
`WorkflowCompilationResult` (logical plan, optional physical plan,
per-port output schemas, per-operator errors, and the output ports
needing storage) and takes a `CompilationErrorHandling` mode: `Lenient`
for the editing-time path (accumulate per-operator errors so the UI can
render them) and `Strict` for the execution path (fail-fast before a
run). amber's engine `Workflow` becomes a thin wrapper over the
compilation result, built via `Workflow.fromCompilationResult`.

Two known minor behavior changes (both flagged in review, both
intentional):
- Plan expansion now uses `scala.util.Try` (non-fatal only) where the
old compiling-service caught `Throwable`, so a fatal JVM error during
expansion now fails the `/compile` request instead of being recorded
per-operator.
- `Strict` now also fails fast on schema-propagation errors (e.g. a
Projection on a missing column). The legacy execution path silently
launched such plans and they only failed at runtime; per review
discussion the fail-fast contract now covers this case too, pinned by a
test.

### Any related issues, documentation, discussions?

Closes apache#6142. Design rationale lives in the scaladoc of
`WorkflowCompiler`.

### How was this PR tested?

- Migrated the compiler and model unit specs into the new module and
added strict-mode coverage (success path and the schema-propagation
fail-fast path).
- amber and workflow-compiling-service compile and test against the
shared library.
- Rebased over apache#6288 and verified its error-message changes carry over
into the shared module (they now exist in one place instead of two).

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.8 (Claude Code); review follow-ups by Claude
Fable 5 (Claude Code)

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common engine fix frontend Changes related to the frontend GUI platform Non-amber Scala service paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error prompting message is not user-friendly

4 participants