Skip to content

test(pyamber): close the schema, table, proxy and network-sender gaps - #8067

Merged
aglinxinyuan merged 3 commits into
apache:mainfrom
aglinxinyuan:cov/pyamber-models-and-proxy
Aug 29, 2026
Merged

aglinxinyuan merged 3 commits into
apache:mainfrom
aglinxinyuan:cov/pyamber-models-and-proxy

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Seven pyamber files, five existing specs extended and two new ones added. +15 fully-covered lines; six of the seven files reach 100%.

File Missed before After
handlers/control/open_executor_handler.py 2 (67%) 0 — 100%
models/schema/schema.py 3 (94%) 0 — 100%
models/schema/attribute_type.py 2 (96%) 0 — 100%
models/table.py 2 (95%) 0 — 100%
proxy/proxy_client.py 2 (94%) 0 — 100%
runnables/network_sender.py 2 (96%) 0 — 100%
storage/iceberg/iceberg_utils.py 4 local / 2 CI 2 left

No file here is worth a PR alone — each carries two or three lines. The bundle total is the point, and it is stated that way rather than dressed up per file.

iceberg_utils.py closes lines 239 and 275; its remaining 302–303 are already green in CI and worth zero. The local figure of 4 missed is a local-environment artefact, which is why the honest CI-equivalent gain is +15 and not +17.

Tests across the seven files go 37 → 89.

A measurement trap worth recording

This machine cannot run the Iceberg-backed tests — the postgres texera role cannot read iceberg_tables — so a raw local coverage run under-reports. An earlier assessment of one of these files measured 12 missed lines locally where Codecov showed 2, wrong by 6×. Every target here was sized from Codecov and the local numbers were used only for the delta, never for the ceiling.

Dead production code found, and deliberately not pinned

attribute_type.py:96-97 normalises a trailing Z before calling datetime.fromisoformat. Deleting the whole block leaves the suite byte-identical. That is not a coverage gap — fromisoformat has accepted Z since Python 3.11, and the CI matrix is 3.11/3.12/3.13, so the block is dead on every interpreter the project runs. A 10-case differential probe confirmed it.

No test was written to pin it. The test that had been named after that branch was renamed and annotated, so nothing in the suite claims to constrain a branch that cannot be reached.

Verification

27 mutations, 26 killed, 1 equivalent — the equivalent one being the dead block above. Each was applied one at a time against a tree verified hash-equal to a snapshot, reverted from that snapshot rather than from git.

Two adversarial reviewers returned nine findings against the first draft; all repaired, adding six further tests.

Measured with --cov=src/main/python under the exact marker filter CI uses (-m "not integration"), no name filter, identical on both sides. The before-state restored each tracked spec by exact single file path via git show HEAD:<path> and moved the two new specs aside; all seven were then restored from a scratch snapshot and md5-verified.

Full pyamber suite: 5 failed, 1269 passed, 7 errors, with the FAILED/ERROR set identical by identity to main's 12 entries — no regression. ruff check and ruff format --check pass on CI's exact scope (src/main/python src/test/python). Both new spec files carry the Apache licence header.

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

Any related issues, documentation, discussions?

Closes #8065

How was this PR tested?

cd amber && python -m pytest -m "not integration" -q src/test/python/core/models src/test/python/core/proxy src/test/python/core/runnables/test_network_sender.py src/test/python/core/architecture/handlers/control/test_open_executor_handler.py src/test/python/core/storage/iceberg/test_iceberg_utils_catalog.py
89 passed, 1 warning in 1.73s

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 28, 2026 04:26

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: @kunwp1, @Yicong-Huang
    You can notify them by mentioning @kunwp1, @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 93.54%. Comparing base (bdc6d2a) to head (cc41d24).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8067      +/-   ##
============================================
+ Coverage     93.51%   93.54%   +0.03%     
  Complexity     4709     4709              
============================================
  Files          1181     1181              
  Lines         47809    47809              
  Branches       5327     5327              
============================================
+ Hits          44708    44725      +17     
+ Misses         1663     1646      -17     
  Partials       1438     1438              
Flag Coverage Δ *Carryforward flag
access-control-service 81.00% <ø> (ø) Carriedforward from bdc6d2a
agent-service 99.32% <ø> (ø) Carriedforward from bdc6d2a
amber 89.59% <ø> (ø) Carriedforward from bdc6d2a
computing-unit-managing-service 73.67% <ø> (ø) Carriedforward from bdc6d2a
config-service 86.73% <ø> (ø) Carriedforward from bdc6d2a
file-service 87.89% <ø> (ø) Carriedforward from bdc6d2a
frontend 95.92% <ø> (ø) Carriedforward from bdc6d2a
notebook-migration-service 79.31% <ø> (ø) Carriedforward from bdc6d2a
pyamber 98.87% <ø> (+0.36%) ⬆️
workflow-compiling-service 77.19% <ø> (ø) Carriedforward from bdc6d2a

*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

github-actions Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main bdc6d2a 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 426 0.26 22,837/28,210/28,210 us 🔴 +16.7% / 🔴 +104.6%
🔴 bs=100 sw=10 sl=64 903 0.551 107,796/150,388/150,388 us 🔴 +19.9% / 🔴 +58.2%
⚪ bs=1000 sw=10 sl=64 1,093 0.667 912,413/1,012,467/1,012,467 us ⚪ within ±5% / 🔴 +10.4%
Baseline details

Latest main bdc6d2a from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 426 tuples/sec 477 tuples/sec 894.27 tuples/sec -10.7% -52.4%
bs=10 sw=10 sl=64 MB/s 0.26 MB/s 0.291 MB/s 0.546 MB/s -10.7% -52.4%
bs=10 sw=10 sl=64 p50 22,837 us 19,570 us 11,164 us +16.7% +104.6%
bs=10 sw=10 sl=64 p95 28,210 us 31,550 us 14,219 us -10.6% +98.4%
bs=10 sw=10 sl=64 p99 28,210 us 31,550 us 16,863 us -10.6% +67.3%
bs=100 sw=10 sl=64 throughput 903 tuples/sec 956 tuples/sec 1,158 tuples/sec -5.5% -22.0%
bs=100 sw=10 sl=64 MB/s 0.551 MB/s 0.584 MB/s 0.707 MB/s -5.7% -22.0%
bs=100 sw=10 sl=64 p50 107,796 us 103,601 us 88,711 us +4.0% +21.5%
bs=100 sw=10 sl=64 p95 150,388 us 125,441 us 95,062 us +19.9% +58.2%
bs=100 sw=10 sl=64 p99 150,388 us 125,441 us 102,275 us +19.9% +47.0%
bs=1000 sw=10 sl=64 throughput 1,093 tuples/sec 1,100 tuples/sec 1,188 tuples/sec -0.6% -8.0%
bs=1000 sw=10 sl=64 MB/s 0.667 MB/s 0.671 MB/s 0.725 MB/s -0.6% -8.0%
bs=1000 sw=10 sl=64 p50 912,413 us 903,020 us 874,204 us +1.0% +4.4%
bs=1000 sw=10 sl=64 p95 1,012,467 us 1,007,419 us 916,845 us +0.5% +10.4%
bs=1000 sw=10 sl=64 p99 1,012,467 us 1,007,419 us 947,186 us +0.5% +6.9%
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,469.78,200,128000,426,0.260,22836.89,28209.62,28209.62
1,100,10,64,20,2215.32,2000,1280000,903,0.551,107795.51,150387.80,150387.80
2,1000,10,64,20,18300.05,20000,12800000,1093,0.667,912413.03,1012467.41,1012467.41

@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

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 7 out of 7 changed files in this pull request and generated 1 comment.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Signed-off-by: Xinyuan Lin <[email protected]>
@aglinxinyuan
aglinxinyuan enabled auto-merge August 29, 2026 06:54
The Copilot Autofix commit that anchored the `pytest.raises(match=...)`
regex with `^`/`$` also flattened the five rewritten lines to column 0,
leaving `test_an_unsupported_tablelike_is_rejected` with an empty body.
`ruff check` rejected the file as invalid syntax, failing pyamber on all
three interpreters.

Re-indent the block back into the method. The `^`/`$` anchors from the
autofix are kept -- `match=` uses `re.search`, so the unanchored escape
only pinned a substring, which is exactly what the comment above it says
it must not do.
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Aug 29, 2026
Merged via the queue into apache:main with commit 5e6d925 Aug 29, 2026
23 checks passed
@aglinxinyuan
aglinxinyuan deleted the cov/pyamber-models-and-proxy branch August 29, 2026 07:30
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)
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 seven small pyamber gaps

4 participants