test(compiling-service): add direct unit tests for WorkflowCompiler#5022
test(compiling-service): add direct unit tests for WorkflowCompiler#5022Yicong-Huang wants to merge 7 commits into
Conversation
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>
Codecov Report✅ All modified and coverable lines are covered by tests. 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
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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>
There was a problem hiding this comment.
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
WorkflowCompilerSpecto test happy-path compilation, schema propagation through a multi-op chain, and lenient-mode error accumulation (including multi-error cases). - Refactors
WorkflowCompilationResourceSpecto keep only resource-layer assertions (HTTP 200 + JSONtype=successdiscriminator), 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com>
What changes were proposed in this PR?
Add direct unit coverage for
workflow-compiling-service'sWorkflowCompilerlenient-mode contract:compilenever throws, per-operator failures accumulate intooperatorIdToError, andphysicalPlanisNonewhenever 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.scalafmtCheckandcompileclean.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.7 (1M context)