fix(config): remove duplicate dictionary keys and class fields from merge

Remove duplicate SETTING_METADATA entries (db_pool_size, db_max_overflow,
db_pool_timeout, db_pool_recycle, upload_rate_limit_per_user,
upload_rate_limit_window) that were introduced when merging origin/main.
Also remove duplicate Settings class field definitions in config.py.

Fixes ruff F601 (repeated dictionary key literal) errors.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-19 11:07:03 +00:00
parent 2941f6e177
commit d34b8bceb9
2 changed files with 5 additions and 109 deletions
+5 -44
View File
@@ -1133,43 +1133,18 @@ class Settings(BaseSettings):
), ),
) )
# Database Connection Pool Configuration # Per-user upload rate limiting (health-aware, Redis-backed sliding window)
# Controls SQLAlchemy QueuePool behaviour for PostgreSQL/MySQL.
# SQLite uses NullPool and ignores these settings.
db_pool_size: int = Field(
default=5,
description="Number of persistent connections kept in the pool. Ignored for SQLite.",
)
db_max_overflow: int = Field(
default=10,
description=("Maximum number of connections that can be opened beyond db_pool_size. Ignored for SQLite."),
)
db_pool_timeout: int = Field(
default=30,
description="Seconds to wait for a connection from the pool before raising an error. Ignored for SQLite.",
)
db_pool_recycle: int = Field(
default=1800,
description=(
"Seconds after which a connection is recycled to prevent stale connections. "
"Ignored for SQLite. Default: 1800 (30 minutes)."
),
)
# Per-user upload rate limiting (health-aware limiter)
# Controls how many uploads a single user may submit within a sliding window.
upload_rate_limit_per_user: int = Field( upload_rate_limit_per_user: int = Field(
default=20, default=20,
description=( description=(
"Maximum number of uploads allowed per user within the upload_rate_limit_window. " "Maximum number of file uploads allowed per user within the sliding window. "
"The limiter may dynamically reduce this value when Redis queue depth or CPU load is high." "The effective limit may be reduced dynamically when the system is under heavy load "
"(high queue depth or CPU usage). Set to 0 to disable per-user upload rate limiting."
), ),
) )
upload_rate_limit_window: int = Field( upload_rate_limit_window: int = Field(
default=60, default=60,
description=( description="Sliding window size in seconds for per-user upload rate limiting (default: 60).",
"Sliding window in seconds over which upload_rate_limit_per_user is enforced. Default: 60 seconds."
),
) )
# Rate Limiting Configuration (see SECURITY_AUDIT.md and docs/API.md) # Rate Limiting Configuration (see SECURITY_AUDIT.md and docs/API.md)
@@ -1191,20 +1166,6 @@ class Settings(BaseSettings):
description="Stricter rate limit for authentication endpoints to prevent brute force attacks.", description="Stricter rate limit for authentication endpoints to prevent brute force attacks.",
) )
# Per-user upload rate limiting (health-aware, Redis-backed sliding window)
upload_rate_limit_per_user: int = Field(
default=20,
description=(
"Maximum number of file uploads allowed per user within the sliding window. "
"The effective limit may be reduced dynamically when the system is under heavy load "
"(high queue depth or CPU usage). Set to 0 to disable per-user upload rate limiting."
),
)
upload_rate_limit_window: int = Field(
default=60,
description="Sliding window size in seconds for per-user upload rate limiting (default: 60).",
)
# CORS Configuration (see SECURITY_AUDIT.md Infrastructure Security section) # CORS Configuration (see SECURITY_AUDIT.md Infrastructure Security section)
# Disabled by default since most deployments use a reverse proxy (Traefik, Nginx, etc.) # Disabled by default since most deployments use a reverse proxy (Traefik, Nginx, etc.)
# that already adds CORS headers. Enable only if deploying without a reverse proxy or if # that already adds CORS headers. Enable only if deploying without a reverse proxy or if
-65
View File
@@ -2601,51 +2601,6 @@ SETTING_METADATA = {
"required": False, "required": False,
"restart_required": False, "restart_required": False,
}, },
# Database Connection Pool
"db_pool_size": {
"category": "Core",
"description": (
"Number of persistent connections kept in the SQLAlchemy QueuePool. "
"Has no effect for SQLite databases. Default: 5."
),
"type": "integer",
"sensitive": False,
"required": False,
"restart_required": True,
},
"db_max_overflow": {
"category": "Core",
"description": (
"Maximum extra connections that can be opened beyond db_pool_size. "
"Has no effect for SQLite databases. Default: 10."
),
"type": "integer",
"sensitive": False,
"required": False,
"restart_required": True,
},
"db_pool_timeout": {
"category": "Core",
"description": (
"Seconds to wait for a connection from the pool before raising an error. "
"Has no effect for SQLite databases. Default: 30."
),
"type": "integer",
"sensitive": False,
"required": False,
"restart_required": True,
},
"db_pool_recycle": {
"category": "Core",
"description": (
"Seconds after which idle connections are recycled to prevent stale connections. "
"Has no effect for SQLite databases. Default: 1800 (30 minutes)."
),
"type": "integer",
"sensitive": False,
"required": False,
"restart_required": True,
},
# Per-user upload rate limiting # Per-user upload rate limiting
"upload_rate_limit_per_user": { "upload_rate_limit_per_user": {
"category": "Security", "category": "Security",
@@ -2704,26 +2659,6 @@ SETTING_METADATA = {
"required": False, "required": False,
"restart_required": True, "restart_required": True,
}, },
"upload_rate_limit_per_user": {
"category": "Security",
"description": (
"Maximum number of file uploads allowed per user within the sliding window. "
"The effective limit may be reduced dynamically when the system is under heavy load. "
"Set to 0 to disable per-user upload rate limiting. Default: 20."
),
"type": "integer",
"sensitive": False,
"required": False,
"restart_required": False,
},
"upload_rate_limit_window": {
"category": "Security",
"description": ("Sliding window size in seconds for per-user upload rate limiting. Default: 60."),
"type": "integer",
"sensitive": False,
"required": False,
"restart_required": False,
},
# CORS # CORS
"cors_enabled": { "cors_enabled": {
"category": "Security", "category": "Security",