Remove dead Rust compute_synthetic_weights (follow-up to PR #344)#345
Merged
Remove dead Rust compute_synthetic_weights (follow-up to PR #344)#345
Conversation
…nding #22) Closes the Rust-side loop on finding #22 from the silent-failures audit. The Python-side wrapper and its sole caller were removed in PR #344; this PR deletes the now-orphaned PyO3 binding, its internal PGD implementation, and the obsolete constants that only serviced it. Deleted - rust/src/weights.rs: compute_synthetic_weights pyfunction + compute_synthetic_weights_internal - rust/src/weights.rs: MAX_ITER, DEFAULT_TOL, DEFAULT_STEP_SIZE (only used by the deleted PGD path) - rust/src/weights.rs: test_compute_weights_sum_to_one (cargo test for the deleted internal helper) - rust/src/lib.rs: m.add_function(wrap_pyfunction!(weights::compute_synthetic_weights, m)?) Retained (still used from Python) - weights::project_simplex — consumed by _rust_project_simplex in utils.py (project_simplex tests in test_rust_backend.py) - weights::compute_sdid_unit_weights, compute_time_weights, sc_weight_fw, compute_noise_level (SDID canonical path) - weights::sum_normalize_internal, sparsify_internal (helpers for SDID) Verification - maturin develop --release --features accelerate: clean rebuild, no warnings - cargo check --lib: clean (cargo test --release hits a known macOS PyO3 Python3.framework rpath issue unrelated to this change) - pytest tests/test_rust_backend.py tests/test_prep.py::TestRankControlUnits: 85 passed - Direct import test: project_simplex / compute_sdid_unit_weights / compute_time_weights / sc_weight_fw still importable; compute_synthetic_weights correctly raises ImportError TODO.md row 86 removed. docs/audits/silent-failures-findings.md row #22 updated to FULLY RESOLVED. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Overall Assessment ✅ Looks good Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
…gression guard - tests/test_rust_backend.py: updated the stale "tracked as a low-priority Rust cleanup TODO" comment to reflect that the Rust-side removal is now done alongside the Python-side removal. - tests/test_rust_backend.py: new test_compute_synthetic_weights_is_removed as a regression guard against accidental re-export of the deleted PyO3 binding. Asserts both `from diff_diff._rust_backend import compute_synthetic_weights` raises ImportError and the attribute is absent on the module object. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment ✅ Looks good Re-review result: the prior informational issues are resolved, and I did not identify any new unmitigated P0/P1 findings in the changed code. Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
Static-review note: I did not rerun |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
compute_synthetic_weightsbinding and its internal PGD implementation fromrust/src/weights.rs(86 lines).rust/src/lib.rsand removes the obsolete constants (MAX_ITER,DEFAULT_TOL,DEFAULT_STEP_SIZE) that only serviced the deleted PGD code.Methodology references (required if estimator / math changes)
Validation
cargo testcase —test_compute_weights_sum_to_one— deleted alongside the function it exercised; Python-side coverage of the replacement path is already intests/test_prep.py::TestRankControlUnits).maturin develop --release --features accelerate: clean rebuild, no warnings.pytest tests/test_rust_backend.py tests/test_prep.py::TestRankControlUnits: 85 passed.project_simplex/compute_sdid_unit_weights/compute_time_weights/sc_weight_fwstill importable;compute_synthetic_weightscorrectly raisesImportError.cargo test --releaseon macOS hits the known PyO3 Python3.framework rpath issue unrelated to this change.cargo checkis clean.Security / privacy
Diff size: +1 / −126 across
rust/src/weights.rs,rust/src/lib.rs,TODO.md.