feat : Database integration
Merge Request Description
🎯 Objective
Implement persistent storage for the GitLab Compliance Checker using a relational SQL database. This introduces SQLAlchemy to integrate with Neon Postgres, fully replacing the transient status and file-based state management structure.
📝 Description of Changes
This MR introduces a robust, database-backed infrastructure to manage the project roster and application states. We have refactored the architecture to ensure cleaner boundaries between the Infrastructure, Service layers, and the UI, alongside robust updates to unit and integration testing.
🏗 ️ Architecture & Infrastructure
-
SQLAlchemy Engine: Added
database.pyfor connection pooling, session management, and robust initialization. -
ORM Models: Added
models.pywhich defines the declarative base mappings (e.g., Roster data structure). -
Dependencies: Updated
pyproject.tomland regenerateduv.lockwith SQLAlchemy bindings. Included a localtemp_roster.dbdatabase stub for local testing flows.
⚙ ️ Services & Business Logic
-
Roster Service Layer: Created
services/roster_service.pyto abstract all underlying database CRUD operations and decouple the application’s business logic from the view logic.
🖥 ️ User Interface Refactoring
-
New Admin Interface: Introduced
admin.pyto allow direct DB-backed roster management directly from the Streamlit UI. -
Service Integration: Broadly updated
app.py,main.py,batch.py,leaderboard.py, andweekly_performance.pyso that UI widgets directly interact with the newRosterService, ensuring high consistency compared to reading from disconnected static sources.
🧪 Testing & Reliability
-
Comprehensive Test Suites Built: Scaled testing significantly with new specifications for the database service layer (
test_roster_service.py), administration interface (test_admin_ui.py), and decoupled compliance logic components (test_compliance_service_logic.py,test_profile_service_extended.py). -
Test Suite Refactoring: Cleaned up excessive duplicate mocks and streamlined the test environment in
test_modes_team_leaderboard.py,test_modes_batch_analytics.py, andtest_app.pyto work correctly against mocked sessions and database state variables.
✅ Checklist
-
Database configurations set for Neon integration -
UI correctly retrieves values managed through RosterService -
Core business-layer functionalities verify successfully -
Automated tests for new components added and passing
Edited by Bikkumalla Sai Krishna