fix(database): env var for db_name is NAME not DB_NAME#27
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
|
81f23e7 to
24a7320
Compare
|
Claude finished @olivermeyer's task in 2m 19s —— View job Code Review Complete
SummaryThis PR refactors the Status: Blocking Issues1. 🔴 Breaking Change Not Properly MarkedLocation: Commit message and PR description Why it's breaking: Users currently setting Required fixes:
Impact: Without proper marking, this won't trigger a major version bump (semantic versioning). Users may encounter silent failures when their env vars are ignored. 2. 🟡 No Backward CompatibilityLocation: Current behavior: Old env var silently ignored (Pydantic won't read it). Suggested improvement (optional, but recommended for smoother migration): from pydantic import Field, field_validator
import warnings
class DatabaseSettings(OpaqueSettings):
# ... other fields ...
name: str | None = Field(None, validation_alias="name")
@field_validator("name", mode="before")
@classmethod
def _warn_deprecated_db_name(cls, v: Any, info: ValidationInfo) -> Any:
"""Warn if DB_NAME env var is used (deprecated, use NAME)."""
# Check if db_name was provided in kwargs (old field name)
# This requires checking the raw environ
# (Implementation details depend on how you want to handle it)
return vAlternative: Accept this as a clean break (reasonable for a 0.x.x version) but document it clearly. Suggestions (Non-Blocking)3. 📝 AGENTS.md Table FormattingLocation: The diff shows: -| Module | Purpose | Description |
-|--------|---------|-------------|
+| Module | Purpose | Description |
+|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|Why it matters: Makes code review harder—the real changes ( Suggestion: Only update the content (the two instances of 4. 📚 Missing Migration DocumentationIssue: No upgrade guide for users. Suggested additions:
Positive Findings ✅
RecommendationBefore merge:
After addressing: This is a well-executed refactoring that improves the API. The change is valuable and the implementation is solid—it just needs proper breaking change marking and user migration guidance. |
Rename field `db_name` to `name` in `DatabaseSettings` so pydantic-settings
constructs the env var as `{PREFIX}NAME` (e.g. `MYAPP_DB_NAME`) instead of
the confusing double-prefix `{PREFIX}DB_NAME`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24a7320 to
8708900
Compare
|



Rename field
db_nametonameinDatabaseSettingsso pydantic-settings constructs the env var as{PREFIX}NAME(e.g.MYAPP_DB_NAME) instead of the confusing double-prefix{PREFIX}DB_NAME(MYAPP_DB_DB_NAME).