Skip to content
Open
Show file tree
Hide file tree
Changes from 149 commits
Commits
Show all changes
343 commits
Select commit Hold shift + click to select a range
f070e6e
Checkpoint before follow-up message
cursoragent Aug 16, 2025
b9a5dd4
Add new case types for snippet and poll moderation actions
cursoragent Aug 16, 2025
f2b66da
Fix SQLAlchemy query ordering and add type casting for database service
cursoragent Aug 16, 2025
8472605
Fix type casting and import issues in various database and moderation…
cursoragent Aug 16, 2025
aea9dd4
Refactor SQLModel field definitions to use sa_type and sa_column_kwargs
cursoragent Aug 16, 2025
70d329d
Configure Alembic migrations with custom settings and skip default lo…
cursoragent Aug 16, 2025
947dba0
Initialize database with Alembic migration setup
cursoragent Aug 16, 2025
55aeea6
No changes detected, no commit message needed.
cursoragent Aug 16, 2025
88f9eba
Checkpoint before follow-up message
cursoragent Aug 16, 2025
9e8f93f
Checkpoint before follow-up message
cursoragent Aug 16, 2025
f433741
Remove redundant relationship configuration in Guild and GuildConfig …
cursoragent Aug 16, 2025
ef28e56
Add model registry and fix guild config relationship type hint
cursoragent Aug 16, 2025
56e8fc5
Import models eagerly to resolve SQLAlchemy mapping issues
cursoragent Aug 16, 2025
6c58162
Remove forward references from SQLModel relationships in database models
cursoragent Aug 16, 2025
6f31198
Remove SQLModel relationships and adjust primary key types in databas…
cursoragent Aug 16, 2025
59038ff
Improve database migration configuration and add unique constraint
cursoragent Aug 16, 2025
4bc845d
Checkpoint before follow-up message
cursoragent Aug 16, 2025
4221db9
Add PostgreSQL enum type for Case model's case_type field
cursoragent Aug 16, 2025
128aaeb
Improve case number allocation with concurrency safety and retry mech…
cursoragent Aug 16, 2025
3abb1c6
Switch Case model JSON columns to JSONB in PostgreSQL
cursoragent Aug 18, 2025
0cba3d2
Add DateTime(timezone=True) to datetime fields in database models
cursoragent Aug 18, 2025
a8a99e5
Checkpoint before follow-up message
cursoragent Aug 18, 2025
b9870a5
Checkpoint before follow-up message
cursoragent Aug 18, 2025
d8066e3
Checkpoint before follow-up message
cursoragent Aug 18, 2025
9bf7412
Create baseline migration file for schema version 0.1.0
cursoragent Aug 18, 2025
e89e10d
Create initial database migration for SQLModel metadata
cursoragent Aug 18, 2025
c7a27ee
Add automatic snake_case table name generation for SQLModel classes
cursoragent Aug 19, 2025
9464d64
Fix foreign key reference in moderation model and add migration file
cursoragent Aug 19, 2025
5d0e252
Rename database tables to snake_case for consistency
cursoragent Aug 19, 2025
d9f51cf
Create baseline migration file for version 0.1.0
cursoragent Aug 19, 2025
6323f90
Remove outdated migration files and add baseline migration
cursoragent Aug 19, 2025
ce71c64
Create baseline migration for guild and guild_config tables
cursoragent Aug 19, 2025
771a80c
Create baseline database migration with full schema for Tux bot
cursoragent Aug 19, 2025
95ba8fe
feat(db): add explicit Alembic baseline (snake_case), JSONB and enum …
cursoragent Aug 19, 2025
dfeb603
feat(db): add GIN indexes on JSONB fields; add CI workflow to run ale…
cursoragent Aug 19, 2025
e7a441d
Add smoke test for database operations with SQLite
cursoragent Aug 19, 2025
9e19da1
docs(db): add DB README with migration/reset guidance; test: add SQLi…
cursoragent Aug 19, 2025
4975333
Checkpoint before follow-up message
cursoragent Aug 19, 2025
dc58bee
Refactor SQLModel database design and improve code quality
cursoragent Aug 19, 2025
45484fb
Add functional index for case-insensitive snippet name lookup
cursoragent Aug 19, 2025
0152e53
chore: complete Prisma removal and SQLModel migration
kzndotsh Aug 19, 2025
00ae9b7
chore: remove empty 'tables' file
kzndotsh Aug 19, 2025
4f1b5b3
refactor(database): streamline AFK update logic and improve type cons…
kzndotsh Aug 19, 2025
ab06adf
fix: correct package configuration for src layout
kzndotsh Aug 19, 2025
c3d8b81
refactor(database): remove timezone specification from datetime fields
kzndotsh Aug 19, 2025
2957741
refactor(database): remove alembic.ini and migrate to pyproject.toml …
kzndotsh Aug 19, 2025
e608d4d
feat(docker): update development environment configuration with Postg…
kzndotsh Aug 22, 2025
61edf73
refactor(database): unify database service architecture and remove le…
kzndotsh Aug 22, 2025
a7dd2dc
fix(database): update schema creation to use SQLModel metadata
kzndotsh Aug 22, 2025
db6e800
refactor(database): update database interactions for snippets and mod…
kzndotsh Aug 22, 2025
83f1114
feat(extensions): add initial extensions package for Tux Discord bot
kzndotsh Aug 22, 2025
c27983a
refactor(sentry): update comment for clarity on span attributes
kzndotsh Aug 22, 2025
d6a9025
refactor(database): update database service references in report and …
kzndotsh Aug 22, 2025
c846b94
fix(merge): resolve conflicts with main branch
kzndotsh Aug 22, 2025
cd8df63
fix(ci): resolve Alembic configuration issues in CI workflow
kzndotsh Aug 23, 2025
d11687b
fix(docker): resolve postgres data directory permission issues
kzndotsh Aug 23, 2025
901dcdf
chore(github-actions): update and streamline GitHub Actions workflows
kzndotsh Aug 23, 2025
f26cc52
ci(tests.yml): consolidate coverage report generation into a single job
kzndotsh Aug 23, 2025
1395590
chore(docker): update Dockerfile to include group option in uv sync c…
kzndotsh Aug 23, 2025
dceb12c
chore(yamllint): increase max line length for better readability
kzndotsh Aug 23, 2025
d66caf7
chore(workflow): add checkout step to Docker workflow
kzndotsh Aug 23, 2025
a0ff472
feat(database): add create_tables method and enhance PostgreSQL integ…
kzndotsh Aug 23, 2025
dce56b7
ci(ci.yml): update lint job to specify ruff tool configuration
kzndotsh Aug 23, 2025
9e20da3
ci: update CI workflow to ignore test and migration files for Python …
kzndotsh Aug 23, 2025
fee623a
ci(docker.yml): update Trivy scan configuration for Dockerfile
kzndotsh Aug 23, 2025
5e43f0f
ci(docker.yml): remove json format flag from trivy scan configuration
kzndotsh Aug 23, 2025
7fce930
chore(workflows): update Trivy version to v0.63.0 and adjust flags
kzndotsh Aug 23, 2025
f603f25
ci(docker.yml): allow Trivy scan to continue on error and adjust exit…
kzndotsh Aug 23, 2025
f59a0fa
chore(docker): update Docker configurations and add Makefile for data…
kzndotsh Aug 25, 2025
ff4ded1
feat(tests): enhance testing framework with new fixtures and end-to-e…
kzndotsh Aug 25, 2025
5dcc99e
refactor(database): improve Alembic configuration setup in database.py
kzndotsh Aug 25, 2025
a40fcff
refactor(converters): update import paths for CaseType model
kzndotsh Aug 25, 2025
c1b4f6e
refactor(exceptions): update import path for Case model
kzndotsh Aug 25, 2025
cc353f6
refactor(moderation): update import paths for CaseType and Case models
kzndotsh Aug 25, 2025
f419c5e
refactor(database): update import paths for models
kzndotsh Aug 25, 2025
54ba641
refactor(database): enhance migration handling and configuration
kzndotsh Aug 25, 2025
4a7785d
feat(database): add database URL retrieval and health check functiona…
kzndotsh Aug 25, 2025
be5fb5f
refactor(database): consolidate model definitions into a single model…
kzndotsh Aug 25, 2025
b00e5eb
chore(config): standardize YAML configurations and improve readability
kzndotsh Aug 25, 2025
6ba20a6
feat(typings): add type stubs for py-pglite modules
kzndotsh Aug 25, 2025
021901c
feat(database): introduce comprehensive database toolkit for manageme…
kzndotsh Aug 25, 2025
4718188
refactor(makefile): unify database operations under scripts/db.py
kzndotsh Aug 25, 2025
da55790
chore(database): remove development database file
kzndotsh Aug 25, 2025
8b39df0
feat(tests): overhaul test structure for hybrid database architecture
kzndotsh Aug 25, 2025
a66cd3b
feat(database): enhance DatabaseService and BaseController with advan…
kzndotsh Aug 25, 2025
6502e1e
chore(deps): update dependency discord.py to >=2.6.0
electron271 Aug 25, 2025
0154f0f
feat: selective merge from main
kzndotsh Aug 26, 2025
2740b35
feat: merge latest main into v0.1.0
kzndotsh Aug 26, 2025
a766381
ci: exclude docker-compose files from yamlfix formatting
kzndotsh Aug 27, 2025
8a693b1
fix(docker-compose.dev.yml): adjust ports configuration for better re…
kzndotsh Aug 27, 2025
16d3a77
style(docker-compose.yml): reformat ports section for improved readab…
kzndotsh Aug 27, 2025
ac04bd1
refactor: overhaul Makefile and CLI structure for Tux development
kzndotsh Aug 27, 2025
dcc5aab
chore(deps): update pre-commit hooks to latest versions
kzndotsh Aug 27, 2025
65c39f1
chore: resolve merge conflict by removing poetry.lock and updating .g…
kzndotsh Aug 27, 2025
d2a06be
chore(pre-commit): remove check-yaml hook and exclude docker-compose …
kzndotsh Aug 27, 2025
c421fe7
feat(logging): add custom Tux logger initialization to scripts
kzndotsh Aug 27, 2025
eca7d9c
feat(db-migrate.py): implement reset-migrations command to reset and …
kzndotsh Aug 27, 2025
a6bdd55
chore: update project configuration and remove deprecated files
kzndotsh Aug 31, 2025
8bcff2e
refactor: update README and configuration documentation for improved …
kzndotsh Aug 31, 2025
e83224b
feat: refactor configuration system to use Pydantic settings
kzndotsh Aug 31, 2025
d77f7ac
feat: add Adminer theme and auto-login functionality
kzndotsh Aug 31, 2025
791aeeb
refactor(tests): streamline test configuration and enhance documentation
kzndotsh Aug 31, 2025
7d53c70
refactor(database): overhaul database service architecture for async …
kzndotsh Aug 31, 2025
3505cd1
refactor(substitutions): update configuration access and remove unuse…
kzndotsh Aug 31, 2025
bac7856
refactor(banner, embeds, config): streamline configuration access and…
kzndotsh Aug 31, 2025
a23eb93
refactor(main): enhance application startup process with improved err…
kzndotsh Aug 31, 2025
78ae3be
refactor(help): update configuration access and improve help command …
kzndotsh Aug 31, 2025
e920b4c
feat(cli): add command line interface for Tux Discord Bot
kzndotsh Aug 31, 2025
b03a4f0
refactor(config): update configuration access across multiple services
kzndotsh Aug 31, 2025
9edbd5f
refactor(config): update configuration access across multiple modules
kzndotsh Aug 31, 2025
c51af54
revert(extensions): delete unused extensions package for Tux Discord bot
kzndotsh Aug 31, 2025
9275541
refactor(config): streamline configuration access and remove unused s…
kzndotsh Aug 31, 2025
8748bbd
fix(bot): move prefix manager import to top level
kzndotsh Sep 2, 2025
9ba2195
fix(pre-commit): disable .env generation hook
kzndotsh Sep 2, 2025
9219eb4
fix(pre-commit): correct env generation hook to use env.example
kzndotsh Sep 2, 2025
89e047c
feat(docker): add Compose Watch for development hot reload
kzndotsh Sep 2, 2025
451665f
fix(docker): add missing target fields for sync+restart actions
kzndotsh Sep 2, 2025
906ea5b
feat(dev): add automatic shutdown on bot failure
kzndotsh Sep 2, 2025
9c6168a
feat(docker): add entrypoint script for database readiness and migrat…
kzndotsh Sep 2, 2025
6dc00fe
refactor(docs): update CLI documentation and mkdocs configuration
kzndotsh Sep 2, 2025
646da15
refactor(cli): restructure CLI architecture and remove legacy scripts
kzndotsh Sep 2, 2025
8f651d9
fix(lint): resolve asyncio and contextlib linting issues
kzndotsh Sep 2, 2025
6ccd5ee
feat(migrations): enhance database migration checks and logging
kzndotsh Sep 2, 2025
0cb9e17
refactor(docker): update Dockerfile for improved structure and entryp…
kzndotsh Sep 2, 2025
6ce0f64
refactor: remove redundant src/tux/cli.py
kzndotsh Sep 2, 2025
df9da23
chore: remove outdated configuration and developer documentation
kzndotsh Sep 2, 2025
96e8a5c
refactor(tests): update guild config prefixes to valid lengths
kzndotsh Sep 2, 2025
2cb59e2
chore: update .markdownlintignore to include .archive directory
kzndotsh Sep 2, 2025
1d8a1f2
feat: enhance test environment setup and file detection in workflows
kzndotsh Sep 3, 2025
06494d1
fix: correct GitHub Actions workflow syntax for labels access
kzndotsh Sep 3, 2025
29fc7dd
feat: enhance CI/CD with comprehensive registry cleanup and monitoring
kzndotsh Sep 3, 2025
3528515
chore: update Docker workflow for improved cleanup and remove obsolet…
kzndotsh Sep 3, 2025
06a9b37
chore: update README and CI workflow for improved clarity and functio…
kzndotsh Sep 3, 2025
98d42fb
chore: improve Docker workflow and action error handling
kzndotsh Sep 3, 2025
647bc52
chore: enhance Docker configuration and entrypoint logic
kzndotsh Sep 3, 2025
bd315ff
feat: implement comprehensive moderation service with enhanced case m…
kzndotsh Sep 5, 2025
6c81bf5
chore: update Dockerfile and configuration files for improved setup a…
kzndotsh Sep 5, 2025
193ebd1
fix: improve error handling during bot setup and connection process
kzndotsh Sep 5, 2025
6d7df47
fix: enhance database password validation in settings
kzndotsh Sep 5, 2025
ae28a2a
refactor: remove default_prefix from PrefixManager status output
kzndotsh Sep 5, 2025
a49bcc0
fix: ensure proper color assignment in EmbedCreator
kzndotsh Sep 5, 2025
3701faf
refactor: simplify test configuration and enhance fixture architecture
kzndotsh Sep 5, 2025
b8c254c
chore: update dependencies and configuration for improved compatibility
kzndotsh Sep 9, 2025
9e5b389
feat: implement permission system setup in bot initialization
kzndotsh Sep 9, 2025
c752cb2
feat: introduce dynamic permission system for server role management
kzndotsh Sep 9, 2025
959d3aa
refactor: streamline permission checking utilities and enhance compat…
kzndotsh Sep 9, 2025
21ff2b6
feat: add moderation services configuration to service registry
kzndotsh Sep 9, 2025
801ce9e
feat: implement dynamic permission system with new database models an…
kzndotsh Sep 9, 2025
e3a53b2
feat: add comprehensive permission management commands for server adm…
kzndotsh Sep 9, 2025
5d121a9
refactor: replace legacy permission checks with require_bot_owner dec…
kzndotsh Sep 9, 2025
605faa1
refactor: replace legacy permission checks with specific decorators
kzndotsh Sep 9, 2025
729c011
refactor: transition ModerationCogBase to service-based architecture
kzndotsh Sep 9, 2025
319e0bc
refactor: replace legacy permission checks with specific decorators i…
kzndotsh Sep 9, 2025
86a2ae2
refactor: transition to service-based moderation architecture
kzndotsh Sep 9, 2025
eb358ee
refactor: replace legacy permission checks with specific decorators i…
kzndotsh Sep 9, 2025
e4f0484
refactor: simplify moderation service integration tests by removing r…
kzndotsh Sep 9, 2025
3079c63
docs: add comments for database error handling in error.py
kzndotsh Sep 9, 2025
7d04c26
fix: resolve Dockerfile indentation conflicts with main branch
kzndotsh Sep 9, 2025
fade3b5
Merge remote-tracking branch 'origin/main' into v0.1.0
kzndotsh Sep 9, 2025
937e658
fix: apply consistent 8-space indentation to Dockerfile package insta…
kzndotsh Sep 9, 2025
dca2ced
fix: update .editorconfig to use 8-space indentation for Docker files…
kzndotsh Sep 9, 2025
b603e50
fix: add markdownlint config flag to use existing .markdownlint.yaml
kzndotsh Sep 9, 2025
3b435ea
fix: use proper ruff_config parameter instead of ruff_flags for pypro…
kzndotsh Sep 9, 2025
be65d19
fix: revert to correct ruff_flags parameter for pyproject.toml config
kzndotsh Sep 9, 2025
15d3430
fix: use direct ruff command to ensure pyproject.toml config is honored
kzndotsh Sep 9, 2025
0d1d6c1
fix: update GitHub Actions workflow to conditionally download test co…
kzndotsh Sep 9, 2025
a0a6f85
refactor: improve type hints and output handling in CLI scripts
kzndotsh Sep 9, 2025
ab9c915
refactor: improve type checking and circular import handling in servi…
kzndotsh Sep 9, 2025
db8d04f
refactor: update database models and improve relationships
kzndotsh Sep 9, 2025
2466a6b
refactor: enhance error handling and type safety in moderation services
kzndotsh Sep 9, 2025
08ec2ff
refactor: restructure moderation testing framework to utilize new ser…
kzndotsh Sep 9, 2025
6ffb4d6
refactor: enhance asynchronous cache initialization in TLDR cog
kzndotsh Sep 9, 2025
0b97e0c
refactor: remove strict type checking mode from VSCode settings
kzndotsh Sep 18, 2025
acf55ab
feat: add type stubs for Typer CLI library
kzndotsh Sep 18, 2025
069630d
refactor: replace typer imports with direct Typer usage across CLI sc…
kzndotsh Sep 18, 2025
b886182
refactor: streamline Dockerfile for improved readability and efficiency
kzndotsh Sep 18, 2025
2cc5574
chore: update dependencies and configuration in pyproject.toml and uv…
kzndotsh Sep 18, 2025
36e6e0c
refactor: rename custom modules to plugins and update related configu…
kzndotsh Sep 18, 2025
4566118
refactor: simplify ModerationCogBase initialization and documentation
kzndotsh Sep 18, 2025
b0fc9d4
refactor: improve database migration error handling and logging
kzndotsh Sep 18, 2025
e553a83
refactor: enhance logging configuration and streamline CLI execution
kzndotsh Sep 19, 2025
d9fd026
refactor: simplify core module structure and remove unused components
kzndotsh Sep 19, 2025
0589828
refactor: restructure database controller architecture for improved m…
kzndotsh Sep 19, 2025
f381c7a
refactor: implement a modular help system with improved UI components
kzndotsh Sep 19, 2025
625dc5d
refactor: update imports to use Tux from bot module
kzndotsh Sep 19, 2025
7db5f8d
refactor: update imports to consistently use Tux from the bot module
kzndotsh Sep 19, 2025
ff1fbec
refactor: update imports to consistently use Tux from the bot module
kzndotsh Sep 19, 2025
f80d6b6
refactor: update imports to consistently use Tux from the bot module …
kzndotsh Sep 19, 2025
32b3e21
refactor: update imports to consistently use Tux from the bot module …
kzndotsh Sep 19, 2025
c36034b
refactor: update imports and utilize constants for improved maintaina…
kzndotsh Sep 19, 2025
9d63313
refactor: update imports to consistently use Tux from the bot module
kzndotsh Sep 19, 2025
33cb10e
refactor: update imports to consistently use Tux from the bot module …
kzndotsh Sep 19, 2025
3165ff5
refactor: update imports to consistently use Tux from the bot module …
kzndotsh Sep 19, 2025
5951157
refactor: update imports to consistently use Tux from the bot module …
kzndotsh Sep 19, 2025
95bf297
refactor: remove help command system and associated UI components
kzndotsh Sep 19, 2025
f0836d4
refactor: update imports to consistently use Tux from the bot module …
kzndotsh Sep 19, 2025
88b65c9
refactor: implement centralized error handling system for Tux bot
kzndotsh Sep 19, 2025
861ea49
refactor: update import of Tux to use the bot module in sentry handler
kzndotsh Sep 19, 2025
a91630a
refactor: update imports to consistently use Tux from the bot module …
kzndotsh Sep 19, 2025
cf5451d
refactor: implement new hot reload system for Tux Discord bot
kzndotsh Sep 19, 2025
1d6f772
refactor: update imports to consistently use Tux from the bot module …
kzndotsh Sep 19, 2025
9eca921
refactor: remove logger module from Tux services
kzndotsh Sep 19, 2025
acd774b
refactor: replace hardcoded status codes with constants in Godbolt se…
kzndotsh Sep 19, 2025
28f9197
feat: add new constants for configuration, performance thresholds, an…
kzndotsh Sep 19, 2025
4ed6b44
feat: introduce centralized error handling mixin and utilities
kzndotsh Sep 19, 2025
e30abc6
feat: enhance exception handling with new custom error classes
kzndotsh Sep 19, 2025
b872b2e
refactor: utilize constants for encoding in configuration settings
kzndotsh Sep 19, 2025
343f4ec
refactor: update import of Tux to use the bot module in substitutions.py
kzndotsh Sep 19, 2025
94879af
refactor: improve logging configuration and exception handling in mai…
kzndotsh Sep 19, 2025
c0b9797
chore: add pytest-loguru dependency for enhanced logging in tests
kzndotsh Sep 19, 2025
5b71e61
refactor: update imports and enhance logging configuration in test files
kzndotsh Sep 19, 2025
18ca1cc
chore: update .gitignore to include new Amazon Q CLI todo list JSON f…
kzndotsh Sep 19, 2025
41b012c
refactor: implement centralized HTTP client service for improved requ…
kzndotsh Sep 19, 2025
a83a30c
refactor: rename and standardize exception classes for clarity
kzndotsh Sep 19, 2025
1349e04
refactor: enhance HTTP client methods with error handling
kzndotsh Sep 19, 2025
48effd2
chore: update dependencies and add new tests for HTTP client
kzndotsh Sep 19, 2025
ef3aea5
refactor: streamline database migration process by removing threading
kzndotsh Sep 19, 2025
a8e823a
refactor: migrate Sentry integration to a new structure for improved …
kzndotsh Sep 20, 2025
8c52de7
chore: update .gitignore to exclude Amazon Q CLI todo list directory
kzndotsh Sep 20, 2025
fc73900
refactor: improve command execution in TestCLI for better signal hand…
kzndotsh Sep 20, 2025
66a86bc
feat: add comprehensive test fixtures for database and Sentry integra…
kzndotsh Sep 20, 2025
0fe2fc2
refactor: standardize database service usage across integration tests
kzndotsh Sep 20, 2025
6f2d312
test: add unit tests for error handling and Sentry integration
kzndotsh Sep 20, 2025
f65d8d6
test: add end-to-end tests for error handling flow
kzndotsh Sep 20, 2025
185d485
refactor: simplify test configuration by consolidating fixtures
kzndotsh Sep 20, 2025
077ef2d
refactor: remove Sentry error capturing from database connection methods
kzndotsh Sep 20, 2025
6820e30
refactor: enhance bot setup process with improved error handling and …
kzndotsh Sep 21, 2025
be7a9bc
feat: add Role Count plugin for All Things Linux Discord server
kzndotsh Sep 21, 2025
37c7b2f
refactor: enhance error handling in guild configuration and snippet c…
kzndotsh Sep 23, 2025
fc8a0b8
fix: change default value of 'dirty' option in DocsCLI to False
kzndotsh Sep 23, 2025
f90a0cf
style: enhance UI with smooth scrolling, custom scrollbars, and moder…
kzndotsh Sep 23, 2025
9d7120e
feat: add MkDocs Tux plugin for documentation generation
kzndotsh Sep 23, 2025
2bd9a82
feat: update MkDocs configuration for enhanced documentation structure
kzndotsh Sep 23, 2025
58c6fc0
docs: update README and add comprehensive documentation
kzndotsh Sep 24, 2025
7e0f750
chore: fix mkdocs color
kzndotsh Sep 24, 2025
21e75a9
feat(pyproject.toml): add MkDocs plugin entry point for TuxPlugin
kzndotsh Sep 24, 2025
ec9ef44
chore: update .gitignore to include settings.yml for developers who s…
electron271 Sep 25, 2025
e23d120
docs: update markdown formatting in contributing, faq, support, and d…
kzndotsh Sep 28, 2025
df66aac
refactor: update import paths for ErrorHandler in error handling tests
kzndotsh Sep 28, 2025
b35ad29
feat(setup): implement bot initialization services for setup orchestr…
kzndotsh Sep 28, 2025
c979767
feat(base_cog): add unload_if_missing_config method for graceful cog …
kzndotsh Sep 28, 2025
7ed3b81
refactor(bot): streamline bot setup process and remove deprecated met…
kzndotsh Sep 28, 2025
a6468dc
feat(cog_loader): enhance cog eligibility checks and logging
kzndotsh Sep 28, 2025
115bb8f
refactor(logging): simplify logging configuration and remove deprecat…
kzndotsh Sep 28, 2025
a7e4015
refactor(database): improve database service retrieval logic
kzndotsh Sep 28, 2025
64dc98e
feat(config): implement unload_if_missing_config checks in multiple cogs
kzndotsh Sep 28, 2025
9b18520
feat(error_handler): introduce comprehensive error handling cog for D…
kzndotsh Sep 28, 2025
eb17ea9
feat(activity_handler): enhance activity management with placeholder …
kzndotsh Sep 28, 2025
049f709
chore(substitutions): remove unused substitutions module from the cod…
kzndotsh Sep 28, 2025
5c2f948
feat(hot_reload): add hot reload cog and enhance reload logic
kzndotsh Sep 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ coverage:
# BOT COMMANDS AND FEATURES (High standards - 75% target)
# User-facing commands and Discord integrations
# High standards because these directly impact user experience
cogs:
modules:
target: 75%
threshold: 2%
informational: true # Don't block PRs while building up test suite
flags:
- unit
paths:
- tux/cogs/**/* # All command cogs and Discord slash commands
- tux/modules/**/* # All command modules and Discord slash commands
only_pulls: true

# UTILITIES AND HELPERS (Moderate standards - 70% target)
Expand Down Expand Up @@ -366,10 +366,10 @@ component_management:
# User-facing Discord commands and integrations
- unit
- database
- component_id: cogs
- component_id: modules
name: Bot Commands & Features
paths:
- tux/cogs/**/* # All command cogs organized by category
- tux/modules/**/* # All command modules organized by category
flag_regexes:
- unit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import TypeVar

from loguru import logger

from prisma import Prisma

T = TypeVar("T")
Expand Down Expand Up @@ -76,7 +75,7 @@ async def connect(self) -> None:
Notes
-----
The DATABASE_URL environment variable should be set before calling
this method, which is handled by the tux.utils.env module.
this method, which is handled by the tux.shared.config.env module.
"""
if self._client is not None:
logger.warning(CLIENT_ALREADY_CONNECTED)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
"""Database controller module providing access to all model controllers."""

import functools
import inspect
import importlib
from typing import Any, ClassVar, TypeVar

import sentry_sdk

from tux.database.controllers.afk import AfkController
from tux.database.controllers.case import CaseController
from tux.database.controllers.guild import GuildController
from tux.database.controllers.guild_config import GuildConfigController
from tux.database.controllers.levels import LevelsController
from tux.database.controllers.note import NoteController
from tux.database.controllers.reminder import ReminderController
from tux.database.controllers.snippet import SnippetController
from tux.database.controllers.starboard import StarboardController, StarboardMessageController
from tux.services.database.controllers.afk import AfkController
from tux.services.database.controllers.case import CaseController
from tux.services.database.controllers.guild import GuildController
from tux.services.database.controllers.guild_config import GuildConfigController
from tux.services.database.controllers.levels import LevelsController
from tux.services.database.controllers.note import NoteController
from tux.services.database.controllers.reminder import ReminderController
from tux.services.database.controllers.snippet import SnippetController
from tux.services.database.controllers.starboard import (
StarboardController,
StarboardMessageController,
)

# Note: Avoid importing tracing at module import time to prevent circular imports.
_TRACING_AVAILABLE = True

# Define a TypeVar that can be any BaseController subclass
ControllerType = TypeVar("ControllerType")
Expand Down Expand Up @@ -67,7 +70,9 @@ def __init__(self) -> None:

def _get_controller(self, controller_type: type[ControllerType]) -> ControllerType:
"""
Helper method to instantiate a controller with proper Sentry instrumentation.
Helper to instantiate a controller with selective Sentry instrumentation.

Only instruments meaningful database operations to reduce span noise.

Parameters
----------
Expand All @@ -77,84 +82,65 @@ def _get_controller(self, controller_type: type[ControllerType]) -> ControllerTy
Returns
-------
ControllerType
The instantiated controller
The instantiated controller with selectively instrumented methods
"""
instance = controller_type()
if sentry_sdk.is_initialized():
# Get all public methods to wrap
methods = [attr for attr in dir(instance) if callable(getattr(instance, attr)) and not attr.startswith("_")]

# Wrap each public method with Sentry transaction
for method_name in methods:
# Exclude internal/utility helpers that create noise
excluded_methods = {
"safe_get_attr",
"connect_or_create_relation",
"_add_include_arg_if_present",
"_build_find_args",
"_build_simple_args",
"_build_create_args",
"_build_update_args",
"_build_delete_args",
"_build_upsert_args",
"_execute_query",
"_set_scope_context",
}

# Include common CRUD/meaningful patterns
include_prefixes = (
"get_",
"find_",
"create_",
"update_",
"delete_",
"count_",
"increment_",
"toggle_",
"lock_",
"unlock_",
"bulk_",
)

# Lazy import via importlib to avoid circular import during package init
try:
_tracing = importlib.import_module("tux.services.tracing")
_span = getattr(_tracing, "span", None)
except Exception:
_span = None

# Get public methods that aren't excluded
method_names = [
attr
for attr in dir(instance)
if callable(getattr(instance, attr)) and not attr.startswith("_") and attr not in excluded_methods
]

# Wrap only methods that match meaningful operation patterns
for method_name in method_names:
if method_name.startswith(include_prefixes):
original_method = getattr(instance, method_name)
# Use a factory function to capture loop variables
self._create_wrapped_method(instance, method_name, original_method)
if _span is not None:
op = f"db.controller.{method_name}"
wrapped = _span(op=op)(original_method)
setattr(instance, method_name, wrapped)

return instance

def _create_wrapped_method(self, instance: Any, method_name: str, original_method: Any) -> None:
"""
Create a wrapped method with proper sentry instrumentation.

Parameters
----------
instance : Any
The controller instance
method_name : str
The name of the method to wrap
original_method : Any
The original method to wrap
"""

# Check if the original method is async
is_async = inspect.iscoroutinefunction(original_method)

if is_async:

@functools.wraps(original_method)
async def async_wrapped_method(*args: Any, **kwargs: Any) -> Any:
controller_name = instance.__class__.__name__
with sentry_sdk.start_span(
op=f"db.controller.{method_name}",
description=f"{controller_name}.{method_name}",
) as span:
span.set_tag("db.controller", controller_name)
span.set_tag("db.operation", method_name)
try:
result = await original_method(*args, **kwargs)
except Exception as e:
span.set_status("internal_error")
span.set_data("error", str(e))
raise
else:
span.set_status("ok")
return result

setattr(instance, method_name, async_wrapped_method)

else:

@functools.wraps(original_method)
def sync_wrapped_method(*args: Any, **kwargs: Any) -> Any:
controller_name = instance.__class__.__name__
with sentry_sdk.start_span(
op=f"db.controller.{method_name}",
description=f"{controller_name}.{method_name}",
) as span:
span.set_tag("db.controller", controller_name)
span.set_tag("db.operation", method_name)
try:
result = original_method(*args, **kwargs)
except Exception as e:
span.set_status("internal_error")
span.set_data("error", str(e))
raise
else:
span.set_status("ok")
return result

setattr(instance, method_name, sync_wrapped_method)

_controller_mapping: ClassVar[dict[str, type]] = {
"afk": AfkController,
"case": CaseController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from prisma.actions import GuildActions
from prisma.models import AFKModel, Guild
from tux.database.client import db
from tux.database.controllers.base import BaseController

from tux.services.database.client import db
from tux.services.database.controllers.base import BaseController


class AfkController(BaseController[AFKModel]):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""Base controller module providing common database functionality."""

import importlib
from collections.abc import Callable
from typing import Any, TypeVar

import sentry_sdk
from loguru import logger

from prisma.models import (
AFKModel,
Case,
Expand All @@ -18,7 +17,8 @@
Starboard,
StarboardMessage,
)
from tux.database.client import db

from tux.services.database.client import db

# Explicitly define ModelType to cover all potential models used by controllers
ModelType = TypeVar(
Expand Down Expand Up @@ -84,6 +84,7 @@ async def _execute_query(
self,
operation: Callable[[], Any],
error_msg: str,
op_name: str,
) -> Any:
"""Executes a database query with standardized error logging.

Expand All @@ -107,17 +108,25 @@ async def _execute_query(
Exception
Re-raises any exception caught during the database operation.
"""
# Create a Sentry span to track database query performance
if sentry_sdk.is_initialized():
with sentry_sdk.start_span(op="db.query", description=f"Database query: {self.table_name}") as span:
span.set_tag("db.table", self.table_name)
# Lazy import via importlib to avoid circular import through package __init__
try:
_tracing = importlib.import_module("tux.services.tracing")
_start_span = getattr(_tracing, "start_span", None)
except Exception:
_start_span = None

if _start_span is not None:
with _start_span(op=f"db.query.{op_name}", name=self.table_name) as span: # type: ignore
try:
result = await operation()
span.set_status("ok")
if hasattr(span, "set_status"):
span.set_status("ok")
return result # noqa: TRY300
except Exception as e:
span.set_status("internal_error")
span.set_data("error", str(e))
if hasattr(span, "set_status"):
span.set_status("internal_error")
if hasattr(span, "set_data"):
span.set_data("error", str(e))
logger.error(f"{error_msg}: {e}")
raise
else:
Expand Down Expand Up @@ -238,6 +247,7 @@ async def find_one(
return await self._execute_query(
lambda: self.table.find_first(**find_args),
f"Failed to find record in {self.table_name} with criteria {where}",
"find_one",
)

async def find_unique(
Expand All @@ -263,6 +273,7 @@ async def find_unique(
return await self._execute_query(
lambda: self.table.find_unique(**find_args),
f"Failed to find unique record in {self.table_name} with criteria {where}",
"find_unique",
)

async def find_many(
Expand Down Expand Up @@ -307,6 +318,7 @@ async def find_many(
return await self._execute_query(
lambda: self.table.find_many(**find_args),
f"Failed to find records in {self.table_name} with criteria {where}",
"find_many",
)

async def count(
Expand All @@ -328,6 +340,7 @@ async def count(
return await self._execute_query(
lambda: self.table.count(where=where),
f"Failed to count records in {self.table_name} with criteria {where}",
"count",
)

async def create(
Expand All @@ -353,6 +366,7 @@ async def create(
return await self._execute_query(
lambda: self.table.create(**create_args),
f"Failed to create record in {self.table_name} with data {data}",
"create",
)

async def update(
Expand Down Expand Up @@ -381,6 +395,7 @@ async def update(
return await self._execute_query(
lambda: self.table.update(**update_args),
f"Failed to update record in {self.table_name} with criteria {where} and data {data}",
"update",
)

async def delete(
Expand All @@ -406,6 +421,7 @@ async def delete(
return await self._execute_query(
lambda: self.table.delete(**delete_args),
f"Failed to delete record in {self.table_name} with criteria {where}",
"delete",
)

async def upsert(
Expand Down Expand Up @@ -437,6 +453,7 @@ async def upsert(
return await self._execute_query(
lambda: self.table.upsert(**upsert_args),
f"Failed to upsert record in {self.table_name} with where={where}, create={create}, update={update}",
"upsert",
)

async def update_many(
Expand Down Expand Up @@ -466,6 +483,7 @@ async def update_many(
result = await self._execute_query(
lambda: self.table.update_many(where=where, data=data),
f"Failed to update records in {self.table_name} with criteria {where} and data {data}",
"update_many",
)
# Validate and return count
count_val = getattr(result, "count", None)
Expand Down Expand Up @@ -498,6 +516,7 @@ async def delete_many(
result = await self._execute_query(
lambda: self.table.delete_many(where=where),
f"Failed to delete records in {self.table_name} with criteria {where}",
"delete_many",
)
# Validate and return count
count_val = getattr(result, "count", None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
from prisma.enums import CaseType
from prisma.models import Case, Guild
from prisma.types import CaseWhereInput
from tux.database.client import db
from tux.database.controllers.base import BaseController

from tux.services.database.client import db
from tux.services.database.controllers.base import BaseController


class CaseController(BaseController[Case]):
Expand Down
Loading
Loading