Skip to content

test(pyamber): cover the source and batch operator final methods - #8047

Open
aglinxinyuan wants to merge 1 commit into
apache:mainfrom
aglinxinyuan:cov/pyamber-operator
Open

test(pyamber): cover the source and batch operator final methods#8047
aglinxinyuan wants to merge 1 commit into
apache:mainfrom
aglinxinyuan:cov/pyamber-operator

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

test_operator.py goes from 32 tests to 44, covering SourceOperator.on_finish and BatchOperator's output-conversion arms.

Metric Before After
Codecov fully-covered lines today 173/183 178/183
Codecov fully-covered lines after #8040 171/183 178/183
Branch arms 26/30 30/30

+5 fully-covered lines today, +7 after #8040, and the file reaches 100% branch coverage. Lines 233 and 234 are line-hit with one arm untaken, so today's branch-less CI report already scores them covered; closing their second arm is mutation-proven but invisible until #8040 lands.

This is a small PR and I would rather say so than dress it up. What makes it worth having is that it closes the file permanently: the five remaining gap lines (153, 177, 259, 293, 515) are @abstractmethod bodies, and a grep of src/main/python for super().process_tuple|produce|process_batch|process_table|condition finds zero production call sites. 178/183 is the ceiling, so nobody needs to re-derive this target.

Scope narrowed during assessment, and the original plan is worth recording. This began as a three-file bundle also covering the four concrete partitioners and proxy_server.py. Both were dropped on measurement: the partitioners' base class is bare-pass stubs, and proxy_server.py is already at 90/95 with a 268-line spec, leaving 2 honest lines. Only operator.py survived.

What matters about the two covered paths

SourceOperator.on_finish is the uncovered production path of every Python source UDF. BatchOperator._process_batch's None and non-DataFrame arms decide what a batch operator emits when its handler returns nothing, or returns something that is not a DataFrame.

Verification

Measured from amber/ with the identical full-suite scope on both sides, --cov-branch passed explicitly (this branch lacks #8040's config), per-line hits and condition-coverage read out of coverage.xml by script rather than from the summary percentage. The before-state used main's spec extracted via git show HEAD: into a scratch dir and restored from that snapshot — never git restore.

Two reviewers returned nine findings against the first draft; all repaired. Three mutants survive and are reported rather than dropped, all three genuinely equivalent: != 0 to > 0 on a list length (non-negative by construction), and deleting @overrides.final from either method — overrides.final is typing.final, which enforces nothing at runtime. The last two prompted a docstring correction, since the original text claimed finality as the reason the method was worth testing.

Full pyamber suite: 5 failed, 1171 passed, 7 errors against main's 5 failed, 1159 passed, 7 errors. The FAILED/ERROR node-id sets were sorted and diffed — identical by identity, 12 entries. ruff check and ruff format --check pass on CI's exact scope. git diff --numstat is 226 0 — zero deletions.

No production file is touched; git diff -- 'amber/src/main/*' is empty.

Any related issues, documentation, discussions?

Closes #8043

How was this PR tested?

cd amber && python -m pytest -m "not integration" -q src/test/python/core/models/test_operator.py
44 passed, 1 warning

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

Generated-by: Claude Code (Opus 5)

Copilot AI lite review requested due to automatic review settings August 27, 2026 11:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @eugenegujing
    You can notify them by mentioning @eugenegujing in a comment.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.42%. Comparing base (b01b11f) to head (2c396d8).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8047   +/-   ##
=========================================
  Coverage     93.41%   93.42%           
  Complexity     4696     4696           
=========================================
  Files          1179     1179           
  Lines         47713    47713           
  Branches       5314     5314           
=========================================
+ Hits          44573    44576    +3     
+ Misses         1698     1695    -3     
  Partials       1442     1442           
Flag Coverage Δ *Carryforward flag
access-control-service 81.00% <ø> (ø) Carriedforward from b01b11f
agent-service 99.32% <ø> (ø) Carriedforward from b01b11f
amber 89.60% <ø> (ø) Carriedforward from b01b11f
computing-unit-managing-service 73.67% <ø> (ø) Carriedforward from b01b11f
config-service 86.73% <ø> (ø) Carriedforward from b01b11f
file-service 86.70% <ø> (ø) Carriedforward from b01b11f
frontend 95.89% <ø> (ø) Carriedforward from b01b11f
notebook-migration-service 79.31% <ø> (ø) Carriedforward from b01b11f
pyamber 97.85% <ø> (+0.06%) ⬆️
workflow-compiling-service 77.19% <ø> (ø) Carriedforward from b01b11f

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 2 better · 🔴 2 worse · ⚪ 11 noise (<±5%) · 0 without baseline

Compared against main b01b11f benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 382 0.233 23,570/40,575/40,575 us 🔴 +14.6% / 🔴 +193.1%
🟢 bs=100 sw=10 sl=64 818 0.499 119,100/142,907/142,907 us 🟢 -16.8% / 🔴 +52.6%
bs=1000 sw=10 sl=64 938 0.572 1,065,257/1,117,696/1,117,696 us ⚪ within ±5% / 🔴 +23.9%
Baseline details

Latest main b01b11f from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 382 tuples/sec 391 tuples/sec 894.86 tuples/sec -2.3% -57.3%
bs=10 sw=10 sl=64 MB/s 0.233 MB/s 0.239 MB/s 0.546 MB/s -2.5% -57.3%
bs=10 sw=10 sl=64 p50 23,570 us 23,043 us 11,139 us +2.3% +111.6%
bs=10 sw=10 sl=64 p95 40,575 us 35,399 us 13,843 us +14.6% +193.1%
bs=10 sw=10 sl=64 p99 40,575 us 35,399 us 16,839 us +14.6% +141.0%
bs=100 sw=10 sl=64 throughput 818 tuples/sec 797 tuples/sec 1,166 tuples/sec +2.6% -29.8%
bs=100 sw=10 sl=64 MB/s 0.499 MB/s 0.486 MB/s 0.711 MB/s +2.7% -29.9%
bs=100 sw=10 sl=64 p50 119,100 us 118,606 us 87,509 us +0.4% +36.1%
bs=100 sw=10 sl=64 p95 142,907 us 171,661 us 93,675 us -16.8% +52.6%
bs=100 sw=10 sl=64 p99 142,907 us 171,661 us 102,153 us -16.8% +39.9%
bs=1000 sw=10 sl=64 throughput 938 tuples/sec 930 tuples/sec 1,198 tuples/sec +0.9% -21.7%
bs=1000 sw=10 sl=64 MB/s 0.572 MB/s 0.568 MB/s 0.731 MB/s +0.7% -21.8%
bs=1000 sw=10 sl=64 p50 1,065,257 us 1,069,991 us 859,766 us -0.4% +23.9%
bs=1000 sw=10 sl=64 p95 1,117,696 us 1,174,820 us 902,897 us -4.9% +23.8%
bs=1000 sw=10 sl=64 p99 1,117,696 us 1,174,820 us 937,957 us -4.9% +19.2%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,523.87,200,128000,382,0.233,23569.68,40574.55,40574.55
1,100,10,64,20,2443.99,2000,1280000,818,0.499,119100.10,142907.38,142907.38
2,1000,10,64,20,21332.37,20000,12800000,938,0.572,1065256.98,1117696.39,1117696.39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@mengw15 mengw15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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 the pyamber source and batch operator final methods

4 participants