mirror of
https://github.com/software-mansion/argent.git
synced 2026-09-14 19:27:14 +08:00
2c68679f28
maxNodes promised 'Maximum total nodes to include' but only ever collapsed single-child wrapper chains of length >= 2 — it never dropped a node, so maxNodes:5 returned a 24-node tree. It also fired against a count the renderer does not produce, and its accounting could exceed the tree. Three defects, all measured: Chain discovery pushed every suffix of a chain as its own chain, because the recursion guard read a map that is not populated until the greedy pass below it. The greedy pass could then collapse an outer chain and one nested inside it, counting the shared nodes twice: an 8-node tree reported '11 wrapper nodes collapsed'. Members are now consumed as chains are taken, and the total is measured as the difference between rendered counts rather than accumulated, so it cannot disagree with the tree above it. The inline marker counted the chain start, which is printed directly above it, so a 7-wrapper chain said 'via 7 wrappers' while hiding 6. The budget was computed from a plain subtree count, but the renderer also skips same-name overlapping siblings. Budgeting against the larger number would have shrunk trees that were already within budget. What maxNodes will not do is drop a node carrying a name, text, testID, or a branch. Truncating those is how a caller concludes an element does not exist when it was merely trimmed — a wrong answer, which is worse than an oversized response. When the budget cannot be reached the response says so and by how much, and points at debugger-inspect-element for narrowing. The schema now describes that contract instead of promising a hard cap. Separately: an element whose centre lies outside the viewport was rendered as '(tap: 0.22,-0.11)'. The on-screen filter keeps such nodes deliberately (a 10% margin, so a partially-visible row still appears), which means the DEFAULT response offered coordinates that cannot land, formatted exactly like real ones. Those now read '(off-screen: x,y)' — the numbers stay, since their sign says which way to scroll, but the tap affordance is gone. Finally, the off-screen count is reported even at zero. Suppressing it is why onScreenOnly:true and false look identical on a screen with nothing off-view, which reads as a broken parameter rather than an inactive filter.