Skip to content

Feat: add model registry#157

Merged
jwric merged 30 commits into
mainfrom
feat/add_model_registry
Jul 8, 2026
Merged

Feat: add model registry#157
jwric merged 30 commits into
mainfrom
feat/add_model_registry

Conversation

@Zatiji

@Zatiji Zatiji commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Add read-only model registry module

Summary:

Adds a ModelRegistryProvider trait and ModelRegistryModule to tracel-core, exposing read-only model registry access (load) through Context::models(). Implemented for both CloudBackend and StationBackend (station-only verifies checksum/size on download); returns None for the offline/local backend. Includes unit tests for ModelRegistryModule and a small refactor extracting ArtifactDownloadFile construction into shared helpers in download_file.rs. It also includes a local cache.

Changes:

  • New model_registry module: trait, module, DTOs, errors
  • New ModelCache
  • Cloud/Station provider implementations (station gated behind feature = "station")
  • Providers/Context wiring for the new provider
  • Tests covering success/error paths for get/version/download_to
  • Cleanup : removed dead create_cloud_experiment_run re-export (used in tracel-runtime crate that is now deleted), deduped ArtifactDownloadFile construction
  • Not covered unit tests for the Cloud/Station trait impls themselves (thin HTTP passthroughs).

@Zatiji Zatiji changed the title Feat/add model registry Feat: add model registry Jul 6, 2026
@Zatiji
Zatiji marked this pull request as ready for review July 6, 2026 15:21
Copilot AI review requested due to automatic review settings July 6, 2026 15:21

Copilot AI 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.

Pull request overview

Adds a new read-only model registry capability to tracel-core, exposing model metadata and artifact download functionality via Context::model_registry() and backend-specific ModelRegistryProvider implementations.

Changes:

  • Introduces model_registry module with DTOs (ModelInfo, ModelVersionInfo), ModelRegistryModule, provider trait, and error types, plus unit tests for module behavior.
  • Implements ModelRegistryProvider for CloudBackend and (feature-gated) StationBackend, including checksum/size verification in Station download plans.
  • Refactors repeated ArtifactDownloadFile construction into shared helpers (download_file.rs) and removes a dead create_cloud_experiment_run re-export.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/tracel-core/src/model_registry/mod.rs Adds core model registry module API, errors, download flow, and unit tests.
crates/tracel-core/src/model_registry/cloud.rs Implements model registry provider for cloud backend.
crates/tracel-core/src/model_registry/station.rs Implements model registry provider for station backend (with verification fields).
crates/tracel-core/src/context.rs Wires model registry access into Context via an optional provider/module.
crates/tracel-core/src/connection.rs Extends provider wiring to supply model registry providers for Cloud/Station and None for Offline.
crates/tracel-core/src/download_file.rs Adds helper constructors for ArtifactDownloadFile (with/without verification).
crates/tracel-core/src/lib.rs Registers new modules and re-exports model-registry public types.
crates/tracel-core/src/experiment/remote/cloud/mod.rs Switches artifact download file construction to shared helper; removes dead create_cloud_experiment_run.
crates/tracel-core/src/experiment/remote/station/mod.rs Switches artifact download file construction to shared helper.
crates/tracel-core/src/experiment/mod.rs Removes stale runtime re-export.
crates/tracel-artifact/src/lib.rs Re-exports TransferError from tracel-artifact.

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

Comment thread crates/tracel-core/src/context.rs Outdated
Comment thread crates/tracel-core/src/model_registry/mod.rs Outdated
@Zatiji Zatiji assigned Zatiji, jwric and Marc-AnthonyG and unassigned Zatiji Jul 6, 2026
Comment thread crates/tracel-core/Cargo.toml Outdated
sha2.workspace = true

[dev-dependencies]
tempfile = "3.27.0"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add to workspace dependencies and reuse the same one as in tracel-artifacts

Comment thread crates/tracel-core/src/download_file.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Odd module choice, inline the construction of these structs where used

#[error("version {version} of model '{name}' not found")]
VersionNotFound { name: String, version: u32 },
#[error("communication with the model registry failed: {0}")]
Client(#[from] ClientError),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Client error not supposed to surface to the user api, box dyn error this

Comment on lines +36 to +56
pub(crate) fn map_not_found(
err: ClientError,
not_found: impl FnOnce() -> ModelRegistryError,
) -> ModelRegistryError {
match err {
ClientError::NotFound => not_found(),
other => other.into(),
}
}

/// Runs a client call purely to check existence, discarding its response and mapping a
/// not-found result through `not_found`. Shared by every [`ModelRegistryProvider`]
/// implementation's `ensure_model_exists`/`ensure_version_exists` checks.
pub(crate) fn ensure_exists<T>(
result: Result<T, ClientError>,
not_found: impl FnOnce() -> ModelRegistryError,
) -> Result<(), ModelRegistryError> {
result
.map(|_| ())
.map_err(|err| map_not_found(err, not_found))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is over functionification, its just confusing

Comment on lines +28 to +30
.join("models")
.join("station")
.join(station_id);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the order should be: station -> station_id -> models

@jwric
jwric merged commit b2c424b into main Jul 8, 2026
1 check passed
@jwric
jwric deleted the feat/add_model_registry branch July 8, 2026 15:46
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.

4 participants