Skip to content

fix: gate DQ steward UI behind capability flags and skip blocked API … - #446

Merged
plakkara-bc merged 10 commits into
devfrom
fix/dq-skip-batch-fetch-on-load
Aug 9, 2026
Merged

fix: gate DQ steward UI behind capability flags and skip blocked API …#446
plakkara-bc merged 10 commits into
devfrom
fix/dq-skip-batch-fetch-on-load

Conversation

@mdiapenabc

@mdiapenabc mdiapenabc commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Description

DQ still triggered API calls on page load for batch and job endpoints that BlockDqStewardGuard denies (403). Tabs were hidden in the UI, but mount-time effects were not gated, causing errors on dev and unnecessary network traffic.

This PR introduces a frontend capability model aligned with BL and skips mount-time fetches, tabs, and actions that DQ stewards cannot use. Backend guards are unchanged , they remain the security boundary.

What changed

  • Added getCsaCapabilities() and useCsaCapabilities() as the single frontend source of truth for profile-gated features (batches, jobs, weekly files, contact management, DQ edit/delete)
  • Guarded mount-time effects in App.tsx so DQ stewards no longer call /batches, /jobs, or batch history on load
  • Gated tab navigation, job-run summary header, hold/review actions, and batch history panel behind named capabilities instead of scattered isDataQualitySteward checks
  • DQ row click fetches audit trail only (skips GET /contacts/:id/batches)
  • Updated canDqModifyRecord() to accept canEditContacts instead of a raw profile boolean
  • Added unit tests for the capability matrix

How to test

  • Log in on dev as a Data Quality Steward (RW + ICM Data Steward): Eligibility tab only, no console/network errors for /api/batches or /api/jobs on load
  • Confirm DQ can search/filter contacts, view details + audit trail, and edit/delete a single non-protected record
  • Log in as a standard CSA user: all tabs visible, batches/jobs load normally, hold/batch/eligibility actions work
  • Run npm test in frontend/: csa-capabilities and dq-contact tests pass

mdiapenabc and others added 10 commits August 8, 2026 16:03
…calls

Data Quality Stewards were hitting forbidden batch and jobs endpoints on page load. Add getCsaCapabilities/useCsaCapabilities as the single frontend source of truth and guard mount-time fetches, tabs, and actions accordingly.
Replace the monolithic App and capability flags with a thin router,
StandardCsaApp, DqEligibilityApp, and EligibilityListPage so DQ stewards
never mount batch/job effects and new CSA features stay profile-free.
This reverts commit 4b54fc8.
Defer eligibility tab reset in an effect and apply prettier formatting so
CI passes on the minimal DQ mount-guard fix.
Replace the eight-flag capability matrix with isStandardUser,
isDataQualitySteward, and canEditContactRecords so CSA stays the default
and DQ remains the explicit exception.
Keep profile booleans and readable feature flags (batches, jobs, contacts)
in one buildCapabilities() function so App.tsx documents intent at each
gate without maintaining duplicate role matrices.
Use CAPABILITY_PROFILES as the single source of truth, add
canAccessEligibilityList for both roles, rename caseworker actions to
canPerformCsaActions, and group Clear Filters with search/PDQ instead
of workflow buttons so DQ stewards can reset column filters.
@plakkara-bc
plakkara-bc merged commit 1d80605 into dev Aug 9, 2026
15 checks passed
@plakkara-bc
plakkara-bc deleted the fix/dq-skip-batch-fetch-on-load branch August 9, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants