Skip to content

test(pyamber): build expression evaluator expectations with one helper - #9731

Open
aglinxinyuan wants to merge 1 commit into
apache:mainfrom
aglinxinyuan:test/python-expression-fixtures
Open

aglinxinyuan wants to merge 1 commit into
apache:mainfrom
aglinxinyuan:test/python-expression-fixtures

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

test_expression_evaluator.py builds its expected TypedValues with one module-level _expected_value(value_ref, value_str, value_type, expandable, item=False). The value reference, text, type and expandability stay literal in every case. Only the expression is derived: __getitem__(<ref>) for an indexed child, or the reference itself otherwise. The two dictionary children with non-numeric keys, 'b' and (10,), keep their explicit constructors, so the quoting of their keys stays visible.

test_evaluate_expression_handler.py patches the evaluator once in an evaluator fixture, and each case sets the return value or side effect it needs.

Every case keeps its name, inputs and expected values, in the same order.

Any related issues, documentation, discussions?

Closes #9730.

How was this PR tested?

  • In python:3.12-slim with amber/requirements.txt, amber/dev-requirements.txt and the bindings from bin/python-proto-gen.sh, cd amber && python -m pytest src/test/python/core/util/test_expression_evaluator.py src/test/python/core/architecture/handlers/control/test_evaluate_expression_handler.py: main and this branch each pass all 10 cases, with the same names, outcomes and order, compared from the JUnit XML reports.
  • Mutation check: each break was applied to main and to this branch and reverted afterwards, and the same cases failed on both.
    • expression_evaluator.py naming indexed children __item__(...) instead of __getitem__(...): test_evaluate_str_expression and test_evaluate_container_expressions.
    • expression_evaluator.py building value_str with str instead of repr: test_evaluate_str_expression.
    • evaluate_expression_handler.py passing the current tuple as input_: test_runtime_context_exposes_self_tuple_input and test_runtime_context_reflects_current_tuple_at_call_time.
  • ruff check and ruff format --check on both files.

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

Generated-by: Codex (GPT-6) and Claude Code (Claude Opus 5.5)

test_expression_evaluator.py wrote out every expected TypedValue in full,
including the __getitem__ expression of each indexed child. A module-level
helper now builds them from the value reference, text, type and
expandability, which stay literal in each case. The handler spec patches
the evaluator once in a fixture instead of in every case.
@aglinxinyuan aglinxinyuan self-assigned this Nov 27, 2026
Copilot AI balanced review requested due to automatic review settings November 27, 2026 22:20

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 insufficient remaining quota. Try requesting a review at a lower effort level.

@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: @Yicong-Huang
    You can notify them by mentioning @Yicong-Huang in a comment.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.77%. Comparing base (923c982) to head (cbec22f).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9731      +/-   ##
============================================
- Coverage     91.77%   91.77%   -0.01%     
  Complexity     5136     5136              
============================================
  Files          1308     1308              
  Lines         58048    58048              
  Branches       7558     7558              
============================================
- Hits          53274    53271       -3     
- Misses         2887     2889       +2     
- Partials       1887     1888       +1     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from 923c982
agent-service 99.56% <ø> (ø) Carriedforward from 923c982
amber 85.95% <ø> (ø) Carriedforward from 923c982
computing-unit-managing-service 63.81% <ø> (ø) Carriedforward from 923c982
config-service 87.50% <ø> (ø) Carriedforward from 923c982
file-service 82.16% <ø> (ø) Carriedforward from 923c982
frontend 96.45% <ø> (ø) Carriedforward from 923c982
notebook-migration-service 83.84% <ø> (ø) Carriedforward from 923c982
pyamber 98.64% <ø> (-0.07%) ⬇️
result-service 86.48% <ø> (ø) Carriedforward from 923c982
workflow-compiling-service 80.90% <ø> (ø) Carriedforward from 923c982

*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 · 🔴 5 worse · ⚪ 8 noise (<±5%) · 0 without baseline

Compared against main 923c982 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 451 0.276 21,041/34,234/34,234 us 🔴 -7.2% / 🔴 +152.3%
🟢 bs=100 sw=10 sl=64 979 0.598 101,376/115,371/115,371 us 🟢 -20.3% / 🔴 +26.2%
🔴 bs=1000 sw=10 sl=64 1,132 0.691 875,287/1,043,398/1,043,398 us 🔴 +16.3% / 🔴 +21.4%
Baseline details

Latest main 923c982 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 451 tuples/sec 486 tuples/sec 951.49 tuples/sec -7.2% -52.6%
bs=10 sw=10 sl=64 MB/s 0.276 MB/s 0.297 MB/s 0.581 MB/s -7.1% -52.5%
bs=10 sw=10 sl=64 p50 21,041 us 19,945 us 10,659 us +5.5% +97.4%
bs=10 sw=10 sl=64 p95 34,234 us 33,356 us 13,570 us +2.6% +152.3%
bs=10 sw=10 sl=64 p99 34,234 us 33,356 us 16,744 us +2.6% +104.5%
bs=100 sw=10 sl=64 throughput 979 tuples/sec 975 tuples/sec 1,256 tuples/sec +0.4% -22.1%
bs=100 sw=10 sl=64 MB/s 0.598 MB/s 0.595 MB/s 0.767 MB/s +0.5% -22.0%
bs=100 sw=10 sl=64 p50 101,376 us 102,488 us 84,170 us -1.1% +20.4%
bs=100 sw=10 sl=64 p95 115,371 us 144,751 us 91,401 us -20.3% +26.2%
bs=100 sw=10 sl=64 p99 115,371 us 144,751 us 104,021 us -20.3% +10.9%
bs=1000 sw=10 sl=64 throughput 1,132 tuples/sec 1,173 tuples/sec 1,299 tuples/sec -3.5% -12.9%
bs=1000 sw=10 sl=64 MB/s 0.691 MB/s 0.716 MB/s 0.793 MB/s -3.5% -12.8%
bs=1000 sw=10 sl=64 p50 875,287 us 850,411 us 819,011 us +2.9% +6.9%
bs=1000 sw=10 sl=64 p95 1,043,398 us 896,960 us 859,723 us +16.3% +21.4%
bs=1000 sw=10 sl=64 p99 1,043,398 us 896,960 us 909,957 us +16.3% +14.7%
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,442.99,200,128000,451,0.276,21040.96,34234.03,34234.03
1,100,10,64,20,2042.34,2000,1280000,979,0.598,101376.38,115370.93,115370.93
2,1000,10,64,20,17663.66,20000,12800000,1132,0.691,875286.87,1043398.34,1043398.34

@aglinxinyuan
aglinxinyuan requested a review from kunwp1 November 28, 2026 00:01

This branch has not been deployed

No deployments
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.

Build expression evaluator test expectations with one helper

3 participants