Skip to content

test(amber): extend WorkflowVersionResource unit test coverage - #7166

Merged
mengw15 merged 1 commit into
apache:mainfrom
mengw15:chore/7161-workflow-version-test
Jul 31, 2026
Merged

test(amber): extend WorkflowVersionResource unit test coverage#7166
mengw15 merged 1 commit into
apache:mainfrom
mengw15:chore/7161-workflow-version-test

Conversation

@mengw15

@mengw15 mengw15 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Extends the existing MockTexeraDB-backed WorkflowVersionResourceSpec (which
only covered fetchSubsequentVersions + applyPatch) to cover the resource's
remaining methods. 14 new tests:

  • Pure diff logicapplyPatch reconstructs an older content from a stored
    delta (no DB); isSnapshotInRangeUnimportant returns true for equal bounds and
    for a replace-only range, false when the range contains an important (non-replace)
    change.
  • Version persistence (object methods)insertNewVersion persists a
    retrievable version; getLatestVersion returns the highest vid, and creates one
    when the workflow has none; insertVersion always versions a new workflow, and
    otherwise only when the content actually changed.
  • Resource endpointsretrieveVersionsOfWorkflow returns the
    importance-encoded list for a user with access and an empty list otherwise;
    retrieveWorkflowVersion reconstructs the workflow for an authorized user and
    throws ForbiddenException otherwise; cloneVersion creates a new workflow from
    an existing version.

The spec's beforeEach now also seeds an owner + a stranger user with the
appropriate access grants (mirroring WorkflowResourceCoverSpec) so the
auth-gated endpoints can be exercised. No production code was changed.

Any related issues, documentation, discussions?

Closes #7161.

How was this PR tested?

sbt "WorkflowExecutionService/testOnly *WorkflowVersionResourceSpec" — 15 passed
(1 existing + 14 new), run twice for determinism against the embedded Postgres.
The failure path was verified by breaking an assertion (1 failed, non-zero exit),
and Test/scalafmtCheck + Test/scalafix --check are clean.

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

Generated-by: Claude Code (Opus 4.8 [1M context])

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

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

This PR expands unit test coverage for WorkflowVersionResource (Amber backend) by extending the existing MockTexeraDB-backed WorkflowVersionResourceSpec to cover previously untested resource methods and diff/importance logic. It aligns with the goal in #7161 to add coverage without modifying production code.

Changes:

  • Added DB-backed setup for owner/stranger users and workflow access grants to exercise auth-gated endpoints.
  • Added unit tests for core versioning helpers (applyPatch, isSnapshotInRangeUnimportant, insertVersion, insertNewVersion, getLatestVersion).
  • Added resource endpoint tests for version listing/retrieval and cloning (retrieveVersionsOfWorkflow, retrieveWorkflowVersion, cloneVersion).

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

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.79%. Comparing base (45b7b20) to head (97cf896).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7166      +/-   ##
============================================
+ Coverage     79.62%   79.79%   +0.16%     
- Complexity     3836     3839       +3     
============================================
  Files          1160     1160              
  Lines         46188    46188              
  Branches       5145     5145              
============================================
+ Hits          36777    36854      +77     
+ Misses         7778     7699      -79     
- Partials       1633     1635       +2     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 45b7b20
agent-service 77.42% <ø> (ø) Carriedforward from 45b7b20
amber 73.54% <ø> (+0.45%) ⬆️
computing-unit-managing-service 20.49% <ø> (ø) Carriedforward from 45b7b20
config-service 65.97% <ø> (ø) Carriedforward from 45b7b20
file-service 66.80% <ø> (ø) Carriedforward from 45b7b20
frontend 83.16% <ø> (ø) Carriedforward from 45b7b20
notebook-migration-service 78.89% <ø> (ø) Carriedforward from 45b7b20
pyamber 97.36% <ø> (ø) Carriedforward from 45b7b20
workflow-compiling-service 26.31% <ø> (ø) Carriedforward from 45b7b20

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

Compared against main 45b7b20 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 409 0.249 23,184/34,781/34,781 us 🔴 +12.4% / 🔴 +120.3%
🟢 bs=100 sw=10 sl=64 836 0.51 117,926/144,566/144,566 us 🟢 -17.2% / 🔴 +31.1%
bs=1000 sw=10 sl=64 963 0.587 1,038,559/1,076,698/1,076,698 us ⚪ within ±5% / ⚪ within ±5%
Baseline details

Latest main 45b7b20 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 409 tuples/sec 425 tuples/sec 771.62 tuples/sec -3.8% -47.0%
bs=10 sw=10 sl=64 MB/s 0.249 MB/s 0.26 MB/s 0.471 MB/s -4.2% -47.1%
bs=10 sw=10 sl=64 p50 23,184 us 20,626 us 12,626 us +12.4% +83.6%
bs=10 sw=10 sl=64 p95 34,781 us 34,135 us 15,786 us +1.9% +120.3%
bs=10 sw=10 sl=64 p99 34,781 us 34,135 us 19,344 us +1.9% +79.8%
bs=100 sw=10 sl=64 throughput 836 tuples/sec 819 tuples/sec 971.56 tuples/sec +2.1% -14.0%
bs=100 sw=10 sl=64 MB/s 0.51 MB/s 0.5 MB/s 0.593 MB/s +2.0% -14.0%
bs=100 sw=10 sl=64 p50 117,926 us 116,506 us 103,463 us +1.2% +14.0%
bs=100 sw=10 sl=64 p95 144,566 us 174,526 us 110,296 us -17.2% +31.1%
bs=100 sw=10 sl=64 p99 144,566 us 174,526 us 118,690 us -17.2% +21.8%
bs=1000 sw=10 sl=64 throughput 963 tuples/sec 962 tuples/sec 1,001 tuples/sec +0.1% -3.8%
bs=1000 sw=10 sl=64 MB/s 0.587 MB/s 0.587 MB/s 0.611 MB/s 0.0% -4.0%
bs=1000 sw=10 sl=64 p50 1,038,559 us 1,037,514 us 1,008,988 us +0.1% +2.9%
bs=1000 sw=10 sl=64 p95 1,076,698 us 1,076,848 us 1,055,260 us -0.0% +2.0%
bs=1000 sw=10 sl=64 p99 1,076,698 us 1,076,848 us 1,074,689 us -0.0% +0.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,489.32,200,128000,409,0.249,23184.43,34781.27,34781.27
1,100,10,64,20,2393.38,2000,1280000,836,0.510,117926.41,144565.84,144565.84
2,1000,10,64,20,20778.34,20000,12800000,963,0.587,1038558.94,1076698.14,1076698.14

@mengw15
mengw15 requested a review from aglinxinyuan July 31, 2026 12:56

@aglinxinyuan aglinxinyuan 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!

@mengw15
mengw15 added this pull request to the merge queue Jul 31, 2026
Merged via the queue into apache:main with commit d9c443f Jul 31, 2026
24 checks passed
@mengw15
mengw15 deleted the chore/7161-workflow-version-test branch July 31, 2026 19:20
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.

extend WorkflowVersionResource unit test coverage

4 participants