Configurable filter limit for anonymous users - #1374
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a configurable “filter value” limit for anonymous HTML requests to reduce crawler-driven load, with UI feedback when the limit is reached and a 400 error when it’s exceeded (while exempting API/JSON:API requests).
Changes:
- Enforces an anonymous-user facet/value limit in the shared searchable index concern and renders a 400 error when exceeded (HTML only).
- Updates search UI helpers/views/styles to show a warning and disable further filter application when the limit is reached.
- Adds i18n messaging, example configuration, and controller tests covering anonymous vs logged-in vs API behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test/controllers/materials_controller_test.rb | Adds coverage for warning + 400 behavior across anonymous/logged-in/API requests. |
| config/tess.example.yml | Documents the new filter_limit setting in the example config. |
| config/locales/en.yml | Adds the translated warning/error message for filter-limit enforcement. |
| app/views/search/common/_search_panel.html.erb | Displays an informational alert when the filter limit is reached. |
| app/views/search/common/_facet_sidebar_boolean_filter.html.erb | Disables boolean facet checkbox interaction when the limit is reached. |
| app/helpers/search_helper.rb | Prevents generating filter links when the limit is reached; adds filter_limit_reached?. |
| app/controllers/concerns/searchable_index.rb | Introduces a before_action to reject over-limit anonymous HTML requests. |
| app/assets/stylesheets/base/_facets.scss | Styles .nav-item > span to match existing facet link styling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…requests that use filters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Motivation and context
Crawlers were hammering production instances by trying every possibly permutation of filters.
Screenshots
Checklist