Skip to content

LCORE-1438: minor fixes#1317

Merged
tisnik merged 6 commits into
lightspeed-core:mainfrom
tisnik:lcore-1438-minor-fixes
Mar 15, 2026
Merged

LCORE-1438: minor fixes#1317
tisnik merged 6 commits into
lightspeed-core:mainfrom
tisnik:lcore-1438-minor-fixes

Conversation

@tisnik

@tisnik tisnik commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Description

LCORE-1438: minor fixes

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

Summary by CodeRabbit

  • Bug Fixes

    • Improved timezone consistency by standardizing all timestamps to UTC across logs, requests, and system operations.
  • Chores

    • Enhanced code quality through improved linting rules and streamlined header processing logic.
    • Strengthened test assertions with explicit value validation.

@coderabbitai

coderabbitai Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Updates datetime handling across multiple modules to use timezone-aware UTC timestamps instead of naive datetime objects. Also includes minor code style improvements, a linting configuration update, and test assertion enhancements to explicitly validate non-None configuration values.

Changes

Cohort / File(s) Summary
Timezone Awareness Updates
dev-tools/mcp-mock-server/server.py, src/app/endpoints/rlsapi_v1.py, src/quota/revokable_quota_limiter.py, src/quota/token_usage_history.py
Replaced naive datetime.now() calls with datetime.now(tz=UTC) to ensure all timestamps are timezone-aware UTC timestamps. Added UTC import from datetime module.
Code Quality Improvements
pyproject.toml, scripts/gen_doc.py
Added DTZ005 linting rule to Ruff configuration for timezone detection. Simplified blank line printing in documentation generation script.
Test Improvements
tests/unit/test_configuration.py
Enhanced test assertions by assigning configuration property values to local variables and explicitly asserting they are not None, improving test clarity and validation logic.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'LCORE-1438: minor fixes' is vague and generic, using non-descriptive term 'minor fixes' that doesn't convey meaningful information about the changeset's primary focus. Consider revising the title to specifically highlight the main change, such as 'LCORE-1438: Add timezone awareness to timestamps' or 'LCORE-1438: Refactor datetime usage and add timezone support'.
✅ 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%.

✏️ 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
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@tests/unit/test_configuration.py`:
- Around line 449-450: The assertion after accessing the exception-raising
property is dead code; remove the trailing `assert c is not None` and replace
the access pattern with a discard (e.g., `_ = cfg.configuration`) in the test
function `test_configuration_not_loaded`, and apply the same change to the other
listed tests (`test_service_configuration_not_loaded`,
`test_llama_stack_configuration_not_loaded`,
`test_user_data_collection_configuration_not_loaded`,
`test_mcp_servers_not_loaded`, `test_authentication_configuration_not_loaded`,
`test_customization_not_loaded`) so each test only accesses the property to
trigger the LogicError and does not include an unreachable assertion.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 33960d28-4042-471c-a9a0-e6547436d42d

📥 Commits

Reviewing files that changed from the base of the PR and between 1938666 and 1a79905.

📒 Files selected for processing (7)
  • dev-tools/mcp-mock-server/server.py
  • pyproject.toml
  • scripts/gen_doc.py
  • src/app/endpoints/rlsapi_v1.py
  • src/quota/revokable_quota_limiter.py
  • src/quota/token_usage_history.py
  • tests/unit/test_configuration.py

Comment on lines +449 to +450
c = cfg.configuration
assert c is not None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Dead code: assertion after exception-raising property access.

The assertion assert c is not None on line 450 will never execute because accessing cfg.configuration on line 449 raises LogicError (which is what this test verifies). The same pattern repeats in the subsequent test functions.

The previous pattern using _ = cfg.property was sufficient and clearer about intent.

🧹 Suggested fix to remove dead code
 def test_configuration_not_loaded() -> None:
     """Test that accessing configuration before loading raises an error."""
     cfg = AppConfig()
     with pytest.raises(LogicError, match="logic error: configuration is not loaded"):
-        c = cfg.configuration
-        assert c is not None
+        _ = cfg.configuration  # pylint: disable=pointless-statement

Apply similar changes to:

  • test_service_configuration_not_loaded (lines 457-458)
  • test_llama_stack_configuration_not_loaded (lines 465-466)
  • test_user_data_collection_configuration_not_loaded (lines 473-474)
  • test_mcp_servers_not_loaded (lines 481-482)
  • test_authentication_configuration_not_loaded (lines 489-490)
  • test_customization_not_loaded (lines 497-498)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
c = cfg.configuration
assert c is not None
_ = cfg.configuration # pylint: disable=pointless-statement
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/unit/test_configuration.py` around lines 449 - 450, The assertion after
accessing the exception-raising property is dead code; remove the trailing
`assert c is not None` and replace the access pattern with a discard (e.g., `_ =
cfg.configuration`) in the test function `test_configuration_not_loaded`, and
apply the same change to the other listed tests
(`test_service_configuration_not_loaded`,
`test_llama_stack_configuration_not_loaded`,
`test_user_data_collection_configuration_not_loaded`,
`test_mcp_servers_not_loaded`, `test_authentication_configuration_not_loaded`,
`test_customization_not_loaded`) so each test only accesses the property to
trigger the LogicError and does not include an unreachable assertion.

@tisnik tisnik merged commit 4c17178 into lightspeed-core:main Mar 15, 2026
23 of 24 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