-
-
Notifications
You must be signed in to change notification settings - Fork 43
DRAFT: v0.1.0 #1020
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
Open
kzndotsh
wants to merge
139
commits into
main
Choose a base branch
from
v0.1.0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
DRAFT: v0.1.0 #1020
+10,779
−9,573
Conversation
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
…w audit files - Updated to include and directories. - Modified to exclude from checks. - Added multiple new audit files for comprehensive analysis and documentation of the codebase.
- Introduced core modules for dependency injection including ServiceContainer, BaseCog, and service interfaces. - Added concrete service implementations for database, bot, and configuration services. - Established a centralized ServiceRegistry for service configuration and management. - Enhanced BaseCog to support automatic service injection while maintaining backward compatibility.
- Added ContainerInitializationError for handling container setup failures. - Implemented _setup_container method to initialize and validate the dependency injection container. - Introduced _validate_container and _raise_container_validation_error methods for improved error handling. - Updated setup_hook and _setup_callback to include container status in Sentry context. - Implemented _cleanup_container method to manage container lifecycle during shutdown.
- Added DatabaseControllerSingleton class to manage a single instance of DatabaseController. - Introduced get_db_controller function to retrieve the database controller instance. - Updated fetch_guild_config function to use the singleton instance for fetching guild configuration.
- Updated multiple command classes to inherit from BaseCog instead of commands.Cog. - Adjusted constructor calls to utilize super() for proper initialization. - This change enhances consistency and leverages the new dependency injection framework.
- Introduced a new script to validate the completeness of the dependency injection migration. - The script analyzes cog files for BaseCog inheritance and direct instantiations of DatabaseController. - Provides output in various formats (json, table, summary) and allows exporting results to a JSON file. - Enhances the ability to measure migration success metrics and identify issues in the codebase.
- Introduced unit tests for the Config, Setup, Level, Levels, ModerationCogBase, InfluxLogger, LevelsService, Starboard, SnippetsBaseCog, AFK, Poll, RemindMe, SelfTimeout, and core components. - Each test suite verifies cog initialization, database service fallback, and specific functionality to ensure proper behavior with dependency injection. - Enhanced test coverage for the core dependency injection framework and service implementations.
… Tux bot - Introduced new test fixtures for mocking database, bot, and configuration services to facilitate unit testing. - Added example unit tests demonstrating how to test cogs with dependency injection, covering command execution and service interactions. - Enhanced test coverage for the dependency injection framework, ensuring proper functionality and error handling in various scenarios.
…stem in Tux bot - Introduced a new test module for integration testing of the dependency injection system, covering bot startup, service registration, and cog loading. - Implemented tests to verify container initialization, service resolution, and error handling in various scenarios. - Enhanced test coverage for end-to-end functionality, ensuring proper interaction between services and cogs. - Included performance tests to measure startup time and service resolution efficiency, ensuring no degradation in performance.
- Added comments to the conftest.py file to clarify the purpose of the dependency injection fixtures. - Improved code readability and maintainability for future development.
- Introduced new modules and services to improve the functionality and organization of the Tux bot. - Added comprehensive documentation for new features and modules, including dependency injection and service management. - Implemented various utility functions and classes to streamline bot operations and enhance maintainability. - Updated existing files to reflect changes in the project structure and ensure compatibility with new modules. - Enhanced test coverage with new unit and integration tests for the added features, ensuring robust functionality.
- Removed the unused FrameType import to clean up the code. - Added a blank line for improved readability in the setup_signals method.
Instrument only meaningful controller methods (span op=db.controller.*). Route query spans via start_span in base; pass op_name to avoid duplicates. Lazy import tracing via importlib to prevent cycles.
Replace direct Sentry calls with capture_span_exception/set_span_attributes; use enhanced_span for grouped ops; standardize telemetry.
Expose shared bot protocol in core for extension management; swap hot_reload to use it and deprecate local BotProtocol.
…dize command error handling
…rvice to avoid None-type access
…ne (no temp variable)
…ight in error handler
…tterns for return paths
… Codecov config, and smoke tests
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
…anism Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
…support; make downgrade idempotent; wire non-dev startup to alembic upgrade; remove create_all paths
…mbic upgrade head and linters
Co-authored-by: admin <[email protected]>
…te smoke test and optional Postgres integration test
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
Co-authored-by: admin <[email protected]>
- Remove Prisma dependency from pyproject.toml - Archive prisma/schema directory to .prisma-archive/ - Replace Prisma CLI commands with Alembic equivalents - Update Docker files to remove Prisma client generation - Update all documentation to use SQLModel/Alembic terminology - Fix CI workflow shellcheck warning - Update GitHub Actions to remove generate-prisma parameter - Replace database setup instructions from 'db push' to 'db upgrade' This completes the migration from Prisma to SQLModel + Alembic for database management, providing a more modern Python-native approach with improved type safety and development experience.
The 'tables' file is deleted as it is empty and not used in the project. Removing unused files helps in maintaining a clean and organized codebase.
…istency Use the `BaseModel.update_by_id` method for updating AFK entries, simplifying the code and ensuring consistency with other update operations. This change reduces redundancy and potential errors by leveraging existing methods. fix(database): correct type annotations and remove redundant code Remove unnecessary type checking imports and correct type annotations for SQLAlchemy fields. This improves code readability and ensures consistency across the codebase. The changes also include setting timezone information in `sa_column_kwargs` for datetime fields, ensuring proper handling of timezones. style(database): simplify list comprehension and remove type ignores Simplify the list comprehension in `get_cases_by_options` method to improve readability. Remove unnecessary type ignores, as they are no longer needed with the updated type annotations. This enhances code clarity and maintainability.
- Changed from include to packages in hatch configuration - Fixed module resolution for CLI entry point - Resolves ModuleNotFoundError when running 'uv run tux'
style: update import statements and comments for clarity fix: handle potential None values in CacheService methods The datetime fields in the database models no longer specify timezone information, simplifying the schema and reducing potential issues with timezone handling. Import statements and comments are updated for clarity and consistency, improving code readability. The CacheService methods are refactored to handle potential None values more gracefully, ensuring robustness when Redis is not available. Additionally, unused files related to the SQLModel refactor are removed to clean up the repository.
…for configuration feat(database): add support for environment-based database URL and timezone configuration feat(database): implement reset-migrations command for clean migration baseline fix(database): use database-side current timestamp for expiration checks refactor(bot): adjust setup order for container and database initialization The alembic.ini file is removed to centralize configuration in pyproject.toml, simplifying project setup. The database URL is now set via environment variables, enhancing flexibility. A new reset-migrations command is added to streamline migration management, allowing for a clean baseline. Expiration checks now use database-side timestamps to avoid timezone issues. The bot setup order is adjusted for better initialization flow.
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
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. If this change fixes any issues please put "Fixes #XX" in the description. Please also ensure to add the appropriate labels to the PR.
Guidelines
My code follows the style guidelines of this project (formatted with Ruff)
I have performed a self-review of my own code
I have commented my code, particularly in hard-to-understand areas
I have made corresponding changes to the documentation if needed
My changes generate no new warnings
I have tested this change
Any dependent changes have been merged and published in downstream modules
I have added all appropriate labels to this PR
I have followed all of these guidelines.
How Has This Been Tested? (if applicable)
Please describe how you tested your code. e.g describe what commands you ran, what arguments, and any config stuff (if applicable)
Screenshots (if applicable)
Please add screenshots to help explain your changes.
Additional Information
Please add any other information that is important to this PR.
Summary by Sourcery
Migrate project from Poetry to Uv (Hatch) as the dependency and build tool, restructure code under src/, introduce a dependency injection container with BaseCog for service resolution, centralize Sentry integration via a new SentryManager, and overhaul tracing/error handling instrumentation. Update CLI commands, Docker configurations, CI workflows, documentation, and tests to use Uv, add unit/integration/e2e test markers with isolation, and bump version to v0.1.0.
New Features:
Enhancements:
Build:
CI:
Documentation:
Tests:
Chores: