Skip to content

fix(amber, frontend): serve created datasets to the admin quota modal - #7318

Merged
xuang7 merged 4 commits into
apache:mainfrom
aglinxinyuan:fix/admin-quota-created-datasets
Aug 5, 2026
Merged

fix(amber, frontend): serve created datasets to the admin quota modal#7318
xuang7 merged 4 commits into
apache:mainfrom
aglinxinyuan:fix/admin-quota-created-datasets

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

The admin user-quota modal (UserQuotaComponent opened from the admin user list) fails to load its "created datasets" panel: the request 404s.

Root cause: AdminUserService.getCreatedDatasets() targets /admin/user/created_datasets, but AdminUserResource never exposed that endpoint. The only created_datasets endpoint lives on UserQuotaResource (/quota/created_datasets), and it derives the uid from the authenticated session (@Auth current_user) with no user_id parameter — so it cannot serve "datasets of the user an admin is inspecting" (it would return the admin's own datasets instead).

Before After
Frontend request GET /admin/user/created_datasets (no params) GET /admin/user/created_datasets?user_id=<uid>
Backend no such route → 404 AdminUserResource.getCreatedDatasets(user_id) → datasets owned by user_id
admin quota modal ──> AdminUserService.getCreatedDatasets(uid)
                          │  before: GET /admin/user/created_datasets            ──> 404 (route missing)
                          │  after:  GET /admin/user/created_datasets?user_id=N  ──> AdminUserResource
                          │                                                            └─> DatasetStatisticsUtils.getUserCreatedDatasets(N)

Changes:

  • AdminUserResource.scala: add GET /admin/user/created_datasets?user_id=N (ADMIN-only, like the sibling created_workflows / access_workflows / user_quota_size endpoints), delegating to DatasetStatisticsUtils.getUserCreatedDatasets.
  • admin-user.service.ts: getCreatedDatasets(uid) now sends the uid as the user_id query param (it previously accepted the uid and silently dropped it).

Any related issues, documentation, discussions?

Closes #7317

How was this PR tested?

Written test-first (both new tests were confirmed failing before the fix):

  • AdminUserResourceSpec: two new tests for getCreatedDatasets — empty list for a user with no datasets, and only the queried user's datasets are returned (a second user's dataset is excluded).
  • admin-user.service.spec.ts: the getCreatedDatasets test now asserts the user_id query param is sent (previously asserted no params were sent).

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

Generated-by: Claude Code (Opus 5)

The admin user-quota modal requested /admin/user/created_datasets, but
AdminUserResource never exposed that route, so the created-datasets panel
404'd. The only created_datasets endpoint lives on UserQuotaResource under
/quota and derives the uid from the session, so it cannot serve the datasets
of the user an admin is inspecting.

Add the ADMIN-only endpoint alongside the sibling created_workflows route,
and send the uid that AdminUserService.getCreatedDatasets already accepted
but dropped.

Closes apache#7317
Copilot AI lite review requested due to automatic review settings August 5, 2026 00:31
@github-actions github-actions Bot added engine fix frontend Changes related to the frontend GUI labels Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

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

@Yicong-Huang Yicong-Huang added the release/v1.2 back porting to release/v1.2 label Aug 5, 2026
@github-actions
github-actions Bot requested a review from xuang7 August 5, 2026 00:31
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. release/* labels drive the post-merge backport, so add or remove one to change where this fix lands.

Release branch Analysis
release/v1.2 Change detected on this branch — label added; this fix is queued to backport here. Requested review from @xuang7.

Auto-label run.

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.

🟡 Not ready to approve

The new backend endpoint should validate missing/invalid user_id and return a clear 400 instead of silently proceeding with a null query parameter.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR fixes the admin user-quota modal’s “created datasets” panel by aligning the frontend request with a newly added backend admin endpoint that can query datasets for an inspected user (by user_id), instead of relying on a session-derived user.

Changes:

  • Added GET /admin/user/created_datasets?user_id=<uid> to AdminUserResource (ADMIN-only) backed by DatasetStatisticsUtils.getUserCreatedDatasets.
  • Updated AdminUserService.getCreatedDatasets(uid) to actually send user_id as a query parameter.
  • Added/updated backend and frontend tests to cover the new endpoint wiring and request shape.
File summaries
File Description
frontend/src/app/dashboard/service/admin/user/admin-user.service.ts Sends user_id query param when fetching created datasets for an inspected user.
frontend/src/app/dashboard/service/admin/user/admin-user.service.spec.ts Updates unit test to assert user_id is included in the request.
amber/src/main/scala/org/apache/texera/web/resource/dashboard/admin/user/AdminUserResource.scala Adds the missing admin route for created_datasets with user_id query support.
amber/src/test/scala/org/apache/texera/web/resource/dashboard/admin/user/AdminUserResourceSpec.scala Adds regression tests ensuring datasets returned are scoped to the requested user.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main 86865f3 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 348 0.212 28,344/38,641/38,641 us 🔴 +15.5% / 🔴 +148.7%
bs=100 sw=10 sl=64 786 0.479 124,303/153,246/153,246 us ⚪ within ±5% / 🔴 +40.5%
bs=1000 sw=10 sl=64 901 0.55 1,098,413/1,238,504/1,238,504 us ⚪ within ±5% / 🔴 +19.2%
Baseline details

Latest main 86865f3 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 348 tuples/sec 384 tuples/sec 767.32 tuples/sec -9.4% -54.6%
bs=10 sw=10 sl=64 MB/s 0.212 MB/s 0.234 MB/s 0.468 MB/s -9.4% -54.7%
bs=10 sw=10 sl=64 p50 28,344 us 26,423 us 12,772 us +7.3% +121.9%
bs=10 sw=10 sl=64 p95 38,641 us 33,446 us 15,538 us +15.5% +148.7%
bs=10 sw=10 sl=64 p99 38,641 us 33,446 us 18,948 us +15.5% +103.9%
bs=100 sw=10 sl=64 throughput 786 tuples/sec 821 tuples/sec 972.51 tuples/sec -4.3% -19.2%
bs=100 sw=10 sl=64 MB/s 0.479 MB/s 0.501 MB/s 0.594 MB/s -4.4% -19.3%
bs=100 sw=10 sl=64 p50 124,303 us 120,444 us 103,020 us +3.2% +20.7%
bs=100 sw=10 sl=64 p95 153,246 us 155,382 us 109,070 us -1.4% +40.5%
bs=100 sw=10 sl=64 p99 153,246 us 155,382 us 118,964 us -1.4% +28.8%
bs=1000 sw=10 sl=64 throughput 901 tuples/sec 907 tuples/sec 1,005 tuples/sec -0.7% -10.3%
bs=1000 sw=10 sl=64 MB/s 0.55 MB/s 0.553 MB/s 0.613 MB/s -0.5% -10.3%
bs=1000 sw=10 sl=64 p50 1,098,413 us 1,102,079 us 1,002,400 us -0.3% +9.6%
bs=1000 sw=10 sl=64 p95 1,238,504 us 1,211,598 us 1,039,228 us +2.2% +19.2%
bs=1000 sw=10 sl=64 p99 1,238,504 us 1,211,598 us 1,069,081 us +2.2% +15.8%
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,575.20,200,128000,348,0.212,28344.26,38641.34,38641.34
1,100,10,64,20,2546.08,2000,1280000,786,0.479,124302.53,153246.03,153246.03
2,1000,10,64,20,22187.64,20000,12800000,901,0.550,1098412.80,1238503.98,1238503.98

@codecov-commenter

codecov-commenter commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.35%. Comparing base (86865f3) to head (3d0383d).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7318      +/-   ##
============================================
- Coverage     83.37%   83.35%   -0.03%     
+ Complexity     4129     4128       -1     
============================================
  Files          1166     1166              
  Lines         46424    46404      -20     
  Branches       5174     5171       -3     
============================================
- Hits          38707    38681      -26     
- Misses         6000     6003       +3     
- Partials       1717     1720       +3     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 9fe36ee
agent-service 83.65% <ø> (ø) Carriedforward from 9fe36ee
amber 80.67% <100.00%> (-0.02%) ⬇️
computing-unit-managing-service 43.46% <ø> (-0.15%) ⬇️ Carriedforward from 9fe36ee
config-service 65.97% <ø> (ø) Carriedforward from 9fe36ee
file-service 67.61% <ø> (-1.45%) ⬇️ Carriedforward from 9fe36ee
frontend 84.02% <100.00%> (-0.01%) ⬇️
notebook-migration-service 78.89% <ø> (ø) Carriedforward from 9fe36ee
pyamber 97.32% <ø> (-0.05%) ⬇️ Carriedforward from 9fe36ee
workflow-compiling-service 26.31% <ø> (ø) Carriedforward from 9fe36ee

*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.

aglinxinyuan and others added 3 commits August 4, 2026 17:50
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Xinyuan Lin <xinyual3@uci.edu>
The auto-committed guard was indented at column 0, which failed
scalafmtCheckAll and stopped the amber job before any test ran.

Reindent it, and raise BadRequestException("user_id is required") to match
the existing admin-only FeedbackResource.listUserFeedback guard rather than
a bare WebApplicationException. Cover the 400 path in the spec.

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

@xuang7
xuang7 added this pull request to the merge queue Aug 5, 2026
Merged via the queue into apache:main with commit 0f2cd49 Aug 5, 2026
24 checks passed
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Backport PR opened: draft #7328 (#7328) to release/v1.2, assigned to @aglinxinyuan — needs manual work because the cherry-pick conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine fix frontend Changes related to the frontend GUI release/v1.2 back porting to release/v1.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Admin user-quota modal cannot load a user's created datasets

5 participants