-
Notifications
You must be signed in to change notification settings - Fork 0
feat(meeting): finalize meeting management with live config broadcasts #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| repos: | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.8.0 | ||
| hooks: | ||
| - id: ruff | ||
| args: [--fix, --exit-non-zero-on-fix] | ||
| - id: ruff-format |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # FluentMeet Core Application Documentation | ||
|
|
||
| > **Package Location:** `/app/core` | ||
| > **Purpose:** Houses all fundamental components that are globally shared across the entire application ecosystem, strictly agnostic of specific application models. | ||
|
|
||
| --- | ||
|
|
||
| ## Table of Contents | ||
|
|
||
| - [Overview](#overview) | ||
| - [Configuration (`config.py`)](#configuration-configpy) | ||
| - [Security (`security.py`)](#security-securitypy) | ||
| - [Exception Handlers & Responses](#exception-handlers--responses) | ||
| - [System Dependencies (`dependencies.py`)](#system-dependencies-dependenciespy) | ||
| - [Sanitization (`sanitize.py`)](#sanitization-sanitizepy) | ||
|
|
||
| --- | ||
|
|
||
| ## Overview | ||
|
|
||
| The `app/core` package serves as the backbone of the application. It bootstraps application config configurations asynchronously, intercepts exceptions homogeneously, drives system security schemas securely, and houses FastApi `Depends()` routines globally to evade circular imports. | ||
|
|
||
| --- | ||
|
|
||
| ## Configuration (`config.py`) | ||
|
|
||
| Leverages `pydantic_settings`. | ||
|
|
||
| ### The `Settings` Object | ||
| * Extracts natively parameters stored inside `./.env` matching dynamically against types automatically parsing logic. | ||
| * Resolves variables for Database URls, JWT Secrets, Redis caches, Kafka bootstrap brokers explicitly, and cloud provider APIs like OpenAI / DL environments seamlessly. | ||
| * Forces dynamic fallback loading the PyProject version using `tomllib`. | ||
|
|
||
| --- | ||
|
|
||
| ## Security (`security.py`) | ||
|
|
||
| Handles cryptographic payload verification schemas explicitly without accessing Database constructs seamlessly. | ||
|
|
||
| * **Bcrypt Password Context:** `hash_password()` and `verify_password()`. | ||
| * Implements a native exception wrapper patching standard deprecated `passlib` behaviors failing aggressively on unmanaged `bcrypt 4.0.0+` versions transparently overriding bounds dynamically. | ||
| * **JWT Creation (`encode`):** | ||
| * `create_access_token()`: Returns a short-lived token using explicit TTL mappings native to configuration structures (expiring natively in ~60mins). | ||
| * `create_refresh_token()`: Returns a long-lived tuple returning the securely allocated JTI identifier logic explicitly mappings directly against settings (e.g., 7 days). | ||
|
|
||
| --- | ||
|
|
||
| ## Exception Handlers & Responses | ||
|
|
||
| ### Responses (`error_responses.py`) | ||
| Standardizes REST API outputs homogenously guaranteeing frontend UI frameworks never fail parsing generic trace responses gracefully. | ||
|
|
||
| * `ErrorDetail`: Nested lists explicitly tracking localized parameter validation triggers dynamically. | ||
| * `ErrorResponse`: Unifies status, descriptor `code`, human-readable `message` securely. | ||
|
|
||
| ### Handlers (`exception_handlers.py`) | ||
| Registered on core startup logic intercepting framework exceptions dynamically. | ||
|
|
||
| * Converts Starlette/FastAPI `RequestValidationError` cleanly into `400` validation constraints structures. | ||
| * Binds generic unhandled HTTP 500 stacks dynamically dumping details efficiently via `sanitize_for_log()`. | ||
|
|
||
| ### Custom Error Framework (`exceptions.py`) | ||
| Developers natively invoke `raise BadRequestException("Missing ID")` mapping gracefully dynamically down to HTTP structures utilizing the Handlers. Allows custom error codes defined seamlessly (e.g. `code="INVALID_OTP"` natively mapped). | ||
|
|
||
| --- | ||
|
|
||
| ## System Dependencies (`dependencies.py`) | ||
|
|
||
| Decouples authentication blocks natively allowing models mapping efficiently natively circumventing explicit Circular dependencies seamlessly. | ||
|
|
||
| Provides FastApi injectable logic defining explicit Token/Bearer evaluations transparently parsing JWT variables gracefully extracting explicit target entities locally from the Database dynamically checking `is_active` flags before propagating securely to Endpoint Routers automatically. | ||
|
|
||
| --- | ||
|
|
||
| ## Sanitization (`sanitize.py`) | ||
|
|
||
| Intercepts log mechanisms aggressively globally preventing explicit log-spoofing injection vectors smoothly intercepting inputs wrapping string payloads automatically truncating heavy lengths tracking string components securely natively tracking unmanaged inputs across routes dynamically. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| """Standardized API Error Response architectures module. | ||
|
|
||
| Defines Pydantic representations guaranteeing frontend API structures respond homogenously. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolve Ruff E501 failures in docstrings. Line 3 and Line 40 exceed the configured max length and currently break the code-quality pipeline. ✍️ Suggested line-length-safe wording-Defines Pydantic representations guaranteeing frontend API structures respond homogenously.
+Defines Pydantic models to keep API error responses consistent for clients.
@@
- JSONResponse: Standardized FastAPI JSON response strictly bound to ErrorResponse schema.
+ JSONResponse: Standardized FastAPI error response based on ErrorResponse.Also applies to: 40-40 🧰 Tools🪛 GitHub Actions: Code Quality[error] 3-3: ruff check reported E501 Line too long (91 > 88) at app/core/error_responses.py:3:89. 🤖 Prompt for AI Agents |
||
| """ | ||
|
|
||
| from typing import Any | ||
|
|
||
| from fastapi.responses import JSONResponse | ||
|
|
@@ -13,7 +18,7 @@ class ErrorResponse(BaseModel): | |
| status: str = "error" | ||
| code: str | ||
| message: str | ||
| details: list[ErrorDetail] = [] | ||
| details: list[Any] = [] | ||
|
|
||
|
|
||
| def create_error_response( | ||
|
|
@@ -22,20 +27,32 @@ def create_error_response( | |
| message: str, | ||
| details: list[dict[str, Any]] | None = None, | ||
| ) -> JSONResponse: | ||
| """ | ||
| Helper to create a standardized JSON error response. | ||
| """Helper to create a standardized JSON error response. | ||
|
|
||
| Args: | ||
| status_code (int): HTTP status code targeting fastAPI. | ||
| code (str): Application specific string error code identifier. | ||
| message (str): Human-readable exception descriptor. | ||
| details (list[dict[str, Any]] | None): Additional list of error dictionaries | ||
| defining problem fields. Defaults to None. | ||
|
|
||
| Returns: | ||
| JSONResponse: Standardized FastAPI JSON response strictly bound to ErrorResponse schema. | ||
| """ | ||
| error_details = [] | ||
| if details: | ||
| for detail in details: | ||
| error_details.append( | ||
| ErrorDetail( | ||
| field=detail.get("field"), | ||
| message=detail.get("msg") | ||
| or detail.get("message") | ||
| or "Unknown error", | ||
| if "msg" in detail and "field" in detail: | ||
| # Map FastApi Validation Errors explicitly | ||
| error_details.append( | ||
| { | ||
| "field": detail.get("field"), | ||
| "message": detail.get("msg") or "Validation error", | ||
| } | ||
| ) | ||
| ) | ||
| else: | ||
| # Preserve standard custom metadata cleanly | ||
| error_details.append(detail) | ||
|
|
||
| response_content = ErrorResponse( | ||
| status="error", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,23 @@ | ||
| """Application Base Exceptions module. | ||
|
|
||
| Defines the core `FluentMeetException` structure allowing handlers to easily map | ||
| application failures directly to standardized HTTP 400 and 500 entity wrappers natively. | ||
| """ | ||
|
|
||
| from typing import Any | ||
|
|
||
|
|
||
| class FluentMeetException(Exception): | ||
| """ | ||
| Base exception for all FluentMeet API errors. | ||
| """Base exception for all FluentMeet API errors. | ||
|
|
||
| Attributes: | ||
| status_code (int): Standard HTTP binding natively decoded by handlers. | ||
| code (str): Explicit mapped exception code array dynamically returned | ||
| to frontend structures. | ||
| message (str): Text definition descriptor structure readable | ||
| explicitly by users. | ||
| details (list[dict[str, Any]]): Internal mappings definition blocks | ||
| (useful for validation outputs). | ||
|
Comment on lines
+1
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting issues in docstrings are breaking CI (Line 15/17/19). There are trailing spaces on Lines 15, 17, and 19 ( Proposed cleanup """Application Base Exceptions module.
@@
Defines the core `FluentMeetException` structure allowing handlers to easily map
application failures directly to standardized HTTP 400 and 500 entity wrappers natively.
"""
@@
class FluentMeetException(Exception):
@@
Attributes:
status_code (int): Standard HTTP binding natively decoded by handlers.
- code (str): Explicit mapped exception code array dynamically returned
+ code (str): Explicit mapped exception code array dynamically returned
to frontend structures.
- message (str): Text definition descriptor structure readable
+ message (str): Text definition descriptor structure readable
explicitly by users.
- details (list[dict[str, Any]]): Internal mappings definition blocks
+ details (list[dict[str, Any]]): Internal mappings definition blocks
(useful for validation outputs).
"""🧰 Tools🪛 GitHub Actions: CI[error] 1-1: Black --check failed: file would be reformatted by Black. 🪛 GitHub Actions: Code Quality[warning] 15-15: ruff check reported W291 Trailing whitespace. Trailing whitespace at app/core/exceptions.py:15:78. [warning] 17-17: ruff check reported W291 Trailing whitespace. Trailing whitespace at app/core/exceptions.py:17:69. [warning] 19-19: ruff check reported W291 Trailing whitespace. Trailing whitespace at app/core/exceptions.py:19:76. 🤖 Prompt for AI Agents |
||
| """ | ||
|
|
||
| def __init__( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean trailing whitespace and reflow docstring lines to satisfy CI
Lines 43/45/133/135 include trailing whitespace, and this file is already failing Black/Ruff checks.
💡 Suggested cleanup
Also applies to: 133-136
🧰 Tools
🪛 GitHub Actions: Code Quality
[warning] 43-43: ruff check reported W291 Trailing whitespace. Trailing whitespace at app/core/dependencies.py:43:58.
[warning] 45-45: ruff check reported W291 Trailing whitespace. Trailing whitespace at app/core/dependencies.py:45:79.
🤖 Prompt for AI Agents