Skip to content

test(amber): add unit test coverage for AmberMessage envelopes#4829

Open
aglinxinyuan wants to merge 2 commits intoapache:mainfrom
aglinxinyuan:test-amber-message-envelopes-spec
Open

test(amber): add unit test coverage for AmberMessage envelopes#4829
aglinxinyuan wants to merge 2 commits intoapache:mainfrom
aglinxinyuan:test-amber-message-envelopes-spec

Conversation

@aglinxinyuan
Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Add AmberMessageEnvelopesSpec covering the engine message envelope layer:

  • WorkflowFIFOMessage / WorkflowRecoveryMessage round-trip via case class accessors and the WorkflowMessage / Serializable traits
  • RecoveryPayload subtypes (UpdateRecoveryStatus, ResendOutputTo, NotifyFailedNode) carry their args; the ResendOutputTo ActorRef field is exercised via a real Pekko ActorSystem
  • WorkflowMessage.getInMemSize for a DataFrame payload, an empty-frame DataFrame, and the 200L default for any other WorkflowFIFOMessagePayload
  • WorkflowFIFOMessagePayload / DirectControlMessagePayload trait wiring

The catch-all case _ => 200L for non-WorkflowFIFOMessage subtypes is intentionally not tested because WorkflowMessage is sealed and today has only one subtype, so that branch is dead by construction.

Any related issues, documentation, discussions?

Closes #4828

How was this PR tested?

sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.common.ambermessage.AmberMessageEnvelopesSpec" — 11/11 tests pass.

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

Generated-by: Claude Code (Claude Opus 4.7)

Add AmberMessageEnvelopesSpec covering the engine message envelope
layer:
- WorkflowFIFOMessage and WorkflowRecoveryMessage round-trip via case
  class accessors and the WorkflowMessage / Serializable traits
- RecoveryPayload subtypes carry their args (with a real Pekko
  ActorSystem to wire ResendOutputTo's ActorRef field)
- WorkflowMessage.getInMemSize for DataFrame, empty DataFrame, and the
  200L default branch for any other WorkflowFIFOMessagePayload
- WorkflowFIFOMessagePayload / DirectControlMessagePayload traits are
  implementable as custom payloads

The catch-all "case _ => 200L" for non-WorkflowFIFOMessage subtypes is
intentionally not tested because WorkflowMessage is sealed and today
has only one subtype, so that branch is dead by construction.

Closes apache#4828

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aglinxinyuan aglinxinyuan requested review from Yicong-Huang and Copilot and removed request for Copilot May 3, 2026 04:13
@github-actions github-actions Bot added the engine label May 3, 2026
@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 43.20%. Comparing base (945849c) to head (c4526fc).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4829      +/-   ##
============================================
+ Coverage     42.84%   43.20%   +0.36%     
- Complexity     2027     2036       +9     
============================================
  Files           957      957              
  Lines         34077    34077              
  Branches       3753     3753              
============================================
+ Hits          14600    14724     +124     
+ Misses        18693    18578     -115     
+ Partials        784      775       -9     
Flag Coverage Δ
amber 41.36% <ø> (+0.63%) ⬆️
python 84.81% <ø> (+0.65%) ⬆️

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.

@Yicong-Huang Yicong-Huang enabled auto-merge (squash) May 3, 2026 07:01
@aglinxinyuan aglinxinyuan requested a review from Copilot May 3, 2026 08:07
@aglinxinyuan aglinxinyuan disabled auto-merge May 3, 2026 08:07
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 a new Scala unit test suite for Amber's message-envelope layer under ambermessage, targeting the lightweight wrapper/message types that underpin engine messaging and flow-control sizing.

Changes:

  • Add AmberMessageEnvelopesSpec covering WorkflowFIFOMessage and WorkflowRecoveryMessage field/accessor behavior.
  • Add tests for RecoveryPayload subtypes, including ResendOutputTo with a Pekko ActorSystem.
  • Add tests for WorkflowMessage.getInMemSize and basic trait wiring for WorkflowFIFOMessagePayload and DirectControlMessagePayload.

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

Per Copilot feedback on apache#4829: terminate() does not wait for shutdown
to complete, leaving Pekko threads outliving the test and making
"amber-message-envelopes-test" unavailable on JVM reruns. Switch to a
suite-local ActorSystem shut down via TestKit.shutdownActorSystem in
afterAll, matching the ControllerSpec / WorkerSpec cleanup pattern.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aglinxinyuan aglinxinyuan enabled auto-merge (squash) May 3, 2026 09:02
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 AmberMessage envelopes

4 participants