fix: harden numerical and release evidence - #207
Conversation
- Surface determinant overflow even when error-bound terms underflow. - Measure complete benchmark operations symmetrically and bind retained reports to atomic, validated provenance. - Fail closed on inconsistent release metadata, tags, changelog sections, Semgrep annotations, and recorded CPU provenance. - Align docs.rs feature annotations, citation identifiers, all-target linting, and configurable property-test runs with documented contracts.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
🚧 Files skipped from review as they are similar to previous changes (8)
📝 WalkthroughWalkthroughThe PR updates release metadata and documentation, hardens benchmark and provenance workflows, adds atomic changelog publication, improves repository validation, exposes docs.rs APIs, and strengthens determinant and property-test validation. ChangesRelease, documentation, and Rust validation
Benchmark and release tooling
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant archive_performance
participant bench_compare
participant ArtifactStore
CLI->>archive_performance: validate options, version, CPU, and benchmark inputs
archive_performance->>bench_compare: provide benchmark outputs and provenance
bench_compare->>ArtifactStore: publish validated artifacts atomically
ArtifactStore-->>bench_compare: restore prior outputs if publication fails
Possibly related issues
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #207 +/- ##
=======================================
Coverage 97.86% 97.86%
=======================================
Files 8 8
Lines 4969 4975 +6
=======================================
+ Hits 4863 4869 +6
Misses 106 106
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (3)
scripts/tests/test_performance_artifacts.py (1)
339-340: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAssert the frozen type directly.
assert isinstance(criterion, dict) is Falseonly states what the nested value is not. Assertisinstance(criterion, MappingProxyType)so the test pins the immutability invariant it verifies.♻️ Proposed change
criterion = context.benchmark_provenance["criterion"] - assert isinstance(criterion, dict) is False + assert isinstance(criterion, MappingProxyType)Add the import:
from types import MappingProxyType🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/tests/test_performance_artifacts.py` around lines 339 - 340, Update the assertion for criterion in the relevant performance artifact test to verify isinstance(criterion, MappingProxyType) directly, and import MappingProxyType from types. Replace the existing negative dict assertion so the test pins the frozen mapping type.scripts/bench_compare.py (1)
425-438: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider importing the freeze helpers instead of duplicating them.
_freeze_jsonand_freeze_mappinghere are identical to the helpers added inscripts/performance_artifacts.pylines 273-287. This file already imports several symbols from that module. Export the helpers fromperformance_artifactsand import them here, so the freezing contract has one definition.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/bench_compare.py` around lines 425 - 438, Remove the local _freeze_json and _freeze_mapping definitions from scripts/bench_compare.py, export those helpers from performance_artifacts, and import and reuse them alongside the existing imports. Preserve the current freezing behavior and type-validation contract through the shared implementations.REFERENCES.md (1)
53-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExpress the scale-sharing threshold as a mathematical invariant.
The behavior depends on the exponent difference. State both branches explicitly:
|e_rhs − e_matrix| ≤ 64usesmin(e_rhs, e_matrix)as the shared scale, while|e_rhs − e_matrix| > 64keeps independent scales. This removes ambiguity at the boundary.As per coding guidelines,
**/*.mdfiles must use readable Unicode mathematical notation and state invariants mathematically where possible.Proposed wording
-Matrix and RHS scales start from their respective minimum -exponents. When the scales differ by at most 64 bits, both sides use the lower scale to share -common factors; larger gaps retain independent scales so one side is not inflated excessively. +Matrix and RHS scales start from their respective minimum exponents, e_matrix and e_rhs. +When |e_rhs − e_matrix| ≤ 64, both sides use min(e_rhs, e_matrix) as the shared scale. +When |e_rhs − e_matrix| > 64, the sides retain independent scales so one side is not inflated +excessively.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@REFERENCES.md` around lines 53 - 56, Update the scale-sharing description near “Matrix and RHS scales” to state the invariant using readable Unicode notation: when |e_rhs − e_matrix| ≤ 64, both sides use min(e_rhs, e_matrix) as the shared scale; when |e_rhs − e_matrix| > 64, retain independent scales. Preserve the surrounding explanation of Bareiss elimination.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/mathematical_basis.md`:
- Around line 153-155: Update the scaling discussion near “First-nonzero
pivoting” to define the matrix and right-hand-side scales mathematically,
including A = 2ˢᴬ·A_int and b = 2ˢᵇ·b_int, and explain that reconciling them
with the exact power-of-two factor preserves A x = b. Add the applicable
numbered citation from REFERENCES.md using the document’s existing citation
format.
In `@scripts/archive_changelog.py`:
- Around line 178-194: Update the Unreleased heading check in the changelog
parsing logic to require a valid closing-bracket boundary, rejecting variants
such as `## [Unreleased]invalid` instead of assigning them to unreleased.
Preserve valid `## [Unreleased]` handling and ensure malformed headings use the
existing unrecognized-heading failure path; add a test covering this rejection.
In `@scripts/check_semgrep_fixtures.py`:
- Around line 146-157: Update the matching logic around unmatched_actual so it
selects the matching finding with the earliest end_line, rather than the first
Semgrep result; preserve the existing rule_id and line-range constraints and
remove only the selected match. Add a regression test covering overlapping spans
returned in reversed order, ensuring all expected findings match.
In `@scripts/subprocess_utils.py`:
- Around line 175-179: Update the exception handler in _darwin_cpu_model to use
valid tuple syntax for all listed exception types, preserving the existing
empty-string fallback for command failures.
---
Nitpick comments:
In `@REFERENCES.md`:
- Around line 53-56: Update the scale-sharing description near “Matrix and RHS
scales” to state the invariant using readable Unicode notation: when |e_rhs −
e_matrix| ≤ 64, both sides use min(e_rhs, e_matrix) as the shared scale; when
|e_rhs − e_matrix| > 64, retain independent scales. Preserve the surrounding
explanation of Bareiss elimination.
In `@scripts/bench_compare.py`:
- Around line 425-438: Remove the local _freeze_json and _freeze_mapping
definitions from scripts/bench_compare.py, export those helpers from
performance_artifacts, and import and reuse them alongside the existing imports.
Preserve the current freezing behavior and type-validation contract through the
shared implementations.
In `@scripts/tests/test_performance_artifacts.py`:
- Around line 339-340: Update the assertion for criterion in the relevant
performance artifact test to verify isinstance(criterion, MappingProxyType)
directly, and import MappingProxyType from types. Replace the existing negative
dict assertion so the test pins the frozen mapping type.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3e2b6836-f790-4484-b219-889b04d0b0b8
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (44)
CITATION.cffCONTRIBUTING.mdCargo.tomlREADME.mdREFERENCES.mdbenches/vs_linalg.rsdocs/BENCHMARKING.mddocs/PERFORMANCE.mddocs/RELEASING.mddocs/assets/bench/vs_linalg_lu_solve_median.provenance.jsondocs/mathematical_basis.mddocs/roadmap.mdjustfilepyproject.tomlscripts/README.mdscripts/archive_changelog.pyscripts/archive_performance.pyscripts/bench_compare.pyscripts/check_docs_version_sync.pyscripts/check_semgrep_fixtures.pyscripts/criterion_dim_plot.pyscripts/performance_artifacts.pyscripts/postprocess_changelog.pyscripts/subprocess_utils.pyscripts/tag_release.pyscripts/tests/test_archive_changelog.pyscripts/tests/test_archive_performance.pyscripts/tests/test_bench_compare.pyscripts/tests/test_check_docs_version_sync.pyscripts/tests/test_check_semgrep_fixtures.pyscripts/tests/test_criterion_dim_plot.pyscripts/tests/test_performance_artifacts.pyscripts/tests/test_postprocess_changelog.pyscripts/tests/test_subprocess_utils.pyscripts/tests/test_tag_release.pysrc/lib.rssrc/matrix.rstests/common/proptest_config.rstests/prelude_exports.rstests/proptest_exact.rstests/proptest_factorizations.rstests/proptest_matrix.rstests/proptest_vector.rstests/regressions.rs
- Preserve archived changelog bytes during rollback and reject malformed Unreleased headings. - Match overlapping Semgrep fixture spans deterministically and centralize immutable benchmark provenance handling. - Document exact matrix/RHS scaling and the power-of-two factor that preserves linear systems.
Summary by CodeRabbit
Bug Fixes
Documentation
Chores