Repository navigation
test(pyamber): extend core model, proxy and start-worker handler coverage - #6988
Merged
Merged
Conversation
…rage Extend the single-blocking-IO and proxy-server suites and add a new start_worker_handler test (was ~41% covered), mirroring the sibling end-worker handler test pattern. Covers the uncovered guard, error and state-transition branches; tests stay hermetic with no real sleeps and no sockets or threads left running. No source changes.
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6988 +/- ##
============================================
+ Coverage 78.99% 79.08% +0.09%
Complexity 3788 3788
============================================
Files 1160 1160
Lines 46105 46105
Branches 5115 5115
============================================
+ Hits 36419 36462 +43
+ Misses 8067 8024 -43
Partials 1619 1619
*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:
|
Contributor
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🟢 | bs=10 sw=10 sl=64 | 373 | 0.228 | 27,062/32,607/32,607 us | 🟢 -9.6% / 🔴 +120.8% |
| 🔴 | bs=100 sw=10 sl=64 | 737 | 0.45 | 134,163/166,330/166,330 us | 🟢 -11.2% / 🔴 +55.0% |
| 🔴 | bs=1000 sw=10 sl=64 | 835 | 0.51 | 1,194,228/1,312,017/1,312,017 us | 🔴 +7.6% / 🔴 +27.7% |
Baseline details
Latest main 469e8f0 from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 373 tuples/sec | 381 tuples/sec | 787.55 tuples/sec | -2.1% | -52.6% |
| bs=10 sw=10 sl=64 | MB/s | 0.228 MB/s | 0.233 MB/s | 0.481 MB/s | -2.1% | -52.6% |
| bs=10 sw=10 sl=64 | p50 | 27,062 us | 26,307 us | 12,255 us | +2.9% | +120.8% |
| bs=10 sw=10 sl=64 | p95 | 32,607 us | 36,084 us | 15,802 us | -9.6% | +106.3% |
| bs=10 sw=10 sl=64 | p99 | 32,607 us | 36,084 us | 19,008 us | -9.6% | +71.5% |
| bs=100 sw=10 sl=64 | throughput | 737 tuples/sec | 766 tuples/sec | 997.81 tuples/sec | -3.8% | -26.1% |
| bs=100 sw=10 sl=64 | MB/s | 0.45 MB/s | 0.467 MB/s | 0.609 MB/s | -3.6% | -26.1% |
| bs=100 sw=10 sl=64 | p50 | 134,163 us | 127,233 us | 100,690 us | +5.4% | +33.2% |
| bs=100 sw=10 sl=64 | p95 | 166,330 us | 187,361 us | 107,316 us | -11.2% | +55.0% |
| bs=100 sw=10 sl=64 | p99 | 166,330 us | 187,361 us | 113,823 us | -11.2% | +46.1% |
| bs=1000 sw=10 sl=64 | throughput | 835 tuples/sec | 849 tuples/sec | 1,030 tuples/sec | -1.6% | -19.0% |
| bs=1000 sw=10 sl=64 | MB/s | 0.51 MB/s | 0.518 MB/s | 0.629 MB/s | -1.5% | -18.9% |
| bs=1000 sw=10 sl=64 | p50 | 1,194,228 us | 1,172,941 us | 981,213 us | +1.8% | +21.7% |
| bs=1000 sw=10 sl=64 | p95 | 1,312,017 us | 1,219,607 us | 1,027,605 us | +7.6% | +27.7% |
| bs=1000 sw=10 sl=64 | p99 | 1,312,017 us | 1,219,607 us | 1,055,466 us | +7.6% | +24.3% |
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,536.14,200,128000,373,0.228,27061.92,32606.78,32606.78
1,100,10,64,20,2711.87,2000,1280000,737,0.450,134163.48,166330.36,166330.36
2,1000,10,64,20,23944.76,20000,12800000,835,0.510,1194228.21,1312016.54,1312016.54
aglinxinyuan
requested review from
Yicong-Huang,
mengw15 and
xuang7
and removed request for
xuang7
July 29, 2026 02:16
aglinxinyuan
pushed a commit
to eugenegujing/texera
that referenced
this pull request
Jul 30, 2026
Rewrites test_start_worker_handler.py, added by apache#6988, to cover all three branches and the shared tail. The source branch pins the RUNNING transition, the synthetic port and SOURCE_STARTER channel registration (including their order, since the reverse raises KeyError on a real InputManager), and the ordered pair of enqueued ECMElements: StartChannel with NO_ALIGNMENT then EndChannel with PORT_ALIGNMENT, both carrying the no-reply command id -1. Branch precedence, the empty marker scope, the unwrappable EmptyRequest and the data-sub-queue routing of the markers were not previously asserted. Six tests use real collaborators rather than mocks, for behavior mocks cannot express -- a rejected transition leaves the queue, the state and the InputManager untouched, the markers land in the data sub-queue and so are gated by disable_data, and the response version tracks the real state clock on both the source and the non-source paths. One of them pins observed current behavior rather than correctness, and says so in a comment: a second StartWorker silently appends another marker pair. The two real-state-clock tests on the non-source paths carry over the READY and PAUSED cases from apache#6988; everything else that file asserted is subsumed by a stricter assertion here. Closes apache#7058
renovate-bot
pushed a commit
to renovate-bot/apache-_-texera
that referenced
this pull request
Jul 30, 2026
### What changes were proposed in this PR? Rewrites `amber/src/test/python/core/architecture/handlers/control/test_start_worker_handler.py`, added by apache#6988 while this PR was open, to cover all three branches of `StartWorkerHandler` and the shared tail. Four behaviors the previous file did not assert: | Behavior | Why it matters | | --- | --- | | Branch precedence | `is_source` wins even when materialization reader threads exist, so the `elif` predicate must go unqueried | | Empty marker scope | A self-addressed marker propagates nowhere | | `EmptyRequest` unwrapped via `get_one_of` | `AsyncRpcServer` unwraps the payload before dispatching; an unset oneof delivers `None`, and betterproto's `__eq__` cannot see the difference | | Markers land on the data sub-queue | `ECMElement`s are data traffic, so a source worker's own start/end markers are gated by `disable_data` — pause and backpressure — unlike control messages | It also pins the ordering of `add_input_port` before `register_input` (the reverse raises `KeyError` on a real `InputManager`, since `register_input` ends with `self._ports[port_id].add_channel(...)`). Six tests run against real collaborators — a `StateManager` built on the production transition graph and a real `InputManager` sharing the context's `InternalQueue` — rather than mocks, because they pin behavior mocks cannot express: a rejected transition from `UNINITIALIZED` leaves the queue, the state and the `InputManager` untouched; the two markers are routed to the data sub-queue; and the response version tracks the real state clock on both the source and the non-source paths. The two non-source cases (`READY`/0 with reader threads, `PAUSED`/1 echoed untouched) carry over from apache#6988; everything else that file asserted is subsumed by a stricter assertion here. `test_double_start_enqueues_a_second_pair_of_markers` deliberately pins observed current behavior rather than correctness. `StateManager.transit_to` returns early when the target equals the current state, so a second `StartWorker` is a silent no-op on the state and appends another marker pair — including a second `PORT_ALIGNMENT` `EndChannel` on the same port. The test comment says so and asks for a rewrite if an idempotency guard is ever added. Test-only change; no production code is touched. ### Any related issues, documentation, discussions? Closes apache#7058. The real-collaborator tests double as a Python-side guard against the stale-state-snapshot family of bugs described in apache#6010 (`WorkerExecution.scala:56`); a mocked `get_state_with_version` returns a constant and cannot catch a hoisted snapshot. ### How was this PR tested? New unit tests only; no production behavior changes. ``` cd amber pytest src/test/python/core/architecture/handlers/ -q ``` - 23 cases in this file; the handlers package goes from 46 to 69 passing tests. - `black --check` and `ruff check` clean. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5)
This was referenced Nov 25, 2026
renovate-bot
pushed a commit
to renovate-bot/apache-_-texera
that referenced
this pull request
Nov 25, 2026
…9686) ### What changes were proposed in this PR? Remove code that nothing uses, and constructs that repeat a default or an alias, from the Python tests, the agent service, three frontend specs, the AsterixDB source and the RustFS test container, and make an unreachable error check in the single-node example loader reachable (**+84/−137 lines**). Only the loader's behavior changes: a workflow file that `jq` cannot parse is now reported and skipped instead of aborting the loader. - **Python tests (14 files):** `test_console_message.py` drops the unused `internal_queue` and `timed_buffer` fixtures and their imports. Two tests drop fixture parameters they never read (`executor`, `a_timestamp`), and `test_proxy_client.py` names an unused loop value `_`. The others write `dict(...)` calls as literals, return from fixtures that yield without teardown, drop empty `@pytest.fixture()` parentheses, merge nested `with` blocks, return a value directly instead of through a local, take the first element with `next(iter(...))`, and spell `datetime.timezone.utc`, `socket.timeout` and `bytes()` as `datetime.UTC`, `TimeoutError` and `b""` (Ruff targets Python 3.11). - **Agent service:** `src/agent/index.ts` and `src/api/index.ts` only re-export modules that callers import directly. No file imports either barrel, and the package entry is `src/index.ts`. `workflow-system-metadata.ts` drops the unused `OperatorSchema` and `ValidationError` type imports. - **Frontend specs:** the dataset and model creator specs drop `FormsModule` and `HttpClientTestingModule`, which `createFormlyModalFixture` already provides, and the admin Gmail spec drops three modules that the standalone component and its stubbed service do not need. - **`load-examples.sh`:** tests the `content=$(jq -c . "$workflow_file")` assignment in the `if` instead of checking `$?` after it. The script runs under `set -euo pipefail` and `main` calls `load_workflows` directly, so the old check could never fire: a workflow file that `jq` could not parse aborted the loader and skipped the files after it, although the comment above `FAILURES` calls each failure deliberately non-fatal. Now `print_error` counts the file, the loop moves on, and `main` still exits non-zero at the end. `test_load_examples_sh.sh` adds a case with an unparseable workflow sorted ahead of a good one. - **AsterixDB source:** `AsterixDBConnUtil` and `AsterixDBSourceOpExec` assign the version response and the parsed row once as `val`s instead of overwriting `null` and `None` placeholders. - **`RustFSContainer`:** drops the Scaladoc lines saying the console is left disabled. RustFS 1.0.0 enables the console by default, and the fixture does not override it. | Event | PR / Commit | | --- | --- | | Introduced by | Python tests: apache#1259 (2021-07-23), apache#1498 (2022-04-15), apache#1452 (2022-05-13), apache#2067 (2023-07-27), apache#1748 (2023-11-09), apache#2815 (2024-09-05), apache#4520 (2026-04-27), apache#4704, apache#4719 and apache#4795 (2026-05-03), apache#4893 (2026-05-04), apache#6643 (2026-07-20), apache#6988 (2026-07-29), apache#7374 (2026-08-07), apache#7579 (2026-08-13), apache#8067 (2026-08-29), apache#8542 (2026-09-15), apache#9279 (2026-11-04), apache#8704 (2026-11-05), apache#9623 (2026-11-23); agent service: apache#4020 (2025-11-25), apache#4495 and apache#4540 (2026-04-28); frontend specs: apache#6513 (2026-07-18), apache#6576 (2026-07-20), apache#8068 (2026-08-28); `load-examples.sh`: apache#4247 (2026-03-02); AsterixDB source: apache#1044 (2021-02-25); `RustFSContainer`: apache#8542 (2026-09-15) | | Usage removed by | Creator spec modules: apache#9522 (2026-11-22, `refactor(frontend): share dataset and model resource UI`) moved both specs to `createFormlyModalFixture`. Everything else: unused, unreachable or redundant since introduction. | As of 2026-11-24: - The AsterixDB placeholders have been overwritten before any read for over 5 years. - The console-message fixtures have been unused for over 2 years. - The `load-examples.sh` check has been unreachable for almost 9 months. - The agent-service barrels have had no importer for the 7 months the service has existed. - The creator spec modules have been redundant for 2 days. ### Any related issues, documentation, discussions? Closes apache#9685. ### How was this PR tested? Ran on this branch and on `main` at `424b2a757a` (Windows 11; Python 3.12 with CI's pinned `ruff` 0.14.7; Node 24 with Yarn 4.14.1; Bun 1.3.13; JDK 17; the loader test in an Alpine container with Bash 5.2.21 and jq 1.7.1): ```bash cd amber ruff check src/main/python src/test/python ruff format --check src/main/python src/test/python pytest $(git diff --name-only --relative origin/main -- src/test/python) cd ../agent-service bun test bun run typecheck cd ../frontend npx ng test --watch=false --include='**/user-dataset-creator.component.spec.ts' --include='**/user-model-creator.component.spec.ts' --include='**/admin-gmail.component.spec.ts' npx tsc --noEmit -p src/tsconfig.spec.json yarn prettier-eslint --list-different $(git diff --name-only --relative origin/main -- src) yarn eslint $(git diff --name-only --relative origin/main -- src) cd .. sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.source.sql.*" WorkflowCore/Test/compile WorkflowOperator/scalafmtCheckAll WorkflowCore/scalafmtCheckAll "WorkflowOperator/scalafixAll --check" "WorkflowCore/scalafixAll --check" bash bin/single-node/tests/test_load_examples_sh.sh ``` - **Python:** - Ruff passes on all 218 files. - The 14 changed test files run 288 tests with the same outcome per test on both sides: 218 pass, 67 are skipped and 3 fail. - The three failures are timestamp cases in `test_ui_parameter_contract.py` that expect UTC and come out 8 hours off in this machine's time zone. They fail the same way on `main`. - **Agent service:** all 361 tests in 20 files and the typecheck pass on both sides. - **Frontend:** the three specs run 37 tests, all passing on both sides. The spec typecheck, prettier-eslint and ESLint pass. - **Scala:** the 11 `source.sql` suites, including the three AsterixDB specs, run 204 tests that all pass on both sides. WorkflowCore's tests compile, and scalafmt and scalafix pass on both modules. - **`load-examples.sh`:** `test_load_examples_sh.sh` passes all 11 checks. Against `main`'s loader, the 9 existing checks pass and the 2 new ones fail: `jq` exits 5 at the malformed file, and the loader stops there without creating the other workflow. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Extends two pyamber suites and adds one new test file (59 tests total). No source changes.
core/models/single_blocking_io.py(~70% covered): extends the existing suite over the uncovered branches.core/proxy/proxy_server.py(~85% covered): extends the existing suite.core/architecture/handlers/control/start_worker_handler.py(~41% covered, no dedicated test): new test file following the siblingtest_end_worker_handler.pypattern for constructing and asserting against the handler's context/state manager.Tests are hermetic and deterministic — no real sleeps, and no sockets or threads left running.
Any related issues, documentation, discussions?
Closes #6986.
How was this PR tested?
python -m pytestover the three files -> 59 passed.ruff format --check+ruff checkclean.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])