Skip to content

LCORE-1279: more unit tests for suid.py module#1107

Merged
tisnik merged 1 commit intolightspeed-core:mainfrom
tisnik:lcore-1279-more-unit-tests-for-suid-module
Feb 5, 2026
Merged

LCORE-1279: more unit tests for suid.py module#1107
tisnik merged 1 commit intolightspeed-core:mainfrom
tisnik:lcore-1279-more-unit-tests-for-suid-module

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Feb 5, 2026

Description

LCORE-1279: more unit tests for suid.py module

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

Summary by CodeRabbit

  • Documentation

    • Enhanced documentation for conversation identifier formats, clarifying support for standard UUIDs, hexadecimal IDs, and prefixed identifier variants.
  • Tests

    • Added comprehensive test suite covering conversation ID validation, normalization, and prefix handling to ensure robust identifier processing.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

Walkthrough

Documentation enhancements to SUID utility functions clarifying accepted UUID formats and prefix handling conventions. Three new unit tests added to validate conversation ID normalization, conv_ prefix validation, and ID conversion logic without modifying production code.

Changes

Cohort / File(s) Summary
SUID Utility Documentation
src/utils/suid.py
Enhanced docstring for check_suid with enumerated accepted formats (RFC 4122 UUIDs, 48-char hex llama-stack IDs, 53-char with conv_ prefix). Updated docstring header in to_llama_stack_conversation_id from "Args" to "Parameters" for consistency.
SUID Unit Tests
tests/unit/utils/test_suid.py
Added three new test methods: validation of conv_ prefixed UUIDs rejection, conversation ID normalization with optional prefix removal, and ID conversion preserving/adding conv_ prefix as needed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 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 title clearly and specifically describes the main change: adding more unit tests for the suid.py module, which aligns with the changeset that adds three new unit tests.
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 docstrings
🧪 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: 1

🤖 Fix all issues with AI agents
In `@tests/unit/utils/test_suid.py`:
- Around line 24-28: The test test_check_suid_invalid_uuid_with_conv_prefix
currently asserts that suid.check_suid(valid_suid) is False but its docstring
and assertion message incorrectly say "True"; update the docstring to state that
check_suid returns False for an invalid UUID with a conv_ prefix and change the
assertion message to something like "check_suid should return False for invalid
UUID"; optionally rename valid_suid to invalid_suid to match intent and keep the
call to suid.check_suid unchanged.

Comment on lines +24 to +28
def test_check_suid_invalid_uuid_with_conv_prefix(self) -> None:
"""Test that check_suid returns True for a valid UUID."""
valid_suid = "conv_123e4567-e89b-12d3-a456-426614174000"
assert not suid.check_suid(valid_suid), "check_suid should return True for UUID"

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix misleading docstring and assertion message.

The test verifies a False outcome, but both the docstring and assertion message say “True,” which is confusing.

Suggested fix
 def test_check_suid_invalid_uuid_with_conv_prefix(self) -> None:
-    """Test that check_suid returns True for a valid UUID."""
-    valid_suid = "conv_123e4567-e89b-12d3-a456-426614174000"
-    assert not suid.check_suid(valid_suid), "check_suid should return True for UUID"
+    """Test that check_suid returns False for conv_-prefixed UUIDs."""
+    conv_prefixed_uuid = "conv_123e4567-e89b-12d3-a456-426614174000"
+    assert not suid.check_suid(conv_prefixed_uuid), (
+        "check_suid should return False for conv_-prefixed UUIDs"
+    )
🤖 Prompt for AI Agents
In `@tests/unit/utils/test_suid.py` around lines 24 - 28, The test
test_check_suid_invalid_uuid_with_conv_prefix currently asserts that
suid.check_suid(valid_suid) is False but its docstring and assertion message
incorrectly say "True"; update the docstring to state that check_suid returns
False for an invalid UUID with a conv_ prefix and change the assertion message
to something like "check_suid should return False for invalid UUID"; optionally
rename valid_suid to invalid_suid to match intent and keep the call to
suid.check_suid unchanged.

@tisnik tisnik merged commit d1f691e into lightspeed-core:main Feb 5, 2026
21 of 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