Skip to content

Conversation

@aryehlev
Copy link
Owner

@aryehlev aryehlev commented Nov 9, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Extended support for CatBoost v1.2+ with version-specific optimizations and platform-aware library handling
    • Conditional embedding feature support based on library version compatibility
  • Chores

    • Enhanced automatic feature detection to align with CatBoost version capabilities

@coderabbitai
Copy link

coderabbitai bot commented Nov 9, 2025

Warning

Rate limit exceeded

@aryehlev has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 20 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 287de76 and 14a4f87.

📒 Files selected for processing (1)
  • build.rs (2 hunks)

Walkthrough

This PR introduces version-aware CatBoost library download selection in the build script with dynamic feature-flag emission based on library version. The Model implementation adds conditional compilation guards to support embeddings and text features only when the underlying library version provides them, with fallback error handling.

Changes

Cohort / File(s) Summary
Build Configuration & Version-Based Library Selection
build.rs
Implements version-based download URL and filename selection with per-OS platform-specific paths for v1.2+. Adds feature-detection flags (catboost_embeddings, catboost_text_count, catboost_staged_prediction, catboost_feature_indices) emitted to Cargo based on parsed CatBoost version. Consolidates lib_filename and download_url logic across OS targets with version-conditional branching. Introduces platform-arch validation with version-aware error handling for unsupported targets.
Conditional Model Prediction & Feature Support
src/model.rs
Wraps embedding-aware prediction logic in #[cfg(catboost_embeddings)] with fallback error handling when embeddings unavailable. Adds separate implementations for get_text_features_count() and get_embedding_features_count() gated by #[cfg(catboost_text_count)] and #[cfg(catboost_embeddings)] respectively, with fallback return values of 0 when features disabled. Runtime guard prevents embedding feature usage on unsupported versions.

Sequence Diagram(s)

sequenceDiagram
    participant Build as build.rs
    participant Cargo as Cargo
    participant Compile as Compile Time
    participant Runtime as Runtime
    
    Build->>Build: Parse CatBoost version
    
    alt Version >= 1.2
        Build->>Build: Detect supported features
        note over Build: catboost_embeddings,<br/>catboost_text_count, etc.
    else Version < 1.2
        Build->>Build: Limited feature set
    end
    
    Build->>Cargo: Emit cfg flags
    Cargo->>Compile: Feature gates active
    
    Compile->>Compile: Conditional compilation<br/>#[cfg(...)] blocks
    
    Compile->>Runtime: Binary with<br/>feature-aware paths
    
    Runtime->>Runtime: predict() calls embedding-aware<br/>or fallback implementation<br/>based on cfg
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Areas requiring extra attention:

  • Version parsing logic in build.rs and the platform-OS matrix validation across old (v1.0–1.1) and new (v1.2+) formats
  • Correctness of feature-flag emissions—ensure all four flags are properly set/unset for each supported version range
  • Conditional compilation fallback paths in src/model.rs; verify both #[cfg(...)] and #[cfg(not(...))] branches are logically consistent and handle edge cases
  • Runtime error messages when users attempt to use unsupported features on older CatBoost versions

Poem

🐰 A version-wise rabbit now hops through the code,
With feature flags glowing along every road,
Old libraries rest while new ones take flight,
Embeddings and text features shine oh-so-bright,
Conditional paths keep the binary light! 🌟

Pre-merge checks and finishing touches

✅ 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 accurately captures the main objective of the pull request: adding version-aware support for multiple CatBoost versions through version-conditional download URLs and feature flags.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d53349 and 287de76.

📒 Files selected for processing (2)
  • build.rs (2 hunks)
  • src/model.rs (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/model.rs (1)
src/error.rs (1)
  • check_return_value (15-21)

Comment on lines 107 to 112
"catboostmodel.dll".to_string(),
format!(
"https://github.com/catboost/catboost/releases/download/v{}/catboostmodel.dll",
version
),
),
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix Windows download URL for v1.2+ artifacts.

For CatBoost releases v1.2 and newer, the Windows assets are renamed to catboostmodel-windows-{cpu_arch}-{release_version}.dll. The current URL (.../catboostmodel.dll) no longer exists, so every Windows build on these versions will fail with a 404. Please switch to the versioned/arch-specific filename before shipping.(catboost.ai)

Apply this diff to correct the URL:

-            ("windows", "x86_64") => (
-                "catboostmodel.dll".to_string(),
-                format!(
-                    "https://github.com/catboost/catboost/releases/download/v{}/catboostmodel.dll",
-                    version
-                ),
-            ),
+            ("windows", arch) if arch == "x86_64" => (
+                "catboostmodel.dll".to_string(),
+                format!(
+                    "https://github.com/catboost/catboost/releases/download/v{}/catboostmodel-windows-{}-{}.dll",
+                    version,
+                    arch,
+                    version
+                ),
+            ),
📝 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
"catboostmodel.dll".to_string(),
format!(
"https://github.com/catboost/catboost/releases/download/v{}/catboostmodel.dll",
version
),
),
("windows", arch) if arch == "x86_64" => (
"catboostmodel.dll".to_string(),
format!(
"https://github.com/catboost/catboost/releases/download/v{}/catboostmodel-windows-{}-{}.dll",
version,
arch,
version
),
),
🤖 Prompt for AI Agents
In build.rs around lines 107 to 112, the Windows download URL currently points
to "catboostmodel.dll" which no longer exists for CatBoost v1.2+; update the
filename and URL to the new convention
"catboostmodel-windows-{cpu_arch}-{release_version}.dll" (i.e. use the build's
CPU architecture variable and the existing version variable in the URL format
string) so the format becomes something like
"https://github.com/catboost/catboost/releases/download/v{version}/catboostmodel-windows-{cpu_arch}-{version}.dll";
ensure you derive the {cpu_arch} value from the build target (e.g., x86_64,
aarch64) used elsewhere in the script and plug it into both the local filename
and the download URL.

@aryehlev aryehlev merged commit 7a252b0 into publish Nov 9, 2025
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Dec 15, 2025
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.

2 participants