Skip to content

Enhance language handling and Turnstile middleware configuration#211

Merged
ewlarson merged 1 commit into
developfrom
feature/177-lang-facet
May 8, 2026
Merged

Enhance language handling and Turnstile middleware configuration#211
ewlarson merged 1 commit into
developfrom
feature/177-lang-facet

Conversation

@ewlarson
Copy link
Copy Markdown
Contributor

@ewlarson ewlarson commented May 8, 2026

Summary

  • Add b1g_language_sm handling across backend indexing/search, strong params, frontend metadata display, field labels, facets, and public schema docs.
  • Introduce a language normalization service so language display values are derived consistently from labels, codes, and mixed source formats.
  • Add TURNSTILE_ENABLE_LOCAL support and local-context bypass behavior so local development is smoother unless Turnstile is explicitly enabled.
  • Allow the API documentation shell, OpenAPI schema, ReDoc, OAuth redirect, and docs branding assets to bypass rate limiting while keeping interactive /api/v1 requests throttled.

Why

This improves language facet/display consistency for issue #177, makes local browser-gate behavior easier to control, and keeps the API docs reachable even when anonymous API quota has been exhausted.

Validation

  • python -m pytest backend/tests/middleware/test_rate_limit_middleware.py backend/tests/middleware/test_rate_limit_integration.py backend/tests/test_sanity.py -q
  • python -m ruff check backend/app/middleware/rate_limit_middleware.py backend/tests/middleware/test_rate_limit_middleware.py backend/tests/middleware/test_rate_limit_integration.py
  • python -m ruff format --check backend/app/middleware/rate_limit_middleware.py backend/tests/middleware/test_rate_limit_middleware.py backend/tests/middleware/test_rate_limit_integration.py

Fixes #177

- Added support for `b1g_language_sm` in various components and services, ensuring consistent language representation across the application.
- Introduced `TURNSTILE_ENABLE_LOCAL` environment variable to control local Turnstile behavior, allowing for easier development and testing.
- Updated middleware to bypass Turnstile checks for local development environments, improving the developer experience.
- Enhanced tests to verify the correct handling of language values and Turnstile configurations in local contexts.

These changes improve the flexibility of language handling and streamline local development processes.

Fixes #177
@ewlarson ewlarson marked this pull request as ready for review May 8, 2026 14:30
@ewlarson ewlarson merged commit e42fe25 into develop May 8, 2026
7 checks 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.

Support facet that has full text for Language codes

1 participant