Skip to content

Conversation

kzndotsh
Copy link
Contributor

@kzndotsh kzndotsh commented Aug 10, 2025

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:

  • Add a ServiceContainer and ServiceRegistry for dependency injection with IBotService, IConfigService, and IDatabaseService protocols
  • Introduce SentryManager to centralize Sentry SDK initialization, event capturing, before‐send filtering, and performance tracing
  • Implement BaseCog to automatically inject services into cogs

Enhancements:

  • Migrate build system and dependency management from Poetry to Uv (Hatchling) and update pyproject.toml accordingly
  • Reorganize code layout under src/tux with separate core, services, shared, modules, and custom_modules packages
  • Replace manual Sentry calls and inline spans with decorators and context managers for automatic command and span instrumentation

Build:

  • Switch build backend to Hatchling, add uv.lock, and configure project scripts for Uv CLI

CI:

  • Update GitHub workflows to install and use Uv, adjust cache keys, and replace Poetry commands with Uv equivalents

Documentation:

  • Revise README, CONTRIBUTING, docs content, and Docker guides to reference Uv instead of Poetry
  • Update test documentation to include unit/integration/e2e markers, network blocking, and deterministic environment setup

Tests:

  • Enhance pytest configuration with --run-integration, --run-e2e, and --allow-network flags
  • Block outbound network by default for unit tests and better isolate filesystem using tmp_path

Chores:

  • Bump project version to 0.1.0 across pyproject.toml and metadata files

@kzndotsh kzndotsh changed the title V0.1.0 DRAFT: v0.1.0 Aug 10, 2025
Copy link

cloudflare-workers-and-pages bot commented Aug 10, 2025

Deploying tux with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7b79081
Status:🚫  Build failed.

View logs

@kzndotsh kzndotsh self-assigned this Aug 10, 2025
Copy link
Contributor

github-actions bot commented Aug 10, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

@kzndotsh
Copy link
Contributor Author

@sourcery-ai review

@kzndotsh kzndotsh marked this pull request as ready for review August 11, 2025 12:50
Copy link
Contributor

sourcery-ai bot commented Aug 11, 2025

Reviewer's Guide

This PR modernizes the Tux codebase by reorganizing source files under a src/ layout, introducing a dependency injection container for core services, migrating build and dependency tooling from Poetry to Uv/Hatch, centralizing Sentry integration with a dedicated manager and tracing utilities, and enhancing test configuration with pytest fixtures and markers.

Entity relationship diagram for database controller module reorganization

erDiagram
    AfkController ||--o{ DatabaseController : provides
    CaseController ||--o{ DatabaseController : provides
    GuildController ||--o{ DatabaseController : provides
    GuildConfigController ||--o{ DatabaseController : provides
    LevelsController ||--o{ DatabaseController : provides
    NoteController ||--o{ DatabaseController : provides
    ReminderController ||--o{ DatabaseController : provides
    SnippetController ||--o{ DatabaseController : provides
    StarboardController ||--o{ DatabaseController : provides
    StarboardMessageController ||--o{ DatabaseController : provides
    DatabaseController }o--|| IDatabaseService : implements
Loading

Class diagram for Tux bot and dependency injection changes

classDiagram
    class Tux {
        +ServiceContainer container
        +SentryManager sentry_manager
        +EmojiManager emoji_manager
        +DatabaseService db
        +setup()
        +_setup_container()
        +_validate_container()
        +_raise_container_validation_error()
        +_cleanup_container()
    }
    class ServiceContainer {
        +get_optional(interface)
    }
    class ServiceRegistry {
        +configure_container(bot)
        +validate_container(container)
        +get_registered_services(container)
    }
    class SentryManager {
        +setup()
        +capture_exception()
        +finish_transaction_on_error()
        +set_command_context()
        +flush_async()
        +is_initialized
    }
    Tux --> ServiceContainer
    Tux --> SentryManager
    Tux --> EmojiManager
    Tux --> DatabaseService
    ServiceRegistry --> ServiceContainer
    ServiceContainer --> SentryManager
    ServiceContainer --> EmojiManager
    ServiceContainer --> DatabaseService
Loading

Class diagram for ConfigSet* UI views with DI changes

classDiagram
    class ConfigSetPrivateLogs {
        +__init__(timeout, bot, db_service)
        -db: GuildConfigController
    }
    class ConfigSetPublicLogs {
        +__init__(timeout, bot, db_service)
        -db: GuildConfigController
    }
    class ConfigSetChannels {
        +__init__(timeout, bot, db_service)
        -db: GuildConfigController
    }
    class IDatabaseService {
        +get_controller()
    }
    class GuildConfigController {
    }
    ConfigSetPrivateLogs --> IDatabaseService
    ConfigSetPublicLogs --> IDatabaseService
    ConfigSetChannels --> IDatabaseService
    IDatabaseService --> GuildConfigController
Loading

Class diagram for Setup cog refactor to use DI and base class

classDiagram
    class Setup {
        +__init__(bot)
        -config: GuildConfigController
    }
    class BaseCog {
        +__init__(bot)
        -db: IDatabaseService
    }
    class IDatabaseService {
        +get_controller()
    }
    class GuildConfigController {
    }
    Setup --|> BaseCog
    BaseCog --> IDatabaseService
    IDatabaseService --> GuildConfigController
Loading

File-Level Changes

Change Details Files
Migration from Poetry to Uv/Hatch for dependency and build tooling
  • Replaced Poetry configuration in pyproject.toml with Hatch/Uv sections and dependency groups
  • Renamed lock file from poetry.lock to uv.lock and updated related scripts
  • Updated Dockerfile, GitHub Actions, and docker-compose files to install and invoke Uv instead of Poetry
pyproject.toml
Dockerfile
.github/actions/setup-python/action.yml
docker-compose.yml
docker-compose.dev.yml
.github/workflows/tests.yml
.github/workflows/ci.yml
.github/workflows/security.yml
shell.nix
Introduction of dependency injection container and service registry
  • Added ServiceContainer, ServiceDescriptor, and lifetimes in core/container.py
  • Created ServiceRegistry to configure and validate core services
  • Defined service interfaces (core/interfaces.py) and concrete implementations (core/services.py)
  • Extended Bot to initialize and use the container and register services
src/tux/core/container.py
src/tux/core/service_registry.py
src/tux/core/services.py
src/tux/core/interfaces.py
src/tux/core/types.py
src/tux/core/base_cog.py
src/tux/core/bot.py
Project structure reorganization and namespacing
  • Moved code into src/tux/{core,services,shared,modules} hierarchy
  • Renamed tux/cogs to tux/modules and updated CLI, imports, and README paths
  • Consolidated shared utilities under tux/shared, handlers under tux/services/handlers, and tracing under tux/services/tracing
src/tux
README.md
docs/content
tux/cog_loader.py
tests/README.md
Centralized Sentry integration and tracing overhaul
  • Introduced SentryManager for init, context management, and event capturing
  • Created tracing utilities with @transaction/@span decorators and enhanced context managers
  • Replaced inline sentry_sdk calls in error handlers with SentryManager and tracing helpers
  • Added SentryHandler cog for automatic error status and context tagging
src/tux/services/sentry_manager.py
src/tux/services/tracing.py
src/tux/services/handlers/sentry.py
src/tux/services/handlers/error.py
Enhanced pytest configuration and test isolation
  • Added pytest_addoption markers for integration, e2e, and network control
  • Implemented session-wide environment defaults and unit-test filesystem/network isolation
  • Updated tests/README.md with suite structure and CLI commands
  • Configured skip logic for integration/e2e tests and tightened warnings policy
tests/conftest.py
tests/README.md
.pre-commit-config.yaml

Possibly linked issues

  • #1: The PR implements robust error handling, Sentry integration, and a new DI system, all key parts of the v0.1.0 roadmap.
  • #0: PR implements extensive architectural refactor: new src/tux structure, dependency injection, and uv migration, aligning with issue's goals.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @kzndotsh - I've reviewed your changes and they look great!

Blocking issues:

  • By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'. (link)
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `src/tux/services/tracing.py:80` </location>
<code_context>
+# --- Common Helpers ---
+
+
+def safe_set_name(obj: Any, name: str) -> None:
+    """
+    Safely set the name on a span or transaction object.
</code_context>

<issue_to_address>
safe_set_name may fail silently if set_name is not callable.

Add a check to ensure set_name is callable before invoking it to prevent silent failures.
</issue_to_address>

### Comment 2
<location> `src/tux/services/tracing.py:598` </location>
<code_context>
+            raise
+
+
+def instrument_bot_commands(bot: commands.Bot) -> None:
+    """
+    Automatically instruments all bot commands with Sentry transactions.
</code_context>

<issue_to_address>
Instrumenting bot commands by replacing callbacks may interfere with other decorators.

Directly replacing the command callback can disrupt existing decorators or attributes. Using a wrapper or middleware would help maintain original metadata.
</issue_to_address>

### Comment 3
<location> `src/tux/core/container.py:244` </location>
<code_context>
+                return descriptor.instance
+
+        # Create new instance
+        self._resolution_stack.add(service_type)
+
+        try:
</code_context>

<issue_to_address>
Using a set for _resolution_stack may not preserve dependency order for error reporting.

Consider replacing the set with a list or stack to maintain resolution order, which will improve error messages for circular dependencies.

Suggested implementation:

```python
        # Create new instance
        self._resolution_stack.append(service_type)

```

```python
        try:

```

```python
        except Exception as e:
            stack_trace = " -> ".join([t.__name__ for t in self._resolution_stack])
            logger.error(f"Failed to resolve {service_type.__name__}: {e}\nResolution stack: {stack_trace}")
            error_msg = f"Cannot resolve {service_type.__name__} (resolution stack: {stack_trace})"
            raise ServiceResolutionError(error_msg) from e

```

```python
        else:
            resolution_time = time.perf_counter() - start_time
            # Only log if resolution takes longer than expected or fails
            if resolution_time > 0.001:  # Log if takes more than 1ms
                logger.debug(f"Slow resolution: {service_type.__name__} took {resolution_time:.4f}s")
            self._resolution_stack.pop()

```

You will also need to:
1. Change the initialization of `self._resolution_stack` from a set to a list (e.g., `self._resolution_stack = []`).
2. Update any other code that checks membership (`in`) or removes items from `_resolution_stack` to use list semantics.
3. If you have circular dependency checks, you can still use `if service_type in self._resolution_stack:` for lists.
</issue_to_address>

### Comment 4
<location> `src/tux/core/container.py:299` </location>
<code_context>
+            # Resolve the dependency
+            dependency = self._resolve_service(param_type)
+
+            if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
+                if param.default is inspect.Parameter.empty:
+                    args.append(dependency)
+                else:
+                    kwargs[param.name] = dependency
+            elif param.kind == inspect.Parameter.KEYWORD_ONLY:
+                kwargs[param.name] = dependency
+
</code_context>

<issue_to_address>
Does not handle VAR_POSITIONAL or VAR_KEYWORD constructor parameters.

Currently, *args and **kwargs in service constructors are not processed. Please add explicit handling for VAR_POSITIONAL and VAR_KEYWORD parameters, either by raising an error or documenting their unsupported status.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
            # Resolve the dependency
            dependency = self._resolve_service(param_type)

            if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
                if param.default is inspect.Parameter.empty:
                    args.append(dependency)
                else:
                    kwargs[param.name] = dependency
            elif param.kind == inspect.Parameter.KEYWORD_ONLY:
                kwargs[param.name] = dependency
=======
            # Resolve the dependency
            dependency = self._resolve_service(param_type)

            if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
                if param.default is inspect.Parameter.empty:
                    args.append(dependency)
                else:
                    kwargs[param.name] = dependency
            elif param.kind == inspect.Parameter.KEYWORD_ONLY:
                kwargs[param.name] = dependency
            elif param.kind == inspect.Parameter.VAR_POSITIONAL:
                raise ServiceResolutionError(
                    f"Constructor parameter '*{param.name}' in {impl_type.__name__} is not supported by the DI container"
                )
            elif param.kind == inspect.Parameter.VAR_KEYWORD:
                raise ServiceResolutionError(
                    f"Constructor parameter '**{param.name}' in {impl_type.__name__} is not supported by the DI container"
                )
>>>>>>> REPLACE

</suggested_fix>

### Comment 5
<location> `docs/content/dev/local_development.md:37` </location>
<code_context>
 The project includes a hot-reloading utility (`tux/utils/hot_reload.py`).

-When the bot is running locally via `poetry run tux --dev start`, this utility watches for changes in the `tux/cogs/` directory. It attempts to automatically reload modified cogs or cogs affected by changes in watched utility files without requiring a full bot restart.
+When the bot is running locally via `uv run tux --dev start`, this utility watches for changes in the `tux/cogs/` directory. It attempts to automatically reload modified cogs or cogs affected by changes in watched utility files without requiring a full bot restart.

-This significantly speeds up development for cog-related changes. Note that changes outside the watched directories (e.g., core bot logic, dependencies) may still require a manual restart (`Ctrl+C` and run the start command again).
</code_context>

<issue_to_address>
Update directory and terminology to match new module structure.

Please update all directory and terminology references to align with the new module structure for consistency.
</issue_to_address>

## Security Issues

### Issue 1
<location> `Dockerfile:259` </location>

<issue_to_address>
**security (dockerfile.security.missing-user):** By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'.

```suggestion
USER non-root
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"]
```

*Source: opengrep*
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

# --- Common Helpers ---


def safe_set_name(obj: Any, name: str) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): safe_set_name may fail silently if set_name is not callable.

Add a check to ensure set_name is callable before invoking it to prevent silent failures.

raise


def instrument_bot_commands(bot: commands.Bot) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Instrumenting bot commands by replacing callbacks may interfere with other decorators.

Directly replacing the command callback can disrupt existing decorators or attributes. Using a wrapper or middleware would help maintain original metadata.

return descriptor.instance

# Create new instance
self._resolution_stack.add(service_type)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Using a set for _resolution_stack may not preserve dependency order for error reporting.

Consider replacing the set with a list or stack to maintain resolution order, which will improve error messages for circular dependencies.

Suggested implementation:

        # Create new instance
        self._resolution_stack.append(service_type)
        try:
        except Exception as e:
            stack_trace = " -> ".join([t.__name__ for t in self._resolution_stack])
            logger.error(f"Failed to resolve {service_type.__name__}: {e}\nResolution stack: {stack_trace}")
            error_msg = f"Cannot resolve {service_type.__name__} (resolution stack: {stack_trace})"
            raise ServiceResolutionError(error_msg) from e
        else:
            resolution_time = time.perf_counter() - start_time
            # Only log if resolution takes longer than expected or fails
            if resolution_time > 0.001:  # Log if takes more than 1ms
                logger.debug(f"Slow resolution: {service_type.__name__} took {resolution_time:.4f}s")
            self._resolution_stack.pop()

You will also need to:

  1. Change the initialization of self._resolution_stack from a set to a list (e.g., self._resolution_stack = []).
  2. Update any other code that checks membership (in) or removes items from _resolution_stack to use list semantics.
  3. If you have circular dependency checks, you can still use if service_type in self._resolution_stack: for lists.

Comment on lines 296 to 305
# Resolve the dependency
dependency = self._resolve_service(param_type)

if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
if param.default is inspect.Parameter.empty:
args.append(dependency)
else:
kwargs[param.name] = dependency
elif param.kind == inspect.Parameter.KEYWORD_ONLY:
kwargs[param.name] = dependency
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Does not handle VAR_POSITIONAL or VAR_KEYWORD constructor parameters.

Currently, *args and **kwargs in service constructors are not processed. Please add explicit handling for VAR_POSITIONAL and VAR_KEYWORD parameters, either by raising an error or documenting their unsupported status.

Suggested change
# Resolve the dependency
dependency = self._resolve_service(param_type)
if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
if param.default is inspect.Parameter.empty:
args.append(dependency)
else:
kwargs[param.name] = dependency
elif param.kind == inspect.Parameter.KEYWORD_ONLY:
kwargs[param.name] = dependency
# Resolve the dependency
dependency = self._resolve_service(param_type)
if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD:
if param.default is inspect.Parameter.empty:
args.append(dependency)
else:
kwargs[param.name] = dependency
elif param.kind == inspect.Parameter.KEYWORD_ONLY:
kwargs[param.name] = dependency
elif param.kind == inspect.Parameter.VAR_POSITIONAL:
raise ServiceResolutionError(
f"Constructor parameter '*{param.name}' in {impl_type.__name__} is not supported by the DI container"
)
elif param.kind == inspect.Parameter.VAR_KEYWORD:
raise ServiceResolutionError(
f"Constructor parameter '**{param.name}' in {impl_type.__name__} is not supported by the DI container"
)

The project includes a hot-reloading utility (`tux/utils/hot_reload.py`).

When the bot is running locally via `poetry run tux --dev start`, this utility watches for changes in the `tux/cogs/` directory. It attempts to automatically reload modified cogs or cogs affected by changes in watched utility files without requiring a full bot restart.
When the bot is running locally via `uv run tux --dev start`, this utility watches for changes in the `tux/cogs/` directory. It attempts to automatically reload modified cogs or cogs affected by changes in watched utility files without requiring a full bot restart.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Update directory and terminology to match new module structure.

Please update all directory and terminology references to align with the new module structure for consistency.

Dockerfile Outdated
# WORKFLOW: Regenerates Prisma client and starts the bot in development mode
# This ensures the database client is always up-to-date with schema changes
CMD ["sh", "-c", "poetry run prisma generate && exec poetry run tux --dev start"]
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (dockerfile.security.missing-user): By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'.

Suggested change
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"]
USER non-root
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"]

Source: opengrep

Comment on lines 5 to 6
# Keep E2E minimal and deterministic; expand with CLI or HTTP flows later
assert True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Remove assert True statements (remove-assert-true)

Suggested change
# Keep E2E minimal and deterministic; expand with CLI or HTTP flows later
assert True
pass

Comment on lines 5 to 6
# Example of an integration placeholder; expand with real IO later
assert 1 + 1 == 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): We've found these issues:

Suggested change
# Example of an integration placeholder; expand with real IO later
assert 1 + 1 == 2
pass


@pytest.mark.unit
def test_smoke() -> None:
assert True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Remove assert True statements (remove-assert-true)

Suggested change
assert True
pass

sourcery-ai[bot]
sourcery-ai bot previously requested changes Aug 11, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @kzndotsh - I've reviewed your changes and they look great!

Blocking issues:

  • By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'. (link)
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `src/tux/services/sentry_manager.py:582` </location>
<code_context>
+        for key, value in tags.items():
+            scope.set_tag(key, value)
+
+    def set_user_context(self, user: discord.User | discord.Member) -> None:
+        """
+        Sets the user context for the current Sentry scope.
</code_context>

<issue_to_address>
set_user_context may expose sensitive user information.

Review the user and member fields being attached to Sentry to ensure only essential, non-sensitive information is included, particularly for production use.
</issue_to_address>

### Comment 2
<location> `src/tux/core/container.py:57` </location>
<code_context>
+        """Initialize an empty service container."""
+        self._services: dict[type, ServiceDescriptor] = {}
+        self._singleton_instances: dict[type, Any] = {}
+        self._resolution_stack: set[type] = set()
+
+    def register_singleton(self, service_type: type[T], implementation: type[T] | None = None) -> "ServiceContainer":
</code_context>

<issue_to_address>
Using a set for the resolution stack may obscure the actual dependency chain in circular dependency errors.

Using a list for the resolution stack will preserve the order of dependencies, making circular dependency errors easier to trace.

Suggested implementation:

```python
        self._resolution_stack: list[type] = []

```

You will need to update all usages of `_resolution_stack` throughout the file:
- Replace `.add(x)` with `.append(x)`
- Replace `.remove(x)` with `.pop()` (if popping the last item) or `del` (if removing by index)
- If checking for membership, `x in self._resolution_stack` still works
- When reporting circular dependencies, you can now print the stack in order for better error messages
</issue_to_address>

### Comment 3
<location> `src/tux/core/container.py:235` </location>
<code_context>
+        descriptor = self._services[service_type]
+
+        # Return existing instance for singletons
+        if descriptor.lifetime == ServiceLifetime.SINGLETON:
+            if service_type in self._singleton_instances:
+                return self._singleton_instances[service_type]
+
+            # If we have a pre-registered instance, return it
+            if descriptor.instance is not None:
+                return descriptor.instance
+
</code_context>

<issue_to_address>
Singleton instance caching logic may be redundant if both instance and _singleton_instances are used.

Consolidate singleton instance handling to ensure a single source of truth and prevent precedence ambiguity.

Suggested implementation:

```python
        # Return existing instance for singletons
        if descriptor.lifetime == ServiceLifetime.SINGLETON:
            if service_type in self._singleton_instances:
                return self._singleton_instances[service_type]

```

To fully implement this, you must ensure that any pre-registered singleton instance (previously stored in `descriptor.instance`) is instead stored in `_singleton_instances` at registration time. This may require updating your service registration logic elsewhere in the codebase to move any instance assignment to `_singleton_instances`.
</issue_to_address>

### Comment 4
<location> `src/tux/core/context.py:95` </location>
<code_context>
+        A dictionary with standardized context keys like `user_id`,
+        `command_name`, `guild_id`, `command_type`, etc.
+    """
+    user = source.user if isinstance(source, Interaction) else source.author
+
+    # Base context is common to both types
</code_context>

<issue_to_address>
Assumes that both Context and Interaction have user/author attributes, which may not always be true.

Add error handling or a fallback to prevent AttributeError if the expected attribute is missing.
</issue_to_address>

## Security Issues

### Issue 1
<location> `Dockerfile:259` </location>

<issue_to_address>
**security (dockerfile.security.missing-user):** By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'.

```suggestion
USER non-root
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"]
```

*Source: opengrep*
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

for key, value in tags.items():
scope.set_tag(key, value)

def set_user_context(self, user: discord.User | discord.Member) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 suggestion (security): set_user_context may expose sensitive user information.

Review the user and member fields being attached to Sentry to ensure only essential, non-sensitive information is included, particularly for production use.

"""Initialize an empty service container."""
self._services: dict[type, ServiceDescriptor] = {}
self._singleton_instances: dict[type, Any] = {}
self._resolution_stack: set[type] = set()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Using a set for the resolution stack may obscure the actual dependency chain in circular dependency errors.

Using a list for the resolution stack will preserve the order of dependencies, making circular dependency errors easier to trace.

Suggested implementation:

        self._resolution_stack: list[type] = []

You will need to update all usages of _resolution_stack throughout the file:

  • Replace .add(x) with .append(x)
  • Replace .remove(x) with .pop() (if popping the last item) or del (if removing by index)
  • If checking for membership, x in self._resolution_stack still works
  • When reporting circular dependencies, you can now print the stack in order for better error messages

Comment on lines 235 to 240
if descriptor.lifetime == ServiceLifetime.SINGLETON:
if service_type in self._singleton_instances:
return self._singleton_instances[service_type]

# If we have a pre-registered instance, return it
if descriptor.instance is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Singleton instance caching logic may be redundant if both instance and _singleton_instances are used.

Consolidate singleton instance handling to ensure a single source of truth and prevent precedence ambiguity.

Suggested implementation:

        # Return existing instance for singletons
        if descriptor.lifetime == ServiceLifetime.SINGLETON:
            if service_type in self._singleton_instances:
                return self._singleton_instances[service_type]

To fully implement this, you must ensure that any pre-registered singleton instance (previously stored in descriptor.instance) is instead stored in _singleton_instances at registration time. This may require updating your service registration logic elsewhere in the codebase to move any instance assignment to _singleton_instances.

A dictionary with standardized context keys like `user_id`,
`command_name`, `guild_id`, `command_type`, etc.
"""
user = source.user if isinstance(source, Interaction) else source.author
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Assumes that both Context and Interaction have user/author attributes, which may not always be true.

Add error handling or a fallback to prevent AttributeError if the expected attribute is missing.

Dockerfile Outdated
# WORKFLOW: Regenerates Prisma client and starts the bot in development mode
# This ensures the database client is always up-to-date with schema changes
CMD ["sh", "-c", "poetry run prisma generate && exec poetry run tux --dev start"]
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (dockerfile.security.missing-user): By not specifying a USER, a program in the container may run as 'root'. This is a security hazard. If an attacker can control a process running as root, they may have control over the container. Ensure that the last USER in a Dockerfile is a USER other than 'root'.

Suggested change
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"]
USER non-root
CMD ["sh", "-c", "uv run prisma generate && exec uv run tux --dev start"]

Source: opengrep

Comment on lines 5 to 6
# Keep E2E minimal and deterministic; expand with CLI or HTTP flows later
assert True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Remove assert True statements (remove-assert-true)

Suggested change
# Keep E2E minimal and deterministic; expand with CLI or HTTP flows later
assert True
pass

Comment on lines 5 to 6
# Example of an integration placeholder; expand with real IO later
assert 1 + 1 == 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): We've found these issues:

Suggested change
# Example of an integration placeholder; expand with real IO later
assert 1 + 1 == 2
pass


@pytest.mark.unit
def test_smoke() -> None:
assert True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Remove assert True statements (remove-assert-true)

Suggested change
assert True
pass

sourcery-ai[bot]

This comment was marked as resolved.

SourceryAI

This comment was marked as resolved.

@allthingslinux allthingslinux deleted a comment from cursor bot Aug 12, 2025
@kzndotsh kzndotsh requested a review from SourceryAI August 14, 2025 12:35
sourcery-ai[bot]

This comment was marked as resolved.

SourceryAI

This comment was marked as resolved.

@allthingslinux allthingslinux deleted a comment from cursor bot Aug 15, 2025
sourcery-ai[bot]

This comment was marked as resolved.

SourceryAI

This comment was marked as resolved.

Copy link
Contributor

github-actions bot commented Aug 23, 2025

Title Coverage Tests Skipped Failures Errors Time

@allthingslinux allthingslinux deleted a comment from github-actions bot Aug 23, 2025
@allthingslinux allthingslinux deleted a comment from github-actions bot Aug 23, 2025
@allthingslinux allthingslinux deleted a comment from github-actions bot Aug 23, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

ruff

⚠️ [ruff] <F403> reported by reviewdog 🐶
from .fixtures.database_fixtures import * used; unable to detect undefined names

from .fixtures.database_fixtures import * # type: ignore[import-untyped]


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

from .fixtures.database_fixtures import * # type: ignore[import-untyped]


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file

from tux.database.controllers.guild import GuildController


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file

from tux.database.controllers.guild_config import GuildConfigController


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file

import json


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

if any(fixture in item.fixturenames for fixture in ['async_db_service']):


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

elif any(fixture in item.fixturenames for fixture in ['db_session', 'pglite_engine']):


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

elif any(fixture in item.fixturenames for fixture in ['db_session', 'pglite_engine']):


⚠️ [ruff] <F811> reported by reviewdog 🐶
Redefinition of unused pytest_configure from line 44

def pytest_configure(config):


⚠️ [ruff] <SIM102> reported by reviewdog 🐶
Use a single if statement instead of nested if statements

tux/tests/conftest.py

Lines 585 to 586 in 08bde8f

if item.config.getoption("--unit-only"):
if "integration" in [mark.name for mark in item.iter_markers()]:


⚠️ [ruff] <SIM102> reported by reviewdog 🐶
Use a single if statement instead of nested if statements

tux/tests/conftest.py

Lines 589 to 590 in 08bde8f

if not item.config.getoption("--integration"):
if "integration" in [mark.name for mark in item.iter_markers()]:


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

from typing import Any
import pytest
import pytest_asyncio
from sqlmodel import Session
from tux.database.service import DatabaseService
from tux.database.models.models import Guild, GuildConfig


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'config': config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'channel_ids': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'mod_log': TEST_CHANNEL_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'audit_log': TEST_CHANNEL_ID + 1,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'starboard': TEST_CHANNEL_ID + 2,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild': guild,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'config': config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': guild_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

db_session.refresh(data['guild'])


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

db_session.refresh(data['config'])


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guilds': guilds_data,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'total_guilds': len(guilds_data),


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'test_constants': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'base_guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'base_channel_id': TEST_CHANNEL_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild': guild,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'config': config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_controller': async_db_service.guild,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_config_controller': async_db_service.guild_config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'channel_ids': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'mod_log': TEST_CHANNEL_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'audit_log': TEST_CHANNEL_ID + 1,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'starboard': TEST_CHANNEL_ID + 2,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild': guild,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'config': config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'db_service': async_db_service,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'test_constants': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'user_id': TEST_USER_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'channel_id': TEST_CHANNEL_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'moderator_id': TEST_MODERATOR_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild': guild,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'config': config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'session': db_session,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'relationship_data': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_to_config': guild.guild_id == config.guild_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'log_channels': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'mod_log_id': config.mod_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'audit_log_id': config.audit_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'join_log_id': config.join_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'private_log_id': config.private_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'report_log_id': config.report_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'dev_log_id': config.dev_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild': guild,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'config': config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'db_service': async_db_service,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'relationship_data': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_to_config': guild.guild_id == config.guild_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'log_channels': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'mod_log_id': config.mod_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'audit_log_id': config.audit_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'join_log_id': config.join_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'private_log_id': config.private_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'report_log_id': config.report_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'dev_log_id': config.dev_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'invalid_guild_id': 999999999999999999, # Non-existent guild


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'valid_guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'test_prefix': "!invalid",


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_config_controller': async_db_service.guild_config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'invalid_guild_id': 999999999999999999, # Non-existent guild


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'valid_guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'test_prefix': "!invalid",


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(guild, 'guild_id') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(guild, 'case_count') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(guild, 'guild_joined_at') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(config, 'guild_id') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(config, 'prefix') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guilds': guilds,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'configs': configs,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'session': db_session,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guilds': guilds,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'configs': configs,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'db_service': async_db_service,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'case_count': 0,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_joined_at': None,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'mod_log_id': TEST_CHANNEL_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'audit_log_id': TEST_CHANNEL_ID + 1,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'starboard_channel_id': TEST_CHANNEL_ID + 2,


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from collections.abc import Generator
from sqlalchemy.orm import Session, sessionmaker
from sqlalchemy.engine import Engine
from py_pglite.config import PGliteConfig
from py_pglite.sqlalchemy import SQLAlchemyPGliteManager
from tux.database.controllers import (
GuildController, GuildConfigController,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from sqlalchemy.engine import Engine
from sqlalchemy import text
from tux.database.service import DatabaseService
from tux.database.controllers import (
GuildController, GuildConfigController,
)
from tux.database.models import Guild


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file

import urllib.parse


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

if socket_path := query_params.get('host', [''])[0]:


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

if socket_path := query_params.get('host', [''])[0]:


⚠️ [ruff] <SIM105> reported by reviewdog 🐶
Use contextlib.suppress(Exception) instead of try-except-pass

try:
await guild_controller.create_guild(guild_id=TEST_GUILD_ID)
# If we get here, the service should handle disconnection gracefully
except Exception:
# Expected when not connected
pass


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from datetime import datetime
from typing import Any
from sqlalchemy import text
from sqlmodel import desc
from sqlmodel import Session, select
from tux.database.models.models import Guild, GuildConfig, CaseType, Case
from tests.fixtures.database_fixtures import (
validate_guild_structure,
validate_guild_config_structure,
validate_relationship_integrity,
TEST_GUILD_ID,
TEST_CHANNEL_ID,
)


⚠️ [ruff] <B017> reported by reviewdog 🐶
Do not assert blind exception: Exception

with pytest.raises(Exception): # SQLAlchemy integrity error


⚠️ [ruff] <B017> reported by reviewdog 🐶
Do not assert blind exception: Exception

with pytest.raises(Exception): # Unique constraint violation


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in guild_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'case_count' in guild_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_joined_at' in guild_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert guild_dict['guild_id'] == sample_guild.guild_id


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert guild_dict['case_count'] == sample_guild.case_count


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in config_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'prefix' in config_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert config_dict['guild_id'] == sample_guild_config.guild_id


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert config_dict['prefix'] == sample_guild_config.prefix


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert case_dict['case_type'] == CaseType.WARN.name # Should be enum name


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

guilds_data: list[dict[str, Any]] = populated_test_database['guilds']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

guild_dict = data['guild'].to_dict() # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

config_dict = data['config'].to_dict() # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert len(results) == populated_test_database['total_guilds'] # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild' in result


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'config' in result


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['guild']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['guild']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['config']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['config']


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from sqlmodel import Session
from tux.database.models.models import Guild, GuildConfig, CaseType, Case
from tests.fixtures.database_fixtures import TEST_GUILD_ID


⚠️ [ruff] <PERF401> reported by reviewdog 🐶
Use a list comprehension to create a transformed list

guild_data.append({
"guild_id": TEST_GUILD_ID + 100 + i,
"case_count": i,
"tags": [f"tag_{i}", "common_tag"],
"guild_metadata": {"batch_id": 1, "index": i},
"feature_flags": {"active": i % 2 == 0},
})


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from sqlalchemy import text
from sqlmodel import SQLModel, Session, select
from tux.database.models.models import Guild, GuildConfig
from tux.database.service import DatabaseService


⚠️ [ruff] <F401> reported by reviewdog 🐶
sqlmodel.SQLModel imported but unused

from sqlmodel import SQLModel, Session, select


⚠️ [ruff] <B017> reported by reviewdog 🐶
Do not assert blind exception: Exception

with pytest.raises(Exception): # SQLAlchemy integrity error


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file

from sqlalchemy.orm import selectinload


⚠️ [ruff] <F401> reported by reviewdog 🐶
sqlalchemy.orm.selectinload imported but unused

from sqlalchemy.orm import selectinload

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

ruff

⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'config': config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_controller': async_db_service.guild,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_config_controller': async_db_service.guild_config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'channel_ids': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'mod_log': TEST_CHANNEL_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'audit_log': TEST_CHANNEL_ID + 1,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'starboard': TEST_CHANNEL_ID + 2,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild': guild,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'config': config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'db_service': async_db_service,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'test_constants': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'user_id': TEST_USER_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'channel_id': TEST_CHANNEL_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'moderator_id': TEST_MODERATOR_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild': guild,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'config': config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'session': db_session,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'relationship_data': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_to_config': guild.guild_id == config.guild_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'log_channels': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'mod_log_id': config.mod_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'audit_log_id': config.audit_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'join_log_id': config.join_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'private_log_id': config.private_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'report_log_id': config.report_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'dev_log_id': config.dev_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild': guild,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'config': config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'db_service': async_db_service,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'relationship_data': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_to_config': guild.guild_id == config.guild_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'log_channels': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'mod_log_id': config.mod_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'audit_log_id': config.audit_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'join_log_id': config.join_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'private_log_id': config.private_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'report_log_id': config.report_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'dev_log_id': config.dev_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'invalid_guild_id': 999999999999999999, # Non-existent guild


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'valid_guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'test_prefix': "!invalid",


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_config_controller': async_db_service.guild_config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'invalid_guild_id': 999999999999999999, # Non-existent guild


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'valid_guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'test_prefix': "!invalid",


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(guild, 'guild_id') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(guild, 'case_count') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(guild, 'guild_joined_at') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(config, 'guild_id') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(config, 'prefix') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guilds': guilds,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'configs': configs,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'session': db_session,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guilds': guilds,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'configs': configs,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'db_service': async_db_service,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'case_count': 0,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_joined_at': None,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'mod_log_id': TEST_CHANNEL_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'audit_log_id': TEST_CHANNEL_ID + 1,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'starboard_channel_id': TEST_CHANNEL_ID + 2,


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from collections.abc import Generator
from sqlalchemy.orm import Session, sessionmaker
from sqlalchemy.engine import Engine
from py_pglite.config import PGliteConfig
from py_pglite.sqlalchemy import SQLAlchemyPGliteManager
from tux.database.controllers import (
GuildController, GuildConfigController,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from sqlalchemy.engine import Engine
from sqlalchemy import text
from tux.database.service import DatabaseService
from tux.database.controllers import (
GuildController, GuildConfigController,
)
from tux.database.models import Guild


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file

import urllib.parse


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

if socket_path := query_params.get('host', [''])[0]:


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

if socket_path := query_params.get('host', [''])[0]:


⚠️ [ruff] <SIM105> reported by reviewdog 🐶
Use contextlib.suppress(Exception) instead of try-except-pass

try:
await guild_controller.create_guild(guild_id=TEST_GUILD_ID)
# If we get here, the service should handle disconnection gracefully
except Exception:
# Expected when not connected
pass


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from datetime import datetime
from typing import Any
from sqlalchemy import text
from sqlmodel import desc
from sqlmodel import Session, select
from tux.database.models.models import Guild, GuildConfig, CaseType, Case
from tests.fixtures.database_fixtures import (
validate_guild_structure,
validate_guild_config_structure,
validate_relationship_integrity,
TEST_GUILD_ID,
TEST_CHANNEL_ID,
)


⚠️ [ruff] <B017> reported by reviewdog 🐶
Do not assert blind exception: Exception

with pytest.raises(Exception): # SQLAlchemy integrity error


⚠️ [ruff] <B017> reported by reviewdog 🐶
Do not assert blind exception: Exception

with pytest.raises(Exception): # Unique constraint violation


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in guild_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'case_count' in guild_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_joined_at' in guild_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert guild_dict['guild_id'] == sample_guild.guild_id


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert guild_dict['case_count'] == sample_guild.case_count


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in config_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'prefix' in config_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert config_dict['guild_id'] == sample_guild_config.guild_id


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert config_dict['prefix'] == sample_guild_config.prefix


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert case_dict['case_type'] == CaseType.WARN.name # Should be enum name


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

guilds_data: list[dict[str, Any]] = populated_test_database['guilds']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

guild_dict = data['guild'].to_dict() # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

config_dict = data['config'].to_dict() # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert len(results) == populated_test_database['total_guilds'] # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild' in result


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'config' in result


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['guild']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['guild']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['config']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['config']


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from sqlmodel import Session
from tux.database.models.models import Guild, GuildConfig, CaseType, Case
from tests.fixtures.database_fixtures import TEST_GUILD_ID


⚠️ [ruff] <PERF401> reported by reviewdog 🐶
Use a list comprehension to create a transformed list

guild_data.append({
"guild_id": TEST_GUILD_ID + 100 + i,
"case_count": i,
"tags": [f"tag_{i}", "common_tag"],
"guild_metadata": {"batch_id": 1, "index": i},
"feature_flags": {"active": i % 2 == 0},
})


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from sqlalchemy import text
from sqlmodel import SQLModel, Session, select
from tux.database.models.models import Guild, GuildConfig
from tux.database.service import DatabaseService


⚠️ [ruff] <F401> reported by reviewdog 🐶
sqlmodel.SQLModel imported but unused

from sqlmodel import SQLModel, Session, select


⚠️ [ruff] <B017> reported by reviewdog 🐶
Do not assert blind exception: Exception

with pytest.raises(Exception): # SQLAlchemy integrity error


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file

from sqlalchemy.orm import selectinload


⚠️ [ruff] <F401> reported by reviewdog 🐶
sqlalchemy.orm.selectinload imported but unused

from sqlalchemy.orm import selectinload

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

ruff

⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'db_service': async_db_service,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'relationship_data': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_to_config': guild.guild_id == config.guild_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'log_channels': {


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'mod_log_id': config.mod_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'audit_log_id': config.audit_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'join_log_id': config.join_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'private_log_id': config.private_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'report_log_id': config.report_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'dev_log_id': config.dev_log_id,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'invalid_guild_id': 999999999999999999, # Non-existent guild


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'valid_guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'test_prefix': "!invalid",


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_config_controller': async_db_service.guild_config,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'invalid_guild_id': 999999999999999999, # Non-existent guild


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'valid_guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'test_prefix': "!invalid",


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(guild, 'guild_id') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(guild, 'case_count') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(guild, 'guild_joined_at') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(config, 'guild_id') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

hasattr(config, 'prefix') and


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guilds': guilds,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'configs': configs,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'session': db_session,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guilds': guilds,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'configs': configs,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'db_service': async_db_service,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'case_count': 0,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_joined_at': None,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'mod_log_id': TEST_CHANNEL_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'audit_log_id': TEST_CHANNEL_ID + 1,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'starboard_channel_id': TEST_CHANNEL_ID + 2,


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from collections.abc import Generator
from sqlalchemy.orm import Session, sessionmaker
from sqlalchemy.engine import Engine
from py_pglite.config import PGliteConfig
from py_pglite.sqlalchemy import SQLAlchemyPGliteManager
from tux.database.controllers import (
GuildController, GuildConfigController,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from sqlalchemy.engine import Engine
from sqlalchemy import text
from tux.database.service import DatabaseService
from tux.database.controllers import (
GuildController, GuildConfigController,
)
from tux.database.models import Guild


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file

import urllib.parse


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

if socket_path := query_params.get('host', [''])[0]:


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

if socket_path := query_params.get('host', [''])[0]:


⚠️ [ruff] <SIM105> reported by reviewdog 🐶
Use contextlib.suppress(Exception) instead of try-except-pass

try:
await guild_controller.create_guild(guild_id=TEST_GUILD_ID)
# If we get here, the service should handle disconnection gracefully
except Exception:
# Expected when not connected
pass


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from datetime import datetime
from typing import Any
from sqlalchemy import text
from sqlmodel import desc
from sqlmodel import Session, select
from tux.database.models.models import Guild, GuildConfig, CaseType, Case
from tests.fixtures.database_fixtures import (
validate_guild_structure,
validate_guild_config_structure,
validate_relationship_integrity,
TEST_GUILD_ID,
TEST_CHANNEL_ID,
)


⚠️ [ruff] <B017> reported by reviewdog 🐶
Do not assert blind exception: Exception

with pytest.raises(Exception): # SQLAlchemy integrity error


⚠️ [ruff] <B017> reported by reviewdog 🐶
Do not assert blind exception: Exception

with pytest.raises(Exception): # Unique constraint violation


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in guild_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'case_count' in guild_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_joined_at' in guild_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert guild_dict['guild_id'] == sample_guild.guild_id


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert guild_dict['case_count'] == sample_guild.case_count


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in config_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'prefix' in config_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert config_dict['guild_id'] == sample_guild_config.guild_id


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert config_dict['prefix'] == sample_guild_config.prefix


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert case_dict['case_type'] == CaseType.WARN.name # Should be enum name


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

guilds_data: list[dict[str, Any]] = populated_test_database['guilds']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

guild_dict = data['guild'].to_dict() # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

config_dict = data['config'].to_dict() # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert len(results) == populated_test_database['total_guilds'] # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild' in result


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'config' in result


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['guild']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['guild']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['config']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['config']


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from sqlmodel import Session
from tux.database.models.models import Guild, GuildConfig, CaseType, Case
from tests.fixtures.database_fixtures import TEST_GUILD_ID


⚠️ [ruff] <PERF401> reported by reviewdog 🐶
Use a list comprehension to create a transformed list

guild_data.append({
"guild_id": TEST_GUILD_ID + 100 + i,
"case_count": i,
"tags": [f"tag_{i}", "common_tag"],
"guild_metadata": {"batch_id": 1, "index": i},
"feature_flags": {"active": i % 2 == 0},
})


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from sqlalchemy import text
from sqlmodel import SQLModel, Session, select
from tux.database.models.models import Guild, GuildConfig
from tux.database.service import DatabaseService


⚠️ [ruff] <F401> reported by reviewdog 🐶
sqlmodel.SQLModel imported but unused

from sqlmodel import SQLModel, Session, select


⚠️ [ruff] <B017> reported by reviewdog 🐶
Do not assert blind exception: Exception

with pytest.raises(Exception): # SQLAlchemy integrity error


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file

from sqlalchemy.orm import selectinload


⚠️ [ruff] <F401> reported by reviewdog 🐶
sqlalchemy.orm.selectinload imported but unused

from sqlalchemy.orm import selectinload

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

ruff

⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'case_count': 0,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_joined_at': None,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'guild_id': TEST_GUILD_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'mod_log_id': TEST_CHANNEL_ID,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'audit_log_id': TEST_CHANNEL_ID + 1,


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

'starboard_channel_id': TEST_CHANNEL_ID + 2,


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from collections.abc import Generator
from sqlalchemy.orm import Session, sessionmaker
from sqlalchemy.engine import Engine
from py_pglite.config import PGliteConfig
from py_pglite.sqlalchemy import SQLAlchemyPGliteManager
from tux.database.controllers import (
GuildController, GuildConfigController,
)


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from sqlalchemy.engine import Engine
from sqlalchemy import text
from tux.database.service import DatabaseService
from tux.database.controllers import (
GuildController, GuildConfigController,
)
from tux.database.models import Guild


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file

import urllib.parse


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

if socket_path := query_params.get('host', [''])[0]:


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

if socket_path := query_params.get('host', [''])[0]:


⚠️ [ruff] <SIM105> reported by reviewdog 🐶
Use contextlib.suppress(Exception) instead of try-except-pass

try:
await guild_controller.create_guild(guild_id=TEST_GUILD_ID)
# If we get here, the service should handle disconnection gracefully
except Exception:
# Expected when not connected
pass


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from datetime import datetime
from typing import Any
from sqlalchemy import text
from sqlmodel import desc
from sqlmodel import Session, select
from tux.database.models.models import Guild, GuildConfig, CaseType, Case
from tests.fixtures.database_fixtures import (
validate_guild_structure,
validate_guild_config_structure,
validate_relationship_integrity,
TEST_GUILD_ID,
TEST_CHANNEL_ID,
)


⚠️ [ruff] <B017> reported by reviewdog 🐶
Do not assert blind exception: Exception

with pytest.raises(Exception): # SQLAlchemy integrity error


⚠️ [ruff] <B017> reported by reviewdog 🐶
Do not assert blind exception: Exception

with pytest.raises(Exception): # Unique constraint violation


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in guild_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'case_count' in guild_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_joined_at' in guild_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert guild_dict['guild_id'] == sample_guild.guild_id


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert guild_dict['case_count'] == sample_guild.case_count


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in config_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'prefix' in config_dict


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert config_dict['guild_id'] == sample_guild_config.guild_id


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert config_dict['prefix'] == sample_guild_config.prefix


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert case_dict['case_type'] == CaseType.WARN.name # Should be enum name


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

guilds_data: list[dict[str, Any]] = populated_test_database['guilds']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

guild_dict = data['guild'].to_dict() # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

config_dict = data['config'].to_dict() # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

results.append({'guild': guild_dict, 'config': config_dict}) # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert len(results) == populated_test_database['total_guilds'] # type: ignore


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild' in result


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'config' in result


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['guild']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['guild']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['config']


⚠️ [ruff] <Q000> reported by reviewdog 🐶
Single quotes found but double quotes preferred

assert 'guild_id' in result['config']


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from sqlmodel import Session
from tux.database.models.models import Guild, GuildConfig, CaseType, Case
from tests.fixtures.database_fixtures import TEST_GUILD_ID


⚠️ [ruff] <PERF401> reported by reviewdog 🐶
Use a list comprehension to create a transformed list

guild_data.append({
"guild_id": TEST_GUILD_ID + 100 + i,
"case_count": i,
"tags": [f"tag_{i}", "common_tag"],
"guild_metadata": {"batch_id": 1, "index": i},
"feature_flags": {"active": i % 2 == 0},
})


⚠️ [ruff] <I001> reported by reviewdog 🐶
Import block is un-sorted or un-formatted

import pytest
from sqlalchemy import text
from sqlmodel import SQLModel, Session, select
from tux.database.models.models import Guild, GuildConfig
from tux.database.service import DatabaseService


⚠️ [ruff] <F401> reported by reviewdog 🐶
sqlmodel.SQLModel imported but unused

from sqlmodel import SQLModel, Session, select


⚠️ [ruff] <B017> reported by reviewdog 🐶
Do not assert blind exception: Exception

with pytest.raises(Exception): # SQLAlchemy integrity error


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file


⚠️ [ruff] <PLC0415> reported by reviewdog 🐶
import should be at the top-level of a file

from sqlalchemy.orm import selectinload


⚠️ [ruff] <F401> reported by reviewdog 🐶
sqlalchemy.orm.selectinload imported but unused

from sqlalchemy.orm import selectinload

kzndotsh and others added 30 commits October 19, 2025 01:18
…ctions

This commit updates the README.md to enhance the layout of the metrics and contributors sections by centering headings and images, and adding small captions for better presentation. The overall structure is refined to improve readability and visual appeal.
…ontributors sections

This commit modifies the README.md to change the alignment of headings and captions in the metrics and contributors sections from center to left and right, respectively. These adjustments aim to enhance the overall readability and presentation of the documentation.
This commit modifies the README.md to change the headings from h3 to h2 in the metrics and contributors sections, and updates the captions from "Made with" to "via" for better consistency and clarity in presentation.
…ed configurations

This commit renames the Dockerfile to Containerfile and updates all references in configuration files, CI workflows, and scripts accordingly. Additionally, a new compose.yaml file is introduced to replace the previous docker-compose.yml format. The Python version is also updated to 3.13.8 across relevant files.
This commit adds the Containerfile to the hadolint configuration in the CI workflow, ensuring that linting checks are applied to the newly renamed file. This change aligns the CI process with recent updates to the project's container management.
This commit modifies the GitHub Actions workflow for Docker to refine the conditions under which the validation job runs, ensuring it triggers correctly for pull requests. Additionally, it updates the build settings to load the Docker image during validation and adjusts the target for the Trivy scan to use the output tags, enhancing the overall CI process for container management.
… controller initialization

This commit refines the database service architecture by consolidating the DatabaseService and AsyncDatabaseService into a single class, improving clarity and maintainability. It also updates the BaseController to implement lazy initialization for specialized controllers, optimizing resource usage. Additionally, the documentation within the code has been enhanced for better understanding of the database service functionalities.
This commit enhances the unload_if_missing_config method in BaseCog to provide clearer logging and better handling of missing configurations. It updates the documentation to reflect the new behavior, ensuring that cogs can exit early during initialization if required configurations are absent. Additionally, it modifies the logging messages to include visual indicators for warnings and errors, improving the overall clarity of the logs. The cog_loader and flags modules are also updated to use constants directly, enhancing code consistency.
…s and delete timing

This commit updates the help components to use specific constants for embed colors and delete timing, improving code clarity and maintainability. The changes involve replacing references to the CONST module with direct imports of EMBED_COLORS and DEFAULT_DELETE_AFTER, ensuring a more consistent approach to managing these values across the help system.
…nctionality

This commit introduces several new features to the Tux Bot, including a Bookmark service for managing important messages, a GIF limiter to control GIF posting rates, an InfluxDB logger for performance metrics, a Levels service for XP tracking, a Starboard for highlighting popular messages, Status Roles for automatic role assignment based on user status, and a Temp VC service for managing temporary voice channels. Each service is designed to improve user experience and enhance community engagement within Discord servers.
…ocumentation

This commit refines the ModerationCogBase class by implementing a factory pattern for service initialization, eliminating the need for asynchronous setup and preventing duplicate service creation. Additionally, it enhances method documentation with detailed parameter descriptions and return types, improving clarity and maintainability of the moderation functionalities.
… for improved clarity

This commit updates various modules to replace references to the CONST module with specific constants, enhancing code readability and maintainability. The changes include adjustments in the Random, Avatar, Info, Moderation, and Snippets modules, ensuring a more consistent approach to managing constants across the codebase.
…D_ICONS for improved clarity

This commit updates the EmbedCreator class to utilize specific constants for embed colors and icons, enhancing code readability and maintainability. The changes ensure a consistent approach to managing embed settings across the application.
…guration sources

This commit refactors the configuration loaders by introducing an abstract base class, FileConfigSource, which consolidates common functionality for loading configuration from TOML, YAML, and JSON files. The individual loaders (TomlConfigSource, YamlConfigSource, JsonConfigSource) are updated to inherit from this base class, streamlining the parsing logic and enhancing code maintainability. Additionally, references to the CONST module are replaced with specific constants for improved clarity in settings management.
…for improved clarity

This commit updates the Mail class to replace the CONST.HTTP_OK reference with the specific HTTP_OK constant, enhancing code readability and maintainability. This change aligns with previous updates aimed at using specific constants throughout the codebase for better clarity in handling HTTP status codes.
…s for improved clarity

This commit updates the HotReloadConfig class to replace references to the CONST module with specific constants for reload timeout, maximum dependency depth, and dependency cache size. This change enhances code readability and maintainability, aligning with the ongoing effort to use specific constants throughout the codebase.
…zed service creation

This commit adds a new ModerationServiceFactory to streamline the creation of moderation service instances, ensuring consistent dependency injection across moderation cogs. Additionally, it updates the CommunicationService to use specific embed colors instead of the CONST module, enhancing code clarity and maintainability. The __all__ list in the __init__.py file is also updated to include the new factory.
… constants for improved clarity

This commit updates the Godbolt service wrapper to replace references to the CONST module with specific constants for HTTP_OK and HTTP_NOT_FOUND. This change enhances code readability and maintainability, aligning with the ongoing effort to use specific constants throughout the codebase for better clarity in handling HTTP responses.
… for HTTP client service

This commit improves the HTTP client service by expanding the module and class docstrings to provide detailed information on lifecycle management, usage examples, configuration, and thread safety. The changes clarify the singleton pattern implementation, lazy initialization, and resource cleanup during bot shutdown. Additionally, the request methods are documented with examples and error handling details, enhancing overall code readability and maintainability.
…rity and maintainability

This commit refactors the constants module by introducing a structured organization of constants into categories such as embed colors, icons, interaction limits, and API URLs. The __all__ attribute is updated to include all public constants, enhancing code readability and maintainability. Additionally, specific constants for various functionalities are defined, ensuring a consistent approach to managing configuration values across the codebase.
…eService for consistency

This commit updates the test fixtures and integration tests to use DatabaseService instead of AsyncDatabaseService, ensuring consistency across the codebase. The changes enhance clarity in service initialization and align with the ongoing refactor to streamline database service usage.
This commit refactors the jail functionality by simplifying the role management process and enhancing error handling. The code now uses a more straightforward approach to add the jail role and remove old roles, ensuring that exceptions are logged and handled gracefully. This improves clarity and maintainability of the moderation logic.
…odules

This commit introduces the loguru logging library into multiple modules, enhancing the logging capabilities for debugging and monitoring. Key changes include the addition of debug and info logs in the TuxFlagConverter, BulkOperationsController, QueryController, and various cogs, providing better insights into operations and error handling. This improvement aims to facilitate easier troubleshooting and improve overall maintainability of the codebase.
This commit introduces a comprehensive suite of integration tests for the jail and unjail system. The tests cover role management logic, database operations for storing and retrieving jail cases, and role restoration during unjail. Key functionalities tested include filtering manageable roles, creating and retrieving jail cases, and handling edge cases related to role metadata. This enhancement aims to ensure the reliability and correctness of the jail system's functionality.
This commit refines the logging setup across the application by integrating a more structured configuration approach using loguru. Key changes include the addition of environment-based log level settings, improved logging for third-party libraries, and enhanced formatting for log messages. The logging configuration is now centralized, allowing for better control over log levels and output formatting, which aims to improve debugging and monitoring capabilities throughout the codebase.
This commit simplifies the logging configuration by removing the debug mode verification details and associated logging statements. The changes streamline the logging setup, enhancing clarity and maintainability without compromising functionality.
This commit updates the `_run_tool_command` method in the DevCLI class to include an optional parameter for printing stderr output on successful command execution. Additionally, the docstring coverage command is modified to run with verbose output, improving the visibility of potential issues during execution. These changes aim to enhance the debugging experience and provide clearer feedback during tool command operations.
This commit enhances the documentation for various functions and classes by replacing "Args" with "Parameters" and providing clearer descriptions of each parameter's type and purpose. The changes aim to improve code readability and maintainability, ensuring that the documentation accurately reflects the expected inputs for each method. Additionally, new configuration options are added to the `pyproject.toml` for improved linting and type checking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants