Harden tip-count guards and remove fixed-size RF complement buffers for SL_MAX_TIPS resilience#194
Open
Harden tip-count guards and remove fixed-size RF complement buffers for SL_MAX_TIPS resilience#194
Conversation
Agent-Logs-Url: https://github.com/ms609/TreeDist/sessions/bed5ef86-4ca3-4535-979c-531436fd6bb8 Co-authored-by: ms609 <1695515+ms609@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ms609/TreeDist/sessions/bed5ef86-4ca3-4535-979c-531436fd6bb8 Co-authored-by: ms609 <1695515+ms609@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Start implementation for TreeDist resiliency to SL_MAX_TIPS
Harden tip-count guards and remove fixed-size RF complement buffers for SL_MAX_TIPS resilience
Apr 15, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #194 +/- ##
==========================================
+ Coverage 95.78% 95.84% +0.05%
==========================================
Files 57 57
Lines 5508 5514 +6
==========================================
+ Hits 5276 5285 +9
+ Misses 232 229 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Performance benchmark results
|
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.
This change starts implementation of the SL_MAX_TIPS resilience work by tightening guard behavior and removing assumptions that depend on fixed compile-time split dimensions. It aligns RF paths with existing guard semantics and makes failure modes explicit when tip counts exceed supported bounds.
Guard semantics made consistent across RF C++ entry points
cpp_robinson_foulds_distance()now enforcescheck_ntip()(previously missing).check_ntip()now throws a runtime R error (Rcpp::stop) with the existing user-facing message instead of relying on assertion behavior.min(SL_MAX_TIPS, int16_t::max()), with astatic_assertdocumentingSL_MAX_TIPS/int32assumptions.Removed fixed-size RF complement stack arrays
splitbit b_complement[SL_MAX_SPLITS][SL_MAX_BINS]robinson_foulds_distance()robinson_foulds_info()Centralized R-side tip-limit check in tree-distance utilities
R/tree_distance_utilities.R:.AssertNtipSupported().MaxSupportedTips(documented to stay aligned with C++ guard semantics)Focused regression coverage for boundary behavior
tests/testthat/test-tree_distance_utilities.Rfor:1000,32766,32767)32768).SplitDistanceAllPairs) using the same guard messageOriginal prompt
Start implementation
The user has attached the following file paths as relevant context:
- .github\copilot-instructions.md
- AGENTS.md
[Chronological Review: The conversation began with the user requesting a comparison between PR #193 and their own branch, focusing on how both address the issue of making TreeDist resilient to changes in SL_MAX_TIPS. The user detailed the differences in implementation, strengths, and weaknesses of both approaches. Following this, the user requested to start the implementation based on the evaluation provided, indicating a shift from analysis to action.][Intent Mapping: The user explicitly requested a comparison of PR #193 against their branch, highlighting specific features and shortcomings. They then requested to "start implementation," indicating readiness to proceed with coding based on the evaluation.]
[Technical Inventory: The conversation involved technical concepts such as:
[Code Archaeology: The user is currently working on
tree_distances.cpp, which is central to the implementation of distance calculations in the TreeDist project. The conversation highlighted specific functions and checks that need to be modified or added.][Progress Assessment: The user has completed the analysis of both PR #193 and their branch, identifying key areas for improvement. They are now poised to implement changes based on the recommendations provided.]
[Context Validation: All critical information for continuation is captured, including the need to cherry-pick improvements from PR #193 into the user's branch and the specific changes to be made in
tree_distances.cpp.][Recent Commands Analysis: The last agent command was the user requesting to "start implementation." There were no tool results from this command as it was a directive to begin coding. The immediate pre-summarization state involved the user preparing to implement the changes discussed in the evaluation of PR #193.]
1. Conversation Overview: - Primary Objectives: The user requested a comparison of PR #193 against their branch, stating, "Both address the same core problem — making TreeDist resilient to SL_MAX_TIPS being raised in TreeTools." They then requested to "start implementation" based on the evaluation. - Session Context: The conversation transitioned from a detailed analysis of the two approaches to a directive to begin implementing the recommended changes. - User Intent Evolution: The user moved from analysis and comparison to readiness for implementation, indicating a clear plan to enhance their branch.- Technical Foundation:
- PR Prepare for large-tree support #193: Focused on static array elimination, centralized R guard, and user interrupts.
- User's Branch: Comprehensive migration to support larger trees, including int32 migration and overflow protection.
- Codebase Status:
- File Name:
- Purpose: Central to distance calculations in TreeDist.
- Current State: The user is preparing to implement changes based on the evaluation of PR Prepare for large-tree support #193.
- Key Code Segments: Functions related to distance calculations and checks for SL_MAX_TIPS.
- Dependencies: Changes will impact how distances are calculated and how the system handles larger trees.
- Problem Resolution:
- Issues Encountered: Concerns about misleading claims in PR Prepare for large-tree support #193 regarding support for trees larger than 32767 tips.
- Solutions Implemented: Recommendations to cherry-pick improvements from PR Prepare for large-tree support #193 into the user's branch.
- Progress Tracking:
- Completed Tasks: Analysis of PR Prepare for large-tree support #193 and identification of areas for improvement.
- Partially Complete Work: Implementation of changes in
- Validated Outcomes: The user has a clear plan for the next steps.
- Active Work State:
- Current Focus: The user is ready to implement changes in
- Recent Context: The user has just requested to start implementation after a detailed evaluation of PR Prepare for large-tree support #193.
- Working Code: The user is focused on modifying
- Immediate Context: The user is set to begin coding the recommended changes.
- Recent Operations:
- Last Agent Commands: The user requested to "start implementation."
- Tool Results Summary: No tool results were generated as this was a directive to begin coding.
- Pre-Summary State: The user was preparing to implement changes in
- Operation Context: The user is focused on enhancing their branch by integrating the best aspects of PR Prepare for large-tree support #193.
- Continuation Plan:
- Pending Task: Implement changes in
tree_distances.cpptree_distances.cppis pending.tree_distances.cpp.tree_distances.cppbased on the evaluation.tree_distances.cppbased on the evaluation of PR Prepare for large-tree support #193.tree_distances.cpp...Created from VS Code.