Skip to content

LCORE-1431: fixed new linter errors#1287

Merged
tisnik merged 3 commits intolightspeed-core:mainfrom
tisnik:lcore-1431-fixed-new-linter-errors
Mar 8, 2026
Merged

LCORE-1431: fixed new linter errors#1287
tisnik merged 3 commits intolightspeed-core:mainfrom
tisnik:lcore-1431-fixed-new-linter-errors

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Mar 8, 2026

Description

LCORE-1431: fixed new linter errors

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
  • Benchmarks improvement

Tools used to create PR

  • Assisted-by: N/A
  • Generated by: N/A

Related Tickets & Documents

  • Related Issue #LCORE-1431

Summary by CodeRabbit

  • Chores
    • Updated type import usage project-wide to follow current Python standard-library conventions, improving consistency and maintainability.
    • Adjusted linting configuration to include an additional rule that enforces modern type annotation practices for more consistent code quality.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6b4a4d34-ad2f-4636-a67c-04092a3d9f77

📥 Commits

Reviewing files that changed from the base of the PR and between b4468ca and 748dd3f.

📒 Files selected for processing (4)
  • pyproject.toml
  • src/app/endpoints/a2a.py
  • src/models/config.py
  • tests/integration/endpoints/test_streaming_query_integration.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • pyproject.toml
  • src/app/endpoints/a2a.py

Walkthrough

The PR modernizes type-hint imports across the repository by moving generic types from typing/typing_extensions to collections.abc or re where appropriate, updates Literal/Self imports to typing, and adds UP035 to Ruff lint rules.

Changes

Cohort / File(s) Summary
Ruff Configuration
pyproject.toml
Added UP035 to the enabled lint rules.
Core Application Imports
src/app/endpoints/a2a.py, src/app/endpoints/streaming_query.py, src/app/main.py
Moved AsyncIterator (and MutableMapping where present) import source from typing to collections.abc.
Authentication & Authorization
src/authentication/jwk_token.py, src/authorization/middleware.py
Switched Callable import from typing to collections.abc.
Models and Utilities
src/models/config.py, src/models/requests.py, src/utils/common.py, src/utils/connection_decorator.py
Updated type imports: Pattern moved to re; Literal and Self sourced from typing (removed typing_extensions); moved Callable/Sequence to collections.abc.
Integration Tests
tests/integration/conftest.py, tests/integration/endpoints/test_health_integration.py, tests/integration/endpoints/test_info_integration.py, tests/integration/endpoints/test_model_list.py, tests/integration/endpoints/test_query_integration.py, tests/integration/endpoints/test_root_endpoint.py, tests/integration/endpoints/test_streaming_query_integration.py, tests/integration/endpoints/test_tools_integration.py, tests/integration/test_rh_identity_integration.py
Replaced Generator (and where applicable AsyncIterator) imports from typing with collections.abc.
Unit Tests
tests/unit/a2a_storage/test_storage_factory.py, tests/unit/app/test_database.py, tests/unit/app/test_routers.py, tests/unit/authentication/test_jwk_token.py, tests/unit/authorization/test_azure_token_manager.py, tests/unit/conftest.py, tests/unit/models/rlsapi/test_requests.py, tests/unit/test_configuration.py
Replaced Generator, Callable, and Sequence imports from typing with collections.abc; adjusted annotations where needed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'LCORE-1431: fixed new linter errors' accurately reflects the main objective of the changeset: addressing and fixing new linter errors by migrating imports to use abstract base classes (collections.abc) and enabling a new linter rule (UP035).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/app/endpoints/a2a.py`:
- Around line 6-9: Import symbols from collections.abc in a single grouped
statement: remove the separate imports of Mapping and
AsyncIterator/MutableMapping and replace them with one import like "from
collections.abc import Mapping, AsyncIterator, MutableMapping" so all
collections.abc symbols are grouped; update any references in this module (e.g.,
type annotations or functions that use Mapping, AsyncIterator, MutableMapping)
to use those imported names.

In `@src/models/config.py`:
- Around line 9-10: Consolidate and reorder the typing imports: combine all
`typing` imports into one standard-library import statement (e.g., include Any,
Optional, Literal, Self together) at the top of the file before any third-party
imports; update the import grouping so `from typing import Any, Optional,
Literal, Self` (or equivalent) appears with other stdlib imports and remove the
later `from typing` line referenced by `Literal`/`Self`.

In `@tests/integration/endpoints/test_streaming_query_integration.py`:
- Around line 3-5: Group the two separate imports from collections.abc into a
single import statement: replace the separate lines "from collections.abc import
AsyncIterator" and "from collections.abc import Generator" with one line "from
collections.abc import AsyncIterator, Generator", leaving "from typing import
Any" as-is; update the import ordering if necessary so the three imports remain
consistent and grouped by module.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 51712c47-34f9-4cdb-bf0c-137c502b6060

📥 Commits

Reviewing files that changed from the base of the PR and between 31cb292 and b4468ca.

📒 Files selected for processing (27)
  • pyproject.toml
  • src/app/endpoints/a2a.py
  • src/app/endpoints/streaming_query.py
  • src/app/main.py
  • src/authentication/jwk_token.py
  • src/authorization/middleware.py
  • src/models/config.py
  • src/models/requests.py
  • src/utils/common.py
  • src/utils/connection_decorator.py
  • tests/integration/conftest.py
  • tests/integration/endpoints/test_health_integration.py
  • tests/integration/endpoints/test_info_integration.py
  • tests/integration/endpoints/test_model_list.py
  • tests/integration/endpoints/test_query_integration.py
  • tests/integration/endpoints/test_root_endpoint.py
  • tests/integration/endpoints/test_streaming_query_integration.py
  • tests/integration/endpoints/test_tools_integration.py
  • tests/integration/test_rh_identity_integration.py
  • tests/unit/a2a_storage/test_storage_factory.py
  • tests/unit/app/test_database.py
  • tests/unit/app/test_routers.py
  • tests/unit/authentication/test_jwk_token.py
  • tests/unit/authorization/test_azure_token_manager.py
  • tests/unit/conftest.py
  • tests/unit/models/rlsapi/test_requests.py
  • tests/unit/test_configuration.py

@tisnik tisnik force-pushed the lcore-1431-fixed-new-linter-errors branch from b4468ca to 748dd3f Compare March 8, 2026 09:44
@tisnik tisnik merged commit 6e0c019 into lightspeed-core:main Mar 8, 2026
22 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