#10034 System doens't assing added bonds to defined Preset component#10153
#10034 System doens't assing added bonds to defined Preset component#10153oguzhanduran wants to merge 1 commit into
Conversation
| const rnaComponentToAssign = beginAtomRnaComponent ?? endAtomRnaComponent; | ||
| const struct = this.struct(); | ||
| const atomIdToStartFrom = beginAtomRnaComponent ? bond.begin : bond.end; | ||
| const atomIdToStartFrom = beginAtomRnaComponent ? bond.end : bond.begin; |
There was a problem hiding this comment.
The fix is correct — the previous code seeded the traversal from the atom already assigned to the component, so it walked through component atoms first and could incorrectly trip hasConnectionToOriginalStructure for connections that have nothing to do with the new bond. Two suggestions while this line is being touched:
- Rename
atomIdToStartFrom→unassignedAtomId(or similar). The intent — "start from the unassigned endpoint" — would then be self-documenting, and the ternary's direction obvious by inspection. This is exactly the kind of bug that name-driven clarity prevents from regressing. - Consider adding a focused unit test for this function. The three branches (no component / one component / two components) plus the "unassigned side reaches the original structure" case are highly testable, and a regression test would lock in this silent semantic inversion.
|
Reviewed the one-line fix in Main concern: no test is being added for a silent semantic-inversion bug. Inline suggestions cover a rename to make the intent self-documenting, an outer-loop early-exit, and a small dead-code cleanup. |
|
A couple of pre-existing nits in the same function, optional but cheap to fix while touching it:
|
How the feature works? / How did you fix the issue?
(Screenshots, videos, or GIFs, if applicable)
Check list
#1234 – issue name