Merge #193 + large-tree-migration tip-limit hardening#196
Merge #193 + large-tree-migration tip-limit hardening#196
Conversation
- add split_int alias and migrate serial/batch split counters to split_int/int32 - harden check_ntip with runtime Rcpp::stop() and informative compiled-limit message - add overflow-safe int64 arithmetic in add_ic_element - add serial interrupt checks every 1024 iterations in all seven serial scorers - centralize R-side tip limits via .SL_MAX_TIPS + .CheckMaxTips loaded from cpp_max_tips() - replace hardcoded 32767L guards across distance, transfer, NNI, MAST and consensus paths - add C++ n_tip guards to all batch entry points - add large-tree functional/guard tests and update existing tip-limit tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #196 +/- ##
==========================================
- Coverage 95.84% 94.27% -1.58%
==========================================
Files 57 57
Lines 5514 5678 +164
==========================================
+ Hits 5285 5353 +68
- Misses 229 325 +96 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Use deterministic 4000-tip as.phylo near-neighbour trees for fast shortcut paths, remove redundant 8000-tip split coverage, and assert known RF expected values plus batch/pairwise agreement. Add a source-level regression test that verifies serial interrupt checks and batch n_tip guards remain wired in C++ paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Guard the C++ source-inspection test so it runs in source-tree test sessions but skips in installed-package testthat runs where src/*.cpp files are unavailable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressed follow-up feedback:
Validation run locally:
|
Remove the .SL_MAX_TIPS global assignment and make tip-limit checks reflect real constraints. Use TreeTools SL_MAX_TIPS as a cache/stack threshold only: add log lookup fallbacks for larger trees, update MCI/SPI/MSI/CID kernels to call safe lookup helpers, and keep runtime guards based on integer/type limits. Add explicit runtime NNI guard at 32768 tips, keep algorithm-specific caps for MAST and consensus-info, and update large-tree/guard tests to validate fast 4000-tip known-answer behaviour and new guard semantics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressed the What changed:
Validation on this branch:
|
Add an ASSERT in add_ic_element() to ensure nTip stays within the safe int32 multiplication range, and keep numerator / denominator as int32 products. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use int-native constexpr limits with static_assert fit checks in cpp_max_tips(), removing unnecessary int64_t intermediate types while preserving safety. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Avoid narrowing overflow in cpp_max_tips() on platforms where int_fast32_t exceeds int width by clamping comparisons in native source types before any cast to int. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Fixed the Ubuntu vignette failure ( Root cause: Fix: Validation re-run on branch:
|
Performance benchmark results
|
Use a local cached accessor in .CheckMaxTips() to avoid repeated cpp_max_tips() calls. Re-introduce direct table-indexed fast paths for SPI/MSI scoring when n_tips is within lookup-table range, while retaining safe lookup fallbacks for larger trees. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Performance benchmark results
|
Summary
This PR combines the missing large-tree resilience features from PR #193 and
large-tree-migration, selecting the stronger approach where they differed.Included features
C++ hardening
split_intalias (int32-based) in public types and re-exported insrc/ints.h.split_int/int32to removeint16bottlenecks.check_ntip()now hard-stops withRcpp::stop()and reports requested tips + compiled limit.int64_toverflow-safe products inadd_ic_element().Rcpp::checkUserInterrupt()checks every 1024 outer iterations in all seven serial scorers.check_ntip()validation at all batch C++ entry points.SL_MAX_*stack arrays).R-side guard centralization
cpp_max_tips()export and wired Rcpp exports..SL_MAX_TIPSinitialization on load and.CheckMaxTips()helper.32767Lguards with centralized.CheckMaxTips()calls.Tests
tests/testthat/test-large-trees.R:.SL_MAX_TIPS.SL_MAX_TIPS/.CheckMaxTips.Validation
devtools::test(filter = 'batch_coverage|tree_distance_utilities')(Previous full-suite run reported one failure caused by missing optional
TBRDistin environment.)