Skip to content

Return available_fields in patron blocking rule validation response (PP-3866)#3179

Merged
dbernstein merged 2 commits intomainfrom
feature/PP-3866-patron-blocking-rules-guidance
Apr 6, 2026
Merged

Return available_fields in patron blocking rule validation response (PP-3866)#3179
dbernstein merged 2 commits intomainfrom
feature/PP-3866-patron-blocking-rules-guidance

Conversation

@dbernstein
Copy link
Copy Markdown
Contributor

Description

Returns the live patron data dictionary from the patron blocking rule
validation endpoint, and removes SIP-specific language from the
allowed-functions documentation. These changes are made in conjunction with
circulation-admin changes here.

  • process_validate_patron_blocking_rule now returns a JSON body
    {"available_fields": live_values} on a successful 200 response,
    in addition to the existing error behaviour on 4xx. Previously the
    body was empty.
  • docs/FUNCTIONS.md — replaced all references to "SIP2" and "SIP2
    server" with the protocol-agnostic "remote patron information call",
    since patron blocking rules are not exclusively a SIP2 feature.

Motivation and Context

The circulation-admin help modal (PP-3866) needs the live patron data
dictionary to display available template variable names and sample
values to administrators building blocking rules. Previously the
validation endpoint discarded this data after evaluating the rule
expression. Exposing it in the response body requires no additional
server round-trip.

The documentation update ensures that FUNCTIONS.md — which is
surfaced directly in the admin UI — does not mislead administrators
using non-SIP authentication providers that also support patron
blocking rules.

How Has This Been Tested?

  • Confirmed via the running dev server that the validation endpoint
    returns the expected available_fields dictionary for a configured
    SIP2 service with test credentials.
  • Existing controller and integration tests continue to pass (tox -e py312-docker -- --no-cov).
  • These changes have been integration tested in my local environment
    with the related changes in circulation-admin

Checklist

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

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.27%. Comparing base (ed0f781) to head (9a840c4).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3179      +/-   ##
==========================================
- Coverage   93.28%   93.27%   -0.01%     
==========================================
  Files         496      496              
  Lines       46011    46012       +1     
  Branches     6302     6302              
==========================================
- Hits        42920    42919       -1     
- Misses       2004     2005       +1     
- Partials     1087     1088       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbernstein dbernstein force-pushed the feature/PP-3866-patron-blocking-rules-guidance branch from 5424590 to fbb71fe Compare April 6, 2026 17:11
@dbernstein dbernstein requested a review from a team April 6, 2026 17:11
Copy link
Copy Markdown
Member

@jonathangreen jonathangreen left a comment

Choose a reason for hiding this comment

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

Looks good, one minor comment.


return Response(status=200)
return Response(
json.dumps({"available_fields": live_values}),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor: since you are changing the response shape, you should probably assert that available_fields is returned in the tests as well.

…P-3866)

Changes the 200 response from process_validate_patron_blocking_rule to
include the live patron data dictionary as {"available_fields": ...},
enabling the admin UI to display template variable names and sample
values in the help modal without an additional round-trip. Also removes
SIP-specific language from docs/FUNCTIONS.md in favour of the
protocol-agnostic "remote patron information call".
@dbernstein dbernstein force-pushed the feature/PP-3866-patron-blocking-rules-guidance branch from fbb71fe to 9a840c4 Compare April 6, 2026 19:11
@dbernstein dbernstein enabled auto-merge (squash) April 6, 2026 19:13
@dbernstein dbernstein merged commit 6b61f3b into main Apr 6, 2026
20 checks passed
@dbernstein dbernstein deleted the feature/PP-3866-patron-blocking-rules-guidance branch April 6, 2026 19:21
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