Skip to content

LCORE-1476: Sorted imports#1398

Merged
tisnik merged 5 commits intolightspeed-core:mainfrom
tisnik:lcore-1476-sorted-imports
Mar 24, 2026
Merged

LCORE-1476: Sorted imports#1398
tisnik merged 5 commits intolightspeed-core:mainfrom
tisnik:lcore-1476-sorted-imports

Conversation

@tisnik
Copy link
Copy Markdown
Contributor

@tisnik tisnik commented Mar 24, 2026

Description

LCORE-1476: Sorted imports

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-1476

Summary by CodeRabbit

  • Style

    • Standardized import ordering across the codebase to enforce consistent code formatting.
  • Tests

    • Expanded test coverage for the A2A (Agent-to-Agent) protocol endpoint module with comprehensive unit tests for protocol handling and executor behavior.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 24, 2026

Warning

Rate limit exceeded

@tisnik has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 08842ed7-9bbc-44cb-9a11-ee8b38d8e408

📥 Commits

Reviewing files that changed from the base of the PR and between 212958a and ce81f6e.

📒 Files selected for processing (100)
  • dev-tools/mcp-mock-server/server.py
  • dev-tools/mcp-mock-server/test_mock_mcp_server.py
  • pyproject.toml
  • scripts/gen_doc.py
  • scripts/generate_openapi_schema.py
  • tests/benchmarks/conftest.py
  • tests/benchmarks/db_benchmarks.py
  • tests/benchmarks/test_app_database.py
  • tests/benchmarks/test_app_database_comparison.py
  • tests/e2e/features/environment.py
  • tests/e2e/features/steps/auth.py
  • tests/e2e/features/steps/common.py
  • tests/e2e/features/steps/common_http.py
  • tests/e2e/features/steps/conversation.py
  • tests/e2e/features/steps/health.py
  • tests/e2e/features/steps/info.py
  • tests/e2e/features/steps/llm_query_response.py
  • tests/e2e/features/steps/models.py
  • tests/e2e/features/steps/rbac.py
  • tests/e2e/features/steps/rlsapi_v1.py
  • tests/e2e/features/steps/token_counters.py
  • tests/e2e/mock_jwks_server/generate_tokens.py
  • tests/e2e/mock_jwks_server/server.py
  • tests/e2e/mock_mcp_server/server.py
  • tests/e2e/utils/llama_stack_utils.py
  • tests/e2e/utils/prow_utils.py
  • tests/integration/conftest.py
  • tests/integration/endpoints/test_authorized_endpoint.py
  • tests/integration/endpoints/test_config_integration.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_tools_integration.py
  • tests/integration/test_configuration.py
  • tests/unit/__init__.py
  • tests/unit/a2a_storage/test_storage_factory.py
  • tests/unit/app/endpoints/test_a2a.py
  • tests/unit/app/endpoints/test_conversations.py
  • tests/unit/app/endpoints/test_conversations_v2.py
  • tests/unit/app/endpoints/test_health.py
  • tests/unit/app/endpoints/test_mcp_servers.py
  • tests/unit/app/endpoints/test_models.py
  • tests/unit/app/endpoints/test_rlsapi_v1.py
  • tests/unit/app/endpoints/test_streaming_query.py
  • tests/unit/app/endpoints/test_tools.py
  • tests/unit/app/test_database.py
  • tests/unit/app/test_main_middleware.py
  • tests/unit/app/test_routers.py
  • tests/unit/authentication/test_auth.py
  • tests/unit/authentication/test_jwk_token.py
  • tests/unit/authentication/test_k8s.py
  • tests/unit/authentication/test_noop.py
  • tests/unit/authentication/test_noop_with_token.py
  • tests/unit/authentication/test_utils.py
  • tests/unit/authorization/test_azure_token_manager.py
  • tests/unit/authorization/test_resolvers.py
  • tests/unit/cache/test_cache_factory.py
  • tests/unit/cache/test_noop_cache.py
  • tests/unit/cache/test_sqlite_cache.py
  • tests/unit/models/config/test_a2a_state_configuration.py
  • tests/unit/models/config/test_authentication_configuration.py
  • tests/unit/models/config/test_conversation_history.py
  • tests/unit/models/config/test_customization.py
  • tests/unit/models/config/test_database_configuration.py
  • tests/unit/models/config/test_dump_configuration.py
  • tests/unit/models/config/test_jwt_role_rule.py
  • tests/unit/models/config/test_llama_stack_configuration.py
  • tests/unit/models/config/test_model_context_protocol_server.py
  • tests/unit/models/config/test_postgresql_database_configuration.py
  • tests/unit/models/config/test_quota_scheduler_config.py
  • tests/unit/models/config/test_service_configuration.py
  • tests/unit/models/config/test_splunk_configuration.py
  • tests/unit/models/requests/test_feedback_request.py
  • tests/unit/models/responses/test_error_responses.py
  • tests/unit/models/responses/test_rag_chunk.py
  • tests/unit/models/responses/test_successful_responses.py
  • tests/unit/models/rlsapi/test_requests.py
  • tests/unit/models/rlsapi/test_responses.py
  • tests/unit/observability/test_splunk.py
  • tests/unit/quota/test_cluster_quota_limiter.py
  • tests/unit/quota/test_connect_pg.py
  • tests/unit/quota/test_connect_sqlite.py
  • tests/unit/quota/test_quota_limiter_factory.py
  • tests/unit/quota/test_user_quota_limiter.py
  • tests/unit/telemetry/conftest.py
  • tests/unit/test_client.py
  • tests/unit/test_llama_stack_configuration.py
  • tests/unit/utils/test_checks.py
  • tests/unit/utils/test_common.py
  • tests/unit/utils/test_conversations.py
  • tests/unit/utils/test_llama_stack_version.py
  • tests/unit/utils/test_mcp_auth_headers.py
  • tests/unit/utils/test_mcp_headers.py
  • tests/unit/utils/test_query.py
  • tests/unit/utils/test_responses.py
  • tests/unit/utils/test_shields.py
  • tests/unit/utils/test_transcripts.py
  • tests/unit/utils/test_types.py

Walkthrough

The pull request enforces import sorting standards by adding the I001 Ruff linting rule to pyproject.toml and systematically reordering imports across the codebase to comply with these standards. Additionally, a comprehensive unit test suite for the A2A endpoint module is added. No runtime logic, control flow, or public API signatures are altered.

Changes

Cohort / File(s) Summary
Linting Configuration
pyproject.toml
Added I001 import sorting rule to Ruff lint configuration extend-select.
Core Source Files
dev-tools/mcp-mock-server/server.py, dev-tools/mcp-mock-server/test_mock_mcp_server.py, scripts/gen_doc.py, scripts/generate_openapi_schema.py
Reordered import statements to enforce consistent import ordering (e.g., datetime/UTC, http.server classes, module imports).
Mock Server Files
tests/e2e/mock_jwks_server/generate_tokens.py, tests/e2e/mock_jwks_server/server.py, tests/e2e/mock_mcp_server/server.py
Reordered imports from http.server, cryptography, and other modules for consistency.
E2E Test Utilities & Steps
tests/e2e/features/environment.py, tests/e2e/features/steps/*, tests/e2e/utils/llama_stack_utils.py, tests/e2e/utils/prow_utils.py
Reordered and reorganized imports; added blank line separations between stdlib and third-party imports where appropriate.
Benchmark Tests
tests/benchmarks/conftest.py, tests/benchmarks/db_benchmarks.py, tests/benchmarks/test_app_database.py, tests/benchmarks/test_app_database_comparison.py
Reordered imports from configuration, datetime, SQLAlchemy, and test module imports.
Unit Test - A2A Endpoint
tests/unit/app/endpoints/test_a2a_.py
Added comprehensive unit test suite (~895 lines) covering A2A protocol endpoint functionality, including fixtures, request/response handling, task execution, streaming, error cases, and authorization tests. Imported and reordered existing test file imports in test_a2a.py accordingly.
Unit Tests - Endpoints
tests/unit/app/endpoints/test_*.py
Reordered imports across all endpoint test files; expanded imports in test_streaming_query.py to include additional response chunk types and aliases from llama_stack_api.openai_responses; reorganized test_responses.py imports into separate statements.
Unit Tests - Models & Config
tests/unit/models/config/test_*.py, tests/unit/models/requests/test_*.py, tests/unit/models/responses/test_*.py, tests/unit/models/rlsapi/test_*.py
Systematically reordered imports across configuration, request, response, and RLSAPI test modules; consolidated duplicate imports and adjusted import grouping.
Unit Tests - Other Modules
tests/unit/app/test_*.py, tests/unit/authentication/test_*.py, tests/unit/authorization/test_*.py, tests/unit/cache/test_*.py, tests/unit/quota/test_*.py, tests/unit/telemetry/test_*.py, tests/unit/utils/test_*.py, tests/unit/test_*.py
Reordered imports across authentication, authorization, cache, quota, observability, and utility test modules; adjusted blank-line formatting and grouped related imports.
Integration Tests
tests/integration/conftest.py, tests/integration/endpoints/test_*.py, tests/integration/test_*.py
Consolidated and reordered imports; moved stdlib imports to align with others; reorganized SQLAlchemy, configuration, and endpoint handler imports.

Sequence Diagram(s)

No sequence diagrams generated—the changes are primarily import reordering and configuration updates, not functional logic modifications with multi-component interactions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

The PR consists mainly of homogeneous, repetitive import reordering across ~90+ files, which reduces per-file review complexity. However, the addition of a comprehensive A2A endpoint test suite (~895 lines) introduces moderate complexity requiring careful validation of test coverage, fixtures, and assertion logic. The broad scope across multiple modules and the need to verify import correctness in context warrant moderate review effort.

Possibly related PRs

  • LCORE-1476: fixed unsorted imports in sources #1369: Both PRs perform broad import-order refactors across the repository to enforce sorted imports, with overlapping changes to many of the same modules (datetime/UTC reorderings, http.server import reorders), making them closely related enforcement efforts.
🚥 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 title clearly and directly describes the primary change: sorting imports across the codebase by enabling a Ruff linting rule and applying fixes.
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

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 9e5cc6f into lightspeed-core:main Mar 24, 2026
22 of 23 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