Skip to content

LCORE-825: fixed new bug found by Pylint#667

Merged
tisnik merged 1 commit intolightspeed-core:mainfrom
tisnik:lcore-825-fixed-new-bug-found-by-pylint
Oct 14, 2025
Merged

LCORE-825: fixed new bug found by Pylint#667
tisnik merged 1 commit intolightspeed-core:mainfrom
tisnik:lcore-825-fixed-new-bug-found-by-pylint

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Oct 14, 2025

Description

LCORE-825: fixed new bug found by Pylint

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement

Related Tickets & Documents

  • Related Issue #LCORE-825

Summary by CodeRabbit

  • Refactor

    • Standardized internal naming within the database layer for consistency. No functional or behavioral changes for end-users.
  • Tests

    • Updated unit tests to align with the internal naming adjustments, ensuring coverage and reliability remain intact.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

Walkthrough

Renamed the database session factory variable from SessionLocal to session_local across the codebase and updated all references in the database module and its unit tests. No logic or control-flow changes.

Changes

Cohort / File(s) Summary of Changes
Database session factory rename
src/app/database.py
Renamed exported variable SessionLocalsession_local; updated get_session, initialize_database, and global assignment to use session_local.
Unit tests update
tests/unit/app/test_database.py
Updated all references from database.SessionLocal to database.session_local, including fixtures, mocks, and assertions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my nose at names anew,
Hop-hop through code, a tidy view—
SessionLocal hops to ground,
session_local now is found.
Carrots counted, tests all pass,
Renames crisp as morning grass. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title “LCORE-825: fixed new bug found by Pylint” is overly generic and does not convey the specific change made, which was renaming the SessionLocal variable to session_local to satisfy Pylint naming rules; it fails to clearly summarize the main modification. Please revise the title to explicitly describe the change, for example “Rename SessionLocal to session_local for Pylint naming compliance (LCORE-825)”, so that its purpose is clear at a glance.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between acd13d2 and 5ca66d7.

📒 Files selected for processing (2)
  • src/app/database.py (4 hunks)
  • tests/unit/app/test_database.py (4 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
src/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

Use absolute imports for internal modules (e.g., from auth import get_auth_dependency)

Files:

  • src/app/database.py
src/app/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

Use standard FastAPI imports (from fastapi import APIRouter, HTTPException, Request, status, Depends) in FastAPI app code

Files:

  • src/app/database.py
**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.py: All modules start with descriptive module-level docstrings explaining purpose
Use logger = logging.getLogger(name) for module logging after import logging
Define type aliases at module level for clarity
All functions require docstrings with brief descriptions
Provide complete type annotations for all function parameters and return types
Use typing_extensions.Self in model validators where appropriate
Use modern union syntax (str | int) and Optional[T] or T | None consistently
Function names use snake_case with descriptive, action-oriented prefixes (get_, validate_, check_)
Avoid in-place parameter modification; return new data structures instead of mutating arguments
Use appropriate logging levels: debug, info, warning, error with clear messages
All classes require descriptive docstrings explaining purpose
Class names use PascalCase with conventional suffixes (Configuration, Error/Exception, Resolver, Interface)
Abstract base classes should use abc.ABC and @AbstractMethod for interfaces
Provide complete type annotations for all class attributes
Follow Google Python docstring style for modules, classes, and functions, including Args, Returns, Raises, Attributes sections as needed

Files:

  • src/app/database.py
  • tests/unit/app/test_database.py
src/{app/**/*.py,client.py}

📄 CodeRabbit inference engine (CLAUDE.md)

Use async def for I/O-bound operations and external API calls

Files:

  • src/app/database.py
tests/{unit,integration}/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

tests/{unit,integration}/**/*.py: Use pytest for all unit and integration tests
Do not use unittest in tests; pytest is the standard

Files:

  • tests/unit/app/test_database.py
tests/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

tests/**/*.py: Use pytest-mock to create AsyncMock objects for async interactions in tests
Use the shared auth mock constant: MOCK_AUTH = ("mock_user_id", "mock_username", False, "mock_token") in tests

Files:

  • tests/unit/app/test_database.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build-pr
  • GitHub Check: e2e_tests (azure)
  • GitHub Check: e2e_tests (ci)
🔇 Additional comments (2)
tests/unit/app/test_database.py (1)

19-19: LGTM! Test references correctly updated.

All test references to the renamed variable are consistent with the change in src/app/database.py. The fixture properly handles state management, and assertions verify the correct attribute.

Also applies to: 23-23, 29-29, 75-75, 84-84, 260-260

src/app/database.py (1)

17-17: Approve rename of SessionLocal to snake_case
No remaining references to SessionLocal found; safe to merge.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tisnik tisnik merged commit 87f933f into lightspeed-core:main Oct 14, 2025
18 of 20 checks passed
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.

1 participant