Skip to content

test(workflow-core): add unit test coverage for core/executor reflection#4834

Merged
Yicong-Huang merged 2 commits into
apache:mainfrom
aglinxinyuan:test-core-executor-reflection-spec
May 3, 2026
Merged

test(workflow-core): add unit test coverage for core/executor reflection#4834
Yicong-Huang merged 2 commits into
apache:mainfrom
aglinxinyuan:test-core-executor-reflection-spec

Conversation

@aglinxinyuan
Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Add CoreExecutorReflectionSpec covering the four classes/traits in common/workflow-core/.../core/executor:

  • OperatorExecutor trait defaults (open/close no-ops, produceStateOnStart/Finish None, processState passthrough, processTupleMultiPort delegation to processTuple, onFinish empty, onFinishMultiPort delegation to onFinish)
  • SourceOperatorExecutor trait defaults (processTuple / processTupleMultiPort always empty; onFinishMultiPort delegates to produceTuple with no port routing)
  • ExecFactory.newExecFromJavaClassName across all four constructor-shape fallbacks (no-arg, (String), (Int, Int), (String, Int, Int)) plus ClassNotFoundException for unknown classes
  • JavaRuntimeCompilation.compileCode success path on a self-contained source and diagnostic RuntimeException on syntax errors

The newExecFromJavaCode / compileCode-with-Texera-deps integration is intentionally not covered: javac is invoked with null compilation options, which under sbt test does not include the project classpath and produces "package ... does not exist" errors for any source that references workflow-core types. That failure is a deployment-environment artifact, not a contract violation.

Any related issues, documentation, discussions?

Closes #4833

How was this PR tested?

sbt "WorkflowCore/testOnly org.apache.texera.amber.core.executor.CoreExecutorReflectionSpec" - 18/18 tests pass.

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

Generated-by: Claude Code (Claude Opus 4.7)

Add CoreExecutorReflectionSpec covering:
- OperatorExecutor trait defaults (open/close no-ops,
  produceStateOnStart/Finish None, processState passthrough,
  processTupleMultiPort delegation, onFinish empty,
  onFinishMultiPort delegation)
- SourceOperatorExecutor trait defaults (processTuple /
  processTupleMultiPort empty; onFinishMultiPort delegates to
  produceTuple)
- ExecFactory.newExecFromJavaClassName across all four
  constructor-shape fallbacks (no-arg, (String), (Int,Int),
  (String,Int,Int)) plus ClassNotFoundException for unknown classes
- JavaRuntimeCompilation.compileCode success path on a self-contained
  source and diagnostic RuntimeException on syntax errors

The newExecFromJavaCode / compileCode-with-Texera-deps integration is
intentionally not covered: javac is invoked with null compilation
options, which under sbt test does not include the project classpath
and produces "package ... does not exist" errors for any source that
references workflow-core types. That failure is a
deployment-environment artifact, not a contract violation.

Closes apache#4833

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

codecov-commenter commented May 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.95%. Comparing base (6d617b6) to head (98a9542).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4834      +/-   ##
============================================
+ Coverage     47.70%   47.95%   +0.25%     
- Complexity     2139     2153      +14     
============================================
  Files           817      817              
  Lines         25980    25980              
  Branches       2343     2343              
============================================
+ Hits          12393    12460      +67     
+ Misses        12804    12735      -69     
- Partials        783      785       +2     
Flag Coverage Δ
access-control-service 28.12% <ø> (ø)
amber 43.40% <ø> (+0.43%) ⬆️
computing-unit-managing-service 0.00% <ø> (ø)
config-service 0.00% <ø> (ø)
file-service 33.24% <ø> (ø)
workflow-compiling-service 47.72% <ø> (ø)

Flags with carried forward coverage won't be shown. 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.

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

Adds focused Scala unit tests in workflow-core to validate the reflection/runtime-compilation behavior in the core/executor layer (trait default methods, reflection-based executor construction, and Java runtime compilation diagnostics).

Changes:

  • Add tests for OperatorExecutor and SourceOperatorExecutor default method behaviors (no-ops, delegation, and routing defaults).
  • Add tests for ExecFactory.newExecFromJavaClassName constructor fallback paths plus unknown-class handling.
  • Add tests for JavaRuntimeCompilation.compileCode success on self-contained source and diagnostic failure on invalid Java.

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

@Yicong-Huang Yicong-Huang enabled auto-merge (squash) May 3, 2026 07:15
@Yicong-Huang Yicong-Huang merged commit 316a9c2 into apache:main May 3, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add unit test coverage for core/executor reflection layer

4 participants