Skip to content

Add patron debug authentication UI (PP-3765)#198

Merged
jonathangreen merged 9 commits intomainfrom
feature/patron-debug-authentication
Feb 27, 2026
Merged

Add patron debug authentication UI (PP-3765)#198
jonathangreen merged 9 commits intomainfrom
feature/patron-debug-authentication

Conversation

@jonathangreen
Copy link
Member

@jonathangreen jonathangreen commented Feb 25, 2026

Description

Adds a "Debug Authentication" tab to the Manage Patrons page, allowing library managers and system admins to run diagnostic authentication checks against patron auth providers. The UI lets users select an authentication method, enter patron credentials, and view step-by-step results with pass/fail indicators. Supports multiple result detail formats including strings, numbers, booleans, lists, and key-value tables.

New files:

  • src/api/patronDebug.ts — API layer with types and fetch functions for auth methods and debug auth endpoints
  • src/components/DebugAuthentication.tsx — Main form component using React Query for data fetching and mutations
  • src/components/DebugResult.tsx — Renders individual debug result steps with collapsible detail panels
  • src/stylesheets/debug_authentication.scss — Styles for the debug UI, result list, and detail tables

Modified files:

  • src/components/ManagePatronsTabContainer.tsx — Adds the new tab alongside Reset Adobe ID; removes single-tab workaround
  • src/stylesheets/colors.scss — Extracts $green-muted variable for reuse

Motivation and Context

Frontend for the backend API added in ThePalaceProject/circulation#3076. Library admins need the ability to troubleshoot patron authentication issues directly from the admin interface rather than relying on server logs.

Ref: PP-3765

Screenshot 2026-02-25 at 5 23 00 PM

How Has This Been Tested?

  • Jest tests for DebugAuthentication (8 tests) and DebugResult (10 tests) using MSW and React Testing Library
  • Updated Mocha tests for ManagePatronsTabContainer to verify the new tab appears correctly
  • All new and existing tests pass

Checklist:

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

Add the frontend for the patron debug authentication admin tool,
allowing library managers to run diagnostic auth checks and view
step-by-step results from the admin interface.

- Add API functions for fetching auth methods and running debug
- Add DebugAuthentication component with auth method selector,
  credential form, and results display
- Add DebugResult component for rendering string, list, and dict
  detail types with success/failure styling
- Integrate as new tab in ManagePatronsTabContainer
- Add Jest tests for both components and update legacy mocha tests
- Remove redundant QueryClientProvider wrapper from DebugAuthentication,
  provide QueryClient in Mocha test setup instead
- Use explicit null check for password in API call
- Memoize authMethods fallback to avoid unnecessary effect runs
- Clear username/password on method or library change
- Extract hardcoded #809F69 into $green-muted SCSS variable
…ig tab styles

The broad ul:not() selector in config_tab_container.scss was overriding
the debug results list styling due to higher specificity. Adding
:not(.debug-results-list) follows the existing exclusion pattern.
@jonathangreen jonathangreen requested a review from a team February 25, 2026 21:22
Copy link
Contributor

@tdilauro tdilauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is well done and the new functionality is super helpful. I've approved it, but there are a couple of change requests and suggestions that I'd like to see updated before this goes in. The minor comments aren't show stoppers at all and you can feel free to skip them. I added them in for front end insight, since you've mentioned that that you find it helpful.

Obscure the password field by default instead of displaying it
as plain text.
Avoid DOM id collisions when multiple results share the same label
by deriving Panel ids from a sequence number instead of the label
text. The repeated id expression is DRYed into a single `detailId`
variable.
Rename the component to better reflect its DOM role (renders an <li>)
and restructure the file so the component definition comes first, with
renderDetails extracted as a standalone function taking explicit params.
Display an alert when the auth methods response is empty, so admins
can see why the debug form isn't available for a given library.
ResultDetails doesn't include undefined in its type union, so only
the null check is needed.
Remove unused AuthMethodInfo import, add JSDoc for the active prop,
disable browser autofill on patron credential inputs, and use a
template literal for URL construction.
@jonathangreen jonathangreen merged commit 3547f35 into main Feb 27, 2026
1 check passed
@jonathangreen jonathangreen deleted the feature/patron-debug-authentication branch February 27, 2026 14:48
jonathangreen added a commit that referenced this pull request Feb 27, 2026
## Description

Replaces the broad
`ul:not(.input-list-ul):not(.announcements-ul):not(.debug-results-list)`
selector in `config_tab_container.scss` with a positively scoped
`.list-container > ul` selector. Also removes the
`li:not(.panel):not(.announcement)` exclusions which should be
unnecessary once the `ul` is properly scoped.

## Motivation and Context

The previous approach required every new component rendering a `<ul>`
inside `.tab-content` to add itself to a growing `:not()` exclusion
list. This was the root cause of the `!important` overrides needed in
the debug authentication styles.

From what I can tell, the rule only ever targets the bare `<ul>`
rendered by `EditableConfigList` inside `.list-container` (line 168),
and no `<li>` elements inside that `<ul>` have `.panel` or
`.announcement` classes. But given the accumulated tech debt with all
the negative selectors, it's hard to be fully confident there isn't an
edge case I'm missing. Initial visual inspection of the config list
pages looks fine, but this could use extra eyes.

Stacked on #198.

## How Has This Been Tested?

- Production webpack build compiles successfully
- Spot-checked config list pages visually — styling appears unchanged
- Would appreciate additional visual review of Collections, Libraries,
Patron Auth Services, and other config list pages to confirm nothing
regressed

## Checklist:

- [x] I have updated the documentation accordingly.
- [x] All new and existing tests passed.
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