test(amber): cover workflow lifecycle cleanup - #7151
Conversation
Automated Reviewer SuggestionsBased on the
|
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 401 | 0.245 | 24,448/34,133/34,133 us | 🔴 +9.3% / 🔴 +116.2% |
| ⚪ | bs=100 sw=10 sl=64 | 813 | 0.496 | 119,066/155,332/155,332 us | ⚪ within ±5% / 🔴 +40.8% |
| ⚪ | bs=1000 sw=10 sl=64 | 920 | 0.561 | 1,085,600/1,124,657/1,124,657 us | ⚪ within ±5% / 🔴 -8.2% |
Baseline details
Latest main 91ed98d from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 401 tuples/sec | 404 tuples/sec | 771.62 tuples/sec | -0.7% | -48.0% |
| bs=10 sw=10 sl=64 | MB/s | 0.245 MB/s | 0.247 MB/s | 0.471 MB/s | -0.8% | -48.0% |
| bs=10 sw=10 sl=64 | p50 | 24,448 us | 22,366 us | 12,626 us | +9.3% | +93.6% |
| bs=10 sw=10 sl=64 | p95 | 34,133 us | 35,697 us | 15,786 us | -4.4% | +116.2% |
| bs=10 sw=10 sl=64 | p99 | 34,133 us | 35,697 us | 19,344 us | -4.4% | +76.5% |
| bs=100 sw=10 sl=64 | throughput | 813 tuples/sec | 807 tuples/sec | 971.56 tuples/sec | +0.7% | -16.3% |
| bs=100 sw=10 sl=64 | MB/s | 0.496 MB/s | 0.492 MB/s | 0.593 MB/s | +0.8% | -16.4% |
| bs=100 sw=10 sl=64 | p50 | 119,066 us | 124,036 us | 103,463 us | -4.0% | +15.1% |
| bs=100 sw=10 sl=64 | p95 | 155,332 us | 148,682 us | 110,296 us | +4.5% | +40.8% |
| bs=100 sw=10 sl=64 | p99 | 155,332 us | 148,682 us | 118,690 us | +4.5% | +30.9% |
| bs=1000 sw=10 sl=64 | throughput | 920 tuples/sec | 929 tuples/sec | 1,001 tuples/sec | -1.0% | -8.1% |
| bs=1000 sw=10 sl=64 | MB/s | 0.561 MB/s | 0.567 MB/s | 0.611 MB/s | -1.1% | -8.2% |
| bs=1000 sw=10 sl=64 | p50 | 1,085,600 us | 1,075,537 us | 1,008,988 us | +0.9% | +7.6% |
| bs=1000 sw=10 sl=64 | p95 | 1,124,657 us | 1,102,313 us | 1,055,260 us | +2.0% | +6.6% |
| bs=1000 sw=10 sl=64 | p99 | 1,124,657 us | 1,102,313 us | 1,074,689 us | +2.0% | +4.6% |
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,499.00,200,128000,401,0.245,24447.51,34133.29,34133.29
1,100,10,64,20,2460.90,2000,1280000,813,0.496,119065.95,155332.07,155332.07
2,1000,10,64,20,21744.01,20000,12800000,920,0.561,1085600.45,1124657.19,1124657.19
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7151 +/- ##
============================================
+ Coverage 79.58% 79.61% +0.02%
- Complexity 3837 3845 +8
============================================
Files 1160 1160
Lines 46188 46188
Branches 5145 5145
============================================
+ Hits 36761 36772 +11
+ Misses 7795 7770 -25
- Partials 1632 1646 +14
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a new Amber unit test suite to validate WorkflowLifecycleManager’s externally observable cleanup contract (user-count gating, cancellation while RUNNING, and deadline refresh on repeated terminal updates), using a suite-local Pekko ActorSystem wired into AmberRuntime for scheduler-driven assertions.
Changes:
- Introduces
WorkflowLifecycleManagerSpecwith three scenarios covering user-count tracking and cleanup scheduling behavior. - Uses
ExecutionStateStorestate updates to drive the lifecycle manager’s state-change subscription path. - Temporarily swaps
AmberRuntime’s global actor-system reference for deterministic scheduling during the suite, then restores it.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private var previousActorSystem: AnyRef = _ | ||
|
|
||
| private def getAmberRuntimeField(name: String): AnyRef = { | ||
| val field = AmberRuntime.getClass.getDeclaredField(name) | ||
| field.setAccessible(true) | ||
| field.get(AmberRuntime) | ||
| } | ||
|
|
||
| private def setAmberRuntimeField(name: String, value: AnyRef): Unit = { | ||
| val field = AmberRuntime.getClass.getDeclaredField(name) | ||
| field.setAccessible(true) | ||
| field.set(AmberRuntime, value) | ||
| } | ||
|
|
||
| override protected def beforeAll(): Unit = { | ||
| super.beforeAll() | ||
| previousActorSystem = getAmberRuntimeField("_actorSystem") | ||
| setAmberRuntimeField("_actorSystem", testSystem) | ||
| } | ||
|
|
||
| override protected def afterAll(): Unit = { | ||
| setAmberRuntimeField("_actorSystem", previousActorSystem) | ||
| TestKit.shutdownActorSystem(testSystem) | ||
| super.afterAll() | ||
| } |
What changes were proposed in this PR?
Adds
WorkflowLifecycleManagerSpecfor the lifecycle manager's externally observable cleanup behavior.The suite uses an isolated Pekko actor system and restores
AmberRuntime's shared actor-system reference after the suite, so other Amber suites retain their runtime setup.The assertions were mutation-tested against temporary production changes, all reverted before commit:
userCount == 0touserCount < 0status == RUNNINGtostatus != RUNNINGAny related issues, documentation, discussions?
Closes #7150
How was this PR tested?
Both checks completed successfully.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Codex (GPT-5)