Admin Portal: Column Sorting and Upload Center Activation Fixes (QA)
Executive summary
A backend update reaching the QA environment that promotes three Dev commits (incl. PR #161). It adds consistent column sorting across most Admin Portal list screens, lets admins activate or deactivate upload centers from the bulk-update endpoint, and fixes two data-integrity gaps in tenant reassignment and user metadata backfill.
Why this was needed
Several Admin Portal list screens (users, roles, rules, folders, document types, upload centers, notification policies and templates, upload tasks) accepted no reliable way to sort by column, so admins could not order data predictably. Separately, the upload-center bulk-update path could not toggle active/inactive status, sub-tenant reassignment did not persist the new parent to the database, and the user metadata backfill could crash on users with a missing tenant.
Client / user impact
Admins can now sort Admin Portal lists by columns such as name, status, created date, tenant, and related counts in either direction, making large datasets easier to navigate. Upload centers can be activated/deactivated in bulk (with a guard preventing duplicate active centers under the same tenant/name). Tenant reassignment now correctly saves the new parent relationship, and the user metadata backfill safely skips records without a tenant instead of failing.
Technical scope
- Added
sort_by/sort_order(asc/desc) query params with allowlisted, NULLS-last sort columns across admin list endpoints: users, roles, rules, folders, document types (+ with-columns), upload centers, upload tasks, notification policies, and notification templates. - Notification policies endpoint also gained a
searchfilter across id, tenant, event type, match mode, and delivery override. - Upload center update now accepts an
is_activeflag (UploadCenterUpdateRequestschema, admin + v1 routers,upload_center_service), with a duplicate-active-name guard before activation. - Tenant reassign (
admin_tenants.resolve_subtenants) now issues an explicitUPDATE/commit to persistparent_idfor direct sub-tenants. - User meta backfill (
_backfill_user_meta_impl) now skips and logs users whosetenant_idis null. - New unit tests added in
tests/unit/test_admin_unsolved_bug_regressions.pycovering all four fixes (+182 lines). - Batch promotes commits:
4dd011f3(grid regressions),df9d3015(upload center/policy gaps), and merge of PR #161.
Risk & mitigation
Low to moderate. Sort logic is restricted to allowlisted columns and falls back to a safe default (id or name) for unknown values, limiting injection or error risk. Main risks are in-memory sorting for list-then-paginate endpoints (policies, templates, document types) sorting only the current page slice in some flows, and the new tenant-reassign commit / upload-center activation paths touching write data. Mitigated by added unit tests; recommend verification on QA before promotion to production.
QA validation focus
- Sort each affected Admin list by multiple columns in both asc and desc order; confirm stable ordering and that pagination remains correct.
- Confirm invalid
sort_byvalues fall back to default ordering without error. - Bulk activate and deactivate upload centers; verify the duplicate-active-name guard blocks re-activating a center that collides with an existing active one under the same tenant.
- Reassign sub-tenants to a new parent and confirm
parent_idis persisted in the database after the operation. - Run/observe the user metadata backfill with at least one tenant-less user and confirm it skips that user and completes without crashing.
- Verify notification policy search returns expected matches across id, tenant, event type, match mode, and delivery override.