feat: improve environment validation and startup safety (fixes #167) - #189
Open
get-D wants to merge 2 commits into
Open
feat: improve environment validation and startup safety (fixes #167)#189get-D wants to merge 2 commits into
get-D wants to merge 2 commits into
Conversation
- Refactored app.py to validate configuration before heavy imports. - Enhanced validator.py with better error messaging and .env existence checks. - Completed CONTRIBUTING.md styleguides and AI policy labeling. - Updated tests to match new validation logic and robustness. Generated-By: Antigravity
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.
Description
This PR resolves Issue #167 by improving how the application handles environment configuration during startup and by completing missing contribution guidelines.
Why this change?
Fail-fast startup (Fixes #167)
Previously, the application initialized heavy dependencies (like LangChain) before validating required environment variables. This could lead to unclear errors and unstable startup behavior when configuration was missing.
This PR introduces a fail-fast approach—environment variables are now validated at the very beginning, ensuring the app stops immediately with clear, actionable error messages if something is misconfigured.
Improved contributor guidance
The
CONTRIBUTING.mdfile had incomplete sections. These have now been filled to provide clear standards for code style and commit practices.What’s changed?
🔹
app.pyvalidate_env()before importing heavy dependencies🔹
config/validator.py.envfile existence check for easier debugging.envfile🔹
CONTRIBUTING.mdAssisted-By/Generated-By)🔹
tests/test_config_validation.py.envfile scenarioVerification
✅ Automated Tests
test_config_validation.py✅ Manual Testing
.envis missing or renamed