Skip to content

test(compiling-service): add direct unit tests for WorkflowCompiler#5022

Open
Yicong-Huang wants to merge 7 commits into
apache:mainfrom
Yicong-Huang:test/compiling-service-error-paths
Open

test(compiling-service): add direct unit tests for WorkflowCompiler#5022
Yicong-Huang wants to merge 7 commits into
apache:mainfrom
Yicong-Huang:test/compiling-service-error-paths

Conversation

@Yicong-Huang
Copy link
Copy Markdown
Contributor

@Yicong-Huang Yicong-Huang commented May 11, 2026

What changes were proposed in this PR?

Add direct unit coverage for workflow-compiling-service's WorkflowCompiler lenient-mode contract: compile never throws, per-operator failures accumulate into operatorIdToError, and physicalPlan is None whenever any error occurred. Only the REST happy path is covered today.

The spec invokes the compiler directly rather than the REST resource, sidestepping a separate response-serialization NPE surfaced while writing these tests (#5021). The contract tests stay green once that bug is fixed.

Any related issues, documentation, discussions?

Closes #5020. References #5021.

How was this PR tested?

sbt "WorkflowCompilingService/testOnly org.apache.texera.amber.compiler.WorkflowCompilerSpec" — all green. scalafmtCheck and compile clean.

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

Generated-by: Claude Opus 4.7 (1M context)

Pin the editing-time compiler's lenient-mode contract — `compile` never
throws, per-operator failures accumulate into `operatorIdToError`, and
`physicalPlan` is `None` whenever any error occurred. The existing
WorkflowCompilationResourceSpec only covers the REST happy path, so
none of these properties have direct coverage today.

Cases: empty plan compiles to empty physical plan; scan source without
fileName accumulates "no input file name"; non-existent fileName
accumulates FileResolver's "not a file" error; projection of a missing
attribute keeps upstream schemas while emitting a downstream error;
multiple unrelated failing ops all appear in the error map.

Bypasses the resource layer to also sidestep a separate response-
serialization NPE (apache#5021); these tests will keep passing
once that bug is fixed.

Closes apache#5020.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the platform Non-amber Scala service paths label May 11, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 42.73%. Comparing base (078ab64) to head (509de26).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5022      +/-   ##
============================================
- Coverage     42.75%   42.73%   -0.02%     
+ Complexity     2191     2177      -14     
============================================
  Files          1045     1031      -14     
  Lines         39968    38040    -1928     
  Branches       4217     3994     -223     
============================================
- Hits          17087    16257     -830     
+ Misses        21824    20771    -1053     
+ Partials       1057     1012      -45     
Flag Coverage Δ *Carryforward flag
access-control-service 39.53% <ø> (ø)
agent-service 33.72% <ø> (ø) Carriedforward from 6f088ab
amber 43.24% <ø> (-0.18%) ⬇️ Carriedforward from 6f088ab
computing-unit-managing-service 0.00% <ø> (ø)
config-service 0.00% <ø> (ø)
file-service 32.18% <ø> (ø)
frontend 33.08% <ø> (-0.96%) ⬇️ Carriedforward from 6f088ab
python 88.89% <ø> (-0.01%) ⬇️ Carriedforward from 6f088ab
workflow-compiling-service 47.72% <ø> (ø) Carriedforward from 6f088ab

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

☔ 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.

Move the multi-op chain happy-path (csv -> projection -> limit -> filter
-> filter -> limit) out of WorkflowCompilationResourceSpec into
WorkflowCompilerSpec, where the property being pinned (schema
propagation through every link) actually lives. Slim the resource spec
to a thin REST envelope check: HTTP 200, the JsonTypeInfo `type`
discriminator the frontend routes on, and the WorkflowCompilationResponse
polymorphic deserialization round-trip.

Each spec now owns a single failure axis: a compiler-behavior regression
lands on WorkflowCompilerSpec; an envelope-shape regression lands on
WorkflowCompilationResourceSpec.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 adds direct unit-level test coverage for workflow-compiling-service’s WorkflowCompiler lenient-mode behavior, and simplifies the existing /compile resource spec to focus on HTTP/JSON envelope concerns rather than compiler internals.

Changes:

  • Introduces WorkflowCompilerSpec to test happy-path compilation, schema propagation through a multi-op chain, and lenient-mode error accumulation (including multi-error cases).
  • Refactors WorkflowCompilationResourceSpec to keep only resource-layer assertions (HTTP 200 + JSON type=success discriminator), delegating compiler-behavior assertions to the new spec.

Reviewed changes

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

File Description
workflow-compiling-service/src/test/scala/org/apache/texera/service/resource/WorkflowCompilationResourceSpec.scala Narrows REST-layer coverage to status/discriminator + wire-shape JSON helper.
workflow-compiling-service/src/test/scala/org/apache/texera/amber/compiler/WorkflowCompilerSpec.scala Adds direct unit tests for compiler success, schema propagation, and lenient error accumulation behavior.

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

@Yicong-Huang Yicong-Huang enabled auto-merge (squash) May 11, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform Non-amber Scala service paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add error-path tests for WorkflowCompilationResource

4 participants