You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "aglinxinyuan (via GitHub)" <gi...@apache.org> on 2026/08/01 08:16:50 UTC

[PR] test(amber): add HubResourceSpec covering the hub action and count APIs [texera]

aglinxinyuan opened a new pull request, #7239:
URL: https://github.com/apache/texera/pull/7239

   ### What changes were proposed in this PR?
   
   `HubResource` was the largest untested class in the repo — **166 lines, 0% covered** — while its three siblings in the same package were already done:
   
   | Class | Coverage |
   |---|---|
   | `ActionType` | 100% |
   | `EntityType` | 100% |
   | `EntityTables` | 92.3% |
   | `HubResource` | **0%** |
   
   The three existing hub specs are pure in-memory tests of dispatch and Jackson round-trips; none touches `HubResource`, so there is no overlap.
   
   It is worth real tests rather than a coverage pass. It is not bulk jOOQ CRUD but ~14 methods of dispatch, validation and aggregation that happen to persist through jOOQ. 41 tests against `MockTexeraDB` (in-JVM embedded Postgres, per-suite database, no Docker) cover:
   
   - per-entity-type table dispatch for likes, clones and view counts — including that workflow and dataset counts stay apart when their ids collide
   - the IPv4 guard on the audited remote address
   - like/unlike idempotence against the `(uid, wid)` primary key
   - clone auditing: every attempt is audited, but only one clone row per user survives
   - the view-count backfill, **and** its suppression when `view` is not among the requested actions
   - `getTops` ranking, its public-only filter, and its limit fallback
   - the batch `getCounts` request-validation guards
   - `userAccess` de-duplication and per-entity access-table routing
   
   **Assertion strength was measured, not claimed.** 23 mutations of `HubResource` across three batches; every predicted red was observed and there were no collateral failures. A sample:
   
   | Mutation | Result |
   |---|---|
   | `ipv4Pattern.matches()` → `userIp != null` | red — ip column no longer left null for `::1` |
   | `if (isLike && !alreadyLiked)` → `if (isLike)` | red — duplicate-key violation |
   | `getTops orderBy(count.desc())` → `asc()` | red — wrong two workflows returned |
   | `getCounts` view-backfill made unconditional | red — proves the absence assertion is not vacuous |
   | `userAccess` dataset branch → workflow tables | red — grantees crossed between entities |
   | `recordUserAction` resource type hard-coded | red — equal ids no longer kept apart |
   
   Two empty-input tests are explicitly commented as pinning the contract (empty in, empty out) rather than the early-return branch, because jOOQ renders an empty `IN` list as a false predicate and the query returns empty with or without the guard. Flagging that rather than letting the test name overclaim.
   
   One production oddity surfaced and is documented in the spec rather than pinned: `WorkflowResource`'s `isOwner` uses `workflowRecord.into(WORKFLOW_OF_USER).getUid.eq(uid)` — Scala's `AnyRef.eq`, i.e. reference comparison on boxed `Integer`s, which is only reliable inside the −128..127 `Integer` cache. Demonstrated by experiment: with uids 71001/71002 two `isOwner shouldBe true` assertions fail while `ownerId` compares equal one line earlier; with uids 101/102 they pass. The spec asserts only the negatives, which survive a value-equality fix.
   
   No production file is touched.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7236
   
   ### How was this PR tested?
   
   41 new tests. Run with the three pre-existing hub specs to confirm no interference — 83 tests, Java 17:
   
   ```
   sbt "WorkflowExecutionService/testOnly org.apache.texera.web.resource.dashboard.hub.*Spec"
   ```
   
   ```
   [info] Suites: completed 4, aborted 0
   [info] Tests: succeeded 83, failed 0, canceled 0, ignored 0, pending 0
   [info] All tests passed.
   ```
   
   `Test/scalafmtCheck` and `Test/scalafix --check` both `[success]`.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(amber): add HubResourceSpec covering the hub action and count APIs [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan commented on PR #7239:
URL: https://github.com/apache/texera/pull/7239#issuecomment-5150875274

   Done — rebased onto main and reworked as a fold in 454c93fbeb. The file is no longer re-added; #7230's spec is the base and its 11 tests are untouched.
   
   The load-bearing number is `git diff --numstat`: **656 insertions, 0 deletions**. Every line of the merged file — imports, the `ownerUid`/`likerUid`/`wid`/`Wf` constants, `req`/`session`/`makeUser`/`ids`/`types`/`actions`/`likeRows`/`cloneRows`/`userActionRows`/`isLiked`, the `beforeAll` seed, the four `beforeEach` deletes and all 11 test bodies — is byte-identical to `origin/main`. New cases attach to the existing subject groups with `it should ...`, so no subject string is duplicated.
   
   All six areas you named are folded in, plus the rest that was additive:
   
   | Area | Cases |
   |---|---|
   | `recordUserAction` | IPv4 guard; per-entity-type tagging so equal ids stay apart |
   | per-entity table dispatch | likes, view counts and access routed by entity type, incl. a workflow and dataset sharing id `830001` |
   | `getCounts` | validation guards; default vs filtered action sets; zero-view backfill **and** its suppression when `view` isn't requested; absent clone table; one response per pair |
   | `getTops` | ranking; limit + fallback; public-only filter; clone bucket; unsupported action types |
   | `userAccess` | per-entity access tables; empty grantee list; de-duplication |
   | plus | `recordLikeAction` audit trail, `isLikedHelper`, `getCount` dataset-vs-workflow, `postView` auditing, `fetchDashboardWorkflowsByWids` hydration |
   
   **Six of my original cases were dropped as restatements of yours** — the like insert/remove pair, the already-liked false, the clone row+action, the postLike/postUnlike toggle, and the first-view running total. Where one of those carried a unique assertion (e.g. that a *rejected* duplicate like writes no audit row) I folded that assertion into a kept test rather than keeping the duplicate test.
   
   Two fixture changes, both additive:
   - `beforeEach` gains three deletes (`USER_ACTION` where `resource_id != wid`, `WORKFLOW` where `wid != 7001`, and `DATASET`) so the new seeds can't leak between tests. Your four deletes are unchanged, and wid 7001 plus its ownership/access rows are spared, so `getCount should count the public workflows` still sees exactly 1. Checked against `texera_ddl.sql` that the parent deletes cascade to the likes/clones/view-count/access children; `user_action` has no FK, hence its own delete.
   - `beforeAll` gains one user, uid 9003. Genuinely needed: likes are PK `(uid, wid)`, so a strict 3 > 2 > 1 ranking is impossible with two users, and the `userAccess` dispatch case needs disjoint grantee sets.
   
   Re-verified after the fold — 89 tests across the four hub specs, `scalafmtCheck` and `scalafix --check` clean. I also re-ran the mutation check against the folded file: neutering the IPv4 guard, changing the `getTops` limit fallback `8 → 4`, and dropping `.distinct` in `userAccess` each turned **exactly** the expected test red and nothing else (44 passed / 3 failed). All three reverted; the production diff is empty.
   
   One thing worth flagging since your fixture uids feed into it: `fetchDashboardWorkflowsByWids` reports `isOwner` via `workflowRecord.into(WORKFLOW_OF_USER).getUid.eq(uid)` (`WorkflowResource.scala:252`) — that's Scala's `AnyRef.eq`, i.e. reference comparison on boxed `Integer`s, so it's only reliable inside the −128..127 `Integer` cache. With uids in the 9001–9003 range the real owner reports `isOwner == false`. I've asserted only the two negatives (different uid, null uid), which survive a value-equality fix, and left a comment saying why there's no positive assertion. Happy to open a separate issue for it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(amber): add HubResourceSpec covering the hub action and count APIs [texera]

Posted by "mengw15 (via GitHub)" <gi...@apache.org>.
mengw15 merged PR #7239:
URL: https://github.com/apache/texera/pull/7239


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(amber): add HubResourceSpec covering the hub action and count APIs [texera]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #7239:
URL: https://github.com/apache/texera/pull/7239#issuecomment-5150616790

   ## [Codecov](https://app.codecov.io/gh/apache/texera/pull/7239?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 81.49%. Comparing base ([`18ebb0d`](https://app.codecov.io/gh/apache/texera/commit/18ebb0d1e6dded6f8bc04b7c52be4fa31cb27916?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`385f485`](https://app.codecov.io/gh/apache/texera/commit/385f4855eedb7f388bea08d462d8ae4a8e1cd527?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 4 commits behind head on main.
   :white_check_mark: All tests successful. No failed tests found.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##               main    #7239      +/-   ##
   ============================================
   + Coverage     81.04%   81.49%   +0.44%     
   - Complexity     3968     4005      +37     
   ============================================
     Files          1162     1162              
     Lines         46259    46259              
     Branches       5153     5153              
   ============================================
   + Hits          37490    37697     +207     
   + Misses         7096     6875     -221     
   - Partials       1673     1687      +14     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/texera/pull/7239/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | *Carryforward flag |
   |---|---|---|---|
   | [access-control-service](https://app.codecov.io/gh/apache/texera/pull/7239/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.00% <ø> (ø)` | | Carriedforward from [18ebb0d](https://app.codecov.io/gh/apache/texera/commit/18ebb0d1e6dded6f8bc04b7c52be4fa31cb27916?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [agent-service](https://app.codecov.io/gh/apache/texera/pull/7239/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.49% <ø> (ø)` | | Carriedforward from [18ebb0d](https://app.codecov.io/gh/apache/texera/commit/18ebb0d1e6dded6f8bc04b7c52be4fa31cb27916?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [amber](https://app.codecov.io/gh/apache/texera/pull/7239/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `77.88% <ø> (+1.21%)` | :arrow_up: | |
   | [computing-unit-managing-service](https://app.codecov.io/gh/apache/texera/pull/7239/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `20.49% <ø> (ø)` | | Carriedforward from [18ebb0d](https://app.codecov.io/gh/apache/texera/commit/18ebb0d1e6dded6f8bc04b7c52be4fa31cb27916?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [config-service](https://app.codecov.io/gh/apache/texera/pull/7239/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.97% <ø> (ø)` | | Carriedforward from [18ebb0d](https://app.codecov.io/gh/apache/texera/commit/18ebb0d1e6dded6f8bc04b7c52be4fa31cb27916?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [file-service](https://app.codecov.io/gh/apache/texera/pull/7239/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `66.80% <ø> (ø)` | | Carriedforward from [18ebb0d](https://app.codecov.io/gh/apache/texera/commit/18ebb0d1e6dded6f8bc04b7c52be4fa31cb27916?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [frontend](https://app.codecov.io/gh/apache/texera/pull/7239/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `83.22% <ø> (ø)` | | Carriedforward from [18ebb0d](https://app.codecov.io/gh/apache/texera/commit/18ebb0d1e6dded6f8bc04b7c52be4fa31cb27916?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [notebook-migration-service](https://app.codecov.io/gh/apache/texera/pull/7239/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.89% <ø> (ø)` | | Carriedforward from [18ebb0d](https://app.codecov.io/gh/apache/texera/commit/18ebb0d1e6dded6f8bc04b7c52be4fa31cb27916?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pyamber](https://app.codecov.io/gh/apache/texera/pull/7239/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `97.36% <ø> (ø)` | | Carriedforward from [18ebb0d](https://app.codecov.io/gh/apache/texera/commit/18ebb0d1e6dded6f8bc04b7c52be4fa31cb27916?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [workflow-compiling-service](https://app.codecov.io/gh/apache/texera/pull/7239/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `26.31% <ø> (ø)` | | Carriedforward from [18ebb0d](https://app.codecov.io/gh/apache/texera/commit/18ebb0d1e6dded6f8bc04b7c52be4fa31cb27916?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   *This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/texera/pull/7239?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(amber): add HubResourceSpec covering the hub action and count APIs [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7239:
URL: https://github.com/apache/texera/pull/7239#issuecomment-5150601528

   <!-- texera-benchmarks-comment -->
   ## ✅ No material benchmark regressions detected
   
   🟢 4 better · 🔴 0 worse · ⚪ 11 noise (<±5%) · 0 without baseline
   
   > Compared against main `19a35b7` 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](https://apache.github.io/texera/dev/bench/) · [Run](https://github.com/apache/texera/actions/runs/30691452658)
   
   | | config | throughput | MB/s | latency | max Δ latest / 7d |
   |---|---|---:|---:|---:|---:|
   | 🟢 | bs=10 sw=10 sl=64 | 418 | 0.255 | 22,739/31,597/31,597 us | 🟢 -8.2% / 🔴 +95.1% |
   | 🟢 | bs=100 sw=10 sl=64 | 890 | 0.543 | 108,797/134,348/134,348 us | 🟢 -10.9% / 🔴 +21.3% |
   | ⚪ | bs=1000 sw=10 sl=64 | 1,107 | 0.676 | 904,645/951,494/951,494 us | ⚪ within ±5% / 🟢 -12.1% |
   
   <details><summary>Baseline details</summary>
   
   Latest main `19a35b7` from same runner
   
   | config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
   |---|---|---:|---:|---:|---:|---:|
   | bs=10 sw=10 sl=64 | throughput | 418 tuples/sec | 415 tuples/sec | 765.25 tuples/sec | +0.7% | -45.4% |
   | bs=10 sw=10 sl=64 | MB/s | 0.255 MB/s | 0.253 MB/s | 0.467 MB/s | +0.8% | -45.4% |
   | bs=10 sw=10 sl=64 | p50 | 22,739 us | 23,265 us | 12,703 us | -2.3% | +79.0% |
   | bs=10 sw=10 sl=64 | p95 | 31,597 us | 34,407 us | 16,199 us | -8.2% | +95.1% |
   | bs=10 sw=10 sl=64 | p99 | 31,597 us | 34,407 us | 19,557 us | -8.2% | +61.6% |
   | bs=100 sw=10 sl=64 | throughput | 890 tuples/sec | 908 tuples/sec | 965.22 tuples/sec | -2.0% | -7.8% |
   | bs=100 sw=10 sl=64 | MB/s | 0.543 MB/s | 0.554 MB/s | 0.589 MB/s | -2.0% | -7.8% |
   | bs=100 sw=10 sl=64 | p50 | 108,797 us | 105,928 us | 103,830 us | +2.7% | +4.8% |
   | bs=100 sw=10 sl=64 | p95 | 134,348 us | 150,703 us | 110,778 us | -10.9% | +21.3% |
   | bs=100 sw=10 sl=64 | p99 | 134,348 us | 150,703 us | 118,713 us | -10.9% | +13.2% |
   | bs=1000 sw=10 sl=64 | throughput | 1,107 tuples/sec | 1,091 tuples/sec | 992.33 tuples/sec | +1.5% | +11.6% |
   | bs=1000 sw=10 sl=64 | MB/s | 0.676 MB/s | 0.666 MB/s | 0.606 MB/s | +1.5% | +11.6% |
   | bs=1000 sw=10 sl=64 | p50 | 904,645 us | 923,906 us | 1,016,959 us | -2.1% | -11.0% |
   | bs=1000 sw=10 sl=64 | p95 | 951,494 us | 952,426 us | 1,062,501 us | -0.1% | -10.4% |
   | bs=1000 sw=10 sl=64 | p99 | 951,494 us | 952,426 us | 1,082,611 us | -0.1% | -12.1% |
   
   </details>
   
   <details><summary>Raw CSV</summary>
   
   ```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,478.24,200,128000,418,0.255,22738.62,31596.71,31596.71
   1,100,10,64,20,2246.64,2000,1280000,890,0.543,108796.81,134348.28,134348.28
   2,1000,10,64,20,18062.80,20000,12800000,1107,0.676,904645.29,951493.67,951493.67
   ```
   
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] test(amber): add HubResourceSpec covering the hub action and count APIs [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7239:
URL: https://github.com/apache/texera/pull/7239#issuecomment-5150583085

   <!-- texera-reviewer-suggestion -->
   ### Automated Reviewer Suggestions
   
   Based on the `git blame` history of the changed files, we recommend the following reviewers:
   
   - No candidates found from `git blame` history.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org