Skip to content

test(amber): add unit test coverage for RegionPlan#4770

Merged
aglinxinyuan merged 4 commits into
apache:mainfrom
aglinxinyuan:xinyuan-test-region-plan-spec
May 3, 2026
Merged

test(amber): add unit test coverage for RegionPlan#4770
aglinxinyuan merged 4 commits into
apache:mainfrom
aglinxinyuan:xinyuan-test-region-plan-spec

Conversation

@aglinxinyuan
Copy link
Copy Markdown
Contributor

@aglinxinyuan aglinxinyuan commented May 3, 2026

What changes were proposed in this PR?

Add RegionPlanSpec covering the lookup and DAG-iteration contract of RegionPlan:

  • getRegion(id) returns the region with the given id; throws NoSuchElementException for unknown ids
  • getRegionOfLink returns the region whose physicalLinks contain the link; throws NoSuchElementException when no region claims it
  • getRegionOfPortId returns the region whose ports contain the global port id, or None when no region claims it
  • topologicalIterator yields region ids in topological order based on regionLinks

Any related issues, documentation, discussions?

Closes #4769

How was this PR tested?

sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.scheduling.RegionPlanSpec" — 7/7 tests pass.

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

Generated-by: Claude Code (Claude Opus 4.7)

Add RegionPlanSpec covering getRegion lookup (and unknown-id rejection),
getRegionOfLink and getRegionOfPortId search, and topologicalIterator
ordering across the regionLinks DAG.

Closes apache#4769

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 3, 2026 01:40
@github-actions github-actions Bot added the engine label May 3, 2026
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 dedicated ScalaTest spec for RegionPlan, the immutable scheduling graph used by Amber’s workflow execution layer. It is focused on formalizing the expected lookup and traversal behavior called out in issue #4769.

Changes:

  • Add RegionPlanSpec with unit tests for region lookup by id.
  • Add unit tests for lookup by physical link and global port id.
  • Add a unit test for topological iteration over regionLinks.

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

@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.46%. Comparing base (21cf0fc) to head (3a08302).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #4770   +/-   ##
=========================================
  Coverage     43.46%   43.46%           
- Complexity     2063     2066    +3     
=========================================
  Files           957      957           
  Lines         34077    34077           
  Branches       3753     3753           
=========================================
+ Hits          14810    14811    +1     
+ Misses        18469    18468    -1     
  Partials        798      798           
Flag Coverage Δ
amber 41.79% <ø> (ø)
python 85.32% <ø> (+0.02%) ⬆️

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.

@aglinxinyuan aglinxinyuan requested a review from Yicong-Huang May 3, 2026 01:59
…OfLink

Per Copilot feedback on apache#4770: lock down the absent-link failure mode
(`.find(...).get` raising NoSuchElementException) so the spec
documents the full lookup contract.

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

@Yicong-Huang Yicong-Huang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's improve this test.

Add a 5-region diamond plan (src fans out to three middle regions, all
joining a single sink) plus a 9-region wide DAG with multiple parallel
branches and joins. The diamond exercises getRegion/getRegionOfLink/
getRegionOfPortId/topologicalIterator across multi-op regions; the wide
DAG validates that topologicalIterator respects every regionLink edge
beyond a simple linked-list ordering.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aglinxinyuan aglinxinyuan enabled auto-merge (squash) May 3, 2026 09:01
@aglinxinyuan aglinxinyuan merged commit 32e0c61 into apache:main May 3, 2026
15 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 RegionPlan

4 participants