Skip to content

Conversation

@jopemachine
Copy link
Member

@jopemachine jopemachine commented Nov 26, 2025

resolves #6947 (BA-3149)

Checklist: (if applicable)

  • Mention to the original issue

📚 Documentation preview 📚: https://sorna--6950.org.readthedocs.build/en/6950/


📚 Documentation preview 📚: https://sorna-ko--6950.org.readthedocs.build/ko/6950/

@github-actions github-actions bot added size:XL 500~ LoC comp:manager Related to Manager component comp:common Related to Common component labels Nov 26, 2025
@jopemachine jopemachine changed the title feat: Create Valkey client for artifact registries synchronization feat(BA-3149): Create Valkey client for artifact registries synchronization Nov 26, 2025
@jopemachine jopemachine marked this pull request as ready for review November 27, 2025 01:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new Valkey client for caching artifact registry configurations (HuggingFace and Reservoir registries) to enable sharing between the manager and storage-proxy components. The implementation moves registry data types from the manager layer to the common layer to facilitate cross-component access.

Key Changes

  • Created ValkeyArtifactRegistryClient with CRUD operations for HuggingFace and Reservoir registry data caching
  • Moved HuggingFaceRegistryData and ReservoirRegistryData from ai.backend.manager.data.* to ai.backend.common.data.artifact_registry.types
  • Added comprehensive test coverage for the new client functionality

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 23 comments.

Show a summary per file
File Description
src/ai/backend/common/clients/valkey_client/valkey_artifact_registries/client.py Implements the new Valkey client with resilience policies, cache key generation, and JSON serialization/deserialization for registry data
src/ai/backend/common/clients/valkey_client/valkey_artifact_registries/__init__.py Exports the ValkeyArtifactRegistryClient class
src/ai/backend/common/data/artifact_registry/types.py Defines HuggingFaceRegistryData and ReservoirRegistryData dataclasses (moved from manager)
tests/common/clients/valkey_client/test_valkey_artifact_registry_client.py Provides test coverage for all client operations including set, get, delete, expiration, and registry isolation
src/ai/backend/common/metrics/metric.py Adds VALKEY_ARTIFACT_REGISTRIES layer type for metrics tracking
src/ai/backend/manager/services/artifact_registry/actions/**/*.py Updates imports to reference the new common location for registry data types
src/ai/backend/manager/repositories/**/*.py Updates imports to reference the new common location for registry data types
src/ai/backend/manager/models/**/*.py Updates imports to reference the new common location for registry data types
src/ai/backend/manager/client/artifact_registry/reservoir_client.py Updates import to reference the new common location for ReservoirRegistryData
src/ai/backend/manager/api/gql/**/*.py Updates imports to reference the new common location for registry data types
src/ai/backend/manager/data/huggingface_registry/types.py Deleted (moved to common)
changes/6950.feature.md Changelog entry for the new feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

registry_data = HuggingFaceRegistryData(
id=registry_uuid,
name=registry_name,
url="https://huggingface.co",
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Type mismatch: The set_huggingface_registry method expects registry_name: str as the first parameter, but a uuid.UUID object is being passed.

Copilot uses AI. Check for mistakes.
# Set registry data
await valkey_artifact_registry_client.set_huggingface_registry(registry_name, registry_data)

# Delete registry data
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Type mismatch: The get_huggingface_registry method expects registry_name: str as the parameter, but a uuid.UUID object is being passed.

Copilot uses AI. Check for mistakes.
id=registry_uuid,
name=registry_name,
endpoint="https://reservoir.example.com",
access_key="test-access-key",
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Type mismatch: The set_reservoir_registry method expects registry_name: str as the first parameter, but a uuid.UUID object is being passed.

Suggested change
access_key="test-access-key",
await valkey_artifact_registry_client.set_reservoir_registry(str(registry_uuid), registry_data)

Copilot uses AI. Check for mistakes.
access_key="test-access-key",
secret_key="test-secret-key",
api_version="v1",
)
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Type mismatch: The get_reservoir_registry method expects registry_name: str as the parameter, but a uuid.UUID object is being passed.

Suggested change
)
result = await valkey_artifact_registry_client.get_reservoir_registry(str(registry_uuid))

Copilot uses AI. Check for mistakes.
Comment on lines 192 to 198
reservoir_name = "reservoir-registry"
reservoir_data = ReservoirRegistryData(
id=reservoir_uuid,
name=reservoir_name,
endpoint="https://reservoir.example.com",
access_key="reservoir-access",
secret_key="reservoir-secret",
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Type mismatch: The set_huggingface_registry method expects registry_name: str as the first parameter, but a uuid.UUID object is being passed.

Suggested change
reservoir_name = "reservoir-registry"
reservoir_data = ReservoirRegistryData(
id=reservoir_uuid,
name=reservoir_name,
endpoint="https://reservoir.example.com",
access_key="reservoir-access",
secret_key="reservoir-secret",
await valkey_artifact_registry_client.set_huggingface_registry(str(registry_uuid), hf_data)
await valkey_artifact_registry_client.set_reservoir_registry(str(registry_uuid), reservoir_data)
# Verify both are stored separately
hf_result = await valkey_artifact_registry_client.get_huggingface_registry(str(registry_uuid))
reservoir_result = await valkey_artifact_registry_client.get_reservoir_registry(
str(registry_uuid)

Copilot uses AI. Check for mistakes.
Comment on lines 160 to 161
name=registry_name,
url="https://huggingface.co",
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Type mismatch: The set_huggingface_registry method expects registry_name: str as the first parameter, but a uuid.UUID object is being passed.

Copilot uses AI. Check for mistakes.
token="test-token-789",
)

# Set with short expiration (1 second for testing purposes would be ideal,
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

Type mismatch: The get_huggingface_registry method expects registry_name: str as the parameter, but a uuid.UUID object is being passed.

Suggested change
# Set with short expiration (1 second for testing purposes would be ideal,
result = await valkey_artifact_registry_client.get_huggingface_registry(str(registry_uuid))

Copilot uses AI. Check for mistakes.
Comment on lines 166 to 168
async def delete_huggingface_registry(
self,
registry_name: str,
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

API design inconsistency: The method parameter is named registry_name and documented as "The name of the HuggingFace registry", but registry UUIDs would be more appropriate as stable identifiers for caching. Consider renaming this parameter to registry_id and accepting uuid.UUID type instead of str.

Copilot uses AI. Check for mistakes.
Comment on lines 207 to 209
async def get_reservoir_registry(
self,
registry_name: str,
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

API design inconsistency: The method parameter is named registry_name and documented as "The name of the Reservoir registry", but registry UUIDs would be more appropriate as stable identifiers for caching. Consider renaming this parameter to registry_id and accepting uuid.UUID type instead of str.

Copilot uses AI. Check for mistakes.
Comment on lines 231 to 233
async def delete_reservoir_registry(
self,
registry_name: str,
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

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

API design inconsistency: The method parameter is named registry_name and documented as "The name of the Reservoir registry", but registry UUIDs would be more appropriate as stable identifiers for caching. Consider renaming this parameter to registry_id and accepting uuid.UUID type instead of str.

Copilot uses AI. Check for mistakes.
@github-actions github-actions bot added the area:docs Documentations label Nov 27, 2025
@jopemachine jopemachine added this to the 25.18 milestone Nov 27, 2025
@github-actions github-actions bot added size:L 100~500 LoC and removed size:XL 500~ LoC labels Nov 27, 2025
@github-actions github-actions bot added size:XL 500~ LoC and removed size:L 100~500 LoC labels Nov 27, 2025
@HyeockJinKim HyeockJinKim added this pull request to the merge queue Dec 1, 2025
Merged via the queue into main with commit 0b9a8bc Dec 1, 2025
28 checks passed
@HyeockJinKim HyeockJinKim deleted the feat/BA-3149 branch December 1, 2025 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentations comp:common Related to Common component comp:manager Related to Manager component size:XL 500~ LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Valkey client for artifact registries synchronization

4 participants