Skip to content

fix: pin num-traits to 0.2.19 to match platform-num's exact version#27

Merged
konard merged 2 commits into
mainfrom
issue-26-bf646dfde3ba
Apr 10, 2026
Merged

fix: pin num-traits to 0.2.19 to match platform-num's exact version#27
konard merged 2 commits into
mainfrom
issue-26-bf646dfde3ba

Conversation

@konard
Copy link
Copy Markdown
Member

@konard konard commented Apr 10, 2026

Summary

Fixes #26

The issue asks whether the direct num-traits dependency in platform-trees can be removed since platform-num already depends on it internally.

Root Cause Analysis

Direct removal is not possible. Rust requires explicit direct dependencies — transitive deps cannot be used in code. Attempting to remove num-traits from Cargo.toml yields:

error[E0432]: unresolved import `num_traits`
 --> src/link_type.rs:1:5
  |
1 | use num_traits::{FromPrimitive, Unsigned};
  |     ^^^^^^^^^^ use of unresolved module or unlinked crate `num_traits`

The real risk: version drift. Before this fix:

  • platform-trees: num-traits = "0.2" (any 0.2.x)
  • platform-num v0.5.0: num-traits = "0.2.19" (pinned)

If these ever resolved to different num-traits versions, Unsigned and FromPrimitive would be incompatible types from the caller's perspective and compilation would fail.

Changes

  1. Cargo.toml: Pin num-traits from "0.2""0.2.19" to match platform-num's exact version, ensuring version consistency.

  2. docs/case-studies/issue-26/README.md: Full case study with timeline, root cause analysis, proposed solutions, and references.

  3. changelog.d/...: Patch-level changelog fragment.

Future Path to Full Removal

Full removal of the num-traits dependency would require platform-num to re-export the traits it uses internally (Unsigned, FromPrimitive, etc.). I filed linksplatform/Numbers#141 requesting this change. Once that's implemented and a new version of platform-num is released, platform-trees could drop num-traits entirely.

Testing

All 32 existing tests pass with the pinned version:

test result: ok. 32 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

This PR was created automatically by the AI issue solver

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #26
@konard konard self-assigned this Apr 10, 2026
Pins the num-traits dependency from "0.2" (any 0.2.x) to "0.2.19" to
match the exact version used by platform-num, preventing potential trait
bound incompatibilities if the two crates ever resolved different versions
of num-traits.

Direct removal of num-traits is not possible since Rust requires explicit
direct dependencies — transitive deps are not accessible in code. Filed
linksplatform/Numbers#141 to request re-exports from platform-num which
would enable full removal in a future release.

Also adds case study docs at docs/case-studies/issue-26/ with full
analysis, root cause, and proposed solutions.

Fixes #26

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] If num-traits already imported in platform-num, can we remove direct dependency safely to make it always the same as in platform-num? fix: pin num-traits to 0.2.19 to match platform-num's exact version Apr 10, 2026
@konard konard marked this pull request as ready for review April 10, 2026 19:49
@konard
Copy link
Copy Markdown
Member Author

konard commented Apr 10, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $0.830036

📊 Context and tokens usage:

Claude Sonnet 4.6:

  • Context window: 50.9K / 1M (5%) input tokens, 11.3K / 64K (18%) output tokens

Total: (40.3K + 1.4M cached) input tokens, 11.3K output tokens, $0.745098 cost

Claude Haiku 4.5:

Total: (32.3K + 250.3K cached) input tokens, 3.9K / 64K (6%) output tokens, $0.084938 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: sonnet
  • Main model: Claude Sonnet 4.6 (claude-sonnet-4-6)
  • Additional models:
    • Claude Haiku 4.5 (claude-haiku-4-5-20251001)

📎 Log file uploaded as Gist (825KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard konard merged commit 38a77cb into main Apr 10, 2026
12 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.

If num-traits already imported in platform-num, can we remove direct dependency safely to make it always the same as in platform-num?

1 participant