Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions evidence/dm-initial-publication-20261008/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -958,3 +958,25 @@ worst39.9ms; visible53/170.1/worst6.71ms. No broad latency improvement claim.
Exact raw checks: title-scroll-installed.log, title-scroll-wheel.log and
title-scroll-wheel/ under existing dm-native-caption scratch. Published the
reviewed combined cohort for new launches; backend and existing windows remain.

## Visible demand revokes pending body retirement

Toad579 fd5dfde01 derives retirement eligibility from the original
DocumentViewport.requires_body at preflight, after asynchronous capture and
inside original retirement custody. LiveBody keeps its identity when demanded;
that identity alone therefore cannot authorize pruning a newly visible body.
No new visibility field, cache or lifetime owner. The duplicate release guard
is deleted because the same original currentness check now carries demand.

Real native App source and exact installed controls passed: an acquired
capture exposed by actual scrolling retains original reconstructible children;
visible preflight refuses retirement; offscreen retirement still completes.
An initial control incorrectly included the fixed header in the retireable
cohort; negative retained, final control uses reconstructible_children.

Installed sidebar drag completed with36 raw motions and no App error. Seven
frames, frame gaps up to147ms and final width after745ms remain slow. This is
not a performance pass. Current wheel is published for new launches through
the reviewed original publication owner; existing windows retain loaded code.
Exact checks/publication live under visible-retirement-delivery-20261008 and
retirement-installed.log/retirement-sidebar-drag.log in existing scratch.
14 changes: 9 additions & 5 deletions src/toad/widgets/viewport_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ def source_tail(self) -> ViewportBody | None:
Native document order already owns their relation; warm membership
and registration order do not supply another chronology.
"""
return next(reversed(tuple(self.body_roots())), None)
return next(self.body_roots(reverse=True), None)

@property
def source_tail_visible(self) -> bool:
Expand All @@ -1137,13 +1137,17 @@ def source_tail_visible(self) -> bool:

def requires_body(self, owner, *, visible=None, protected=None) -> bool:
"""Native exposure and current interaction own source admission."""
if owner not in self.owners:
return False
if visible is None:
visible = self.window.screen._compositor.visible_widgets
if owner in visible:
return True
if protected is None:
protected = self.protected()
return owner in self.owners and (owner in visible or owner in protected)
return owner in protected

def body_roots(self):
def body_roots(self, *, reverse: bool = False):
"""Native document order, stopping at each registered body boundary.

Descendants belong to that body's materialization, not to another
Expand All @@ -1152,13 +1156,13 @@ def body_roots(self):
"""
if not self.owners:
return
pending = list(reversed(self.window.children))
pending = list(self.window.children if reverse else reversed(self.window.children))
while pending:
node = pending.pop()
if node in self.owners:
yield node
else:
pending.extend(reversed(node.children))
pending.extend(node.children if reverse else reversed(node.children))

def geometry_targets(self) -> tuple[Widget, ...]:
"""Each body's current resource owns its actual geometry demand."""
Expand Down
12 changes: 12 additions & 0 deletions tests/viewport_body_order_pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ async def settle():
await settle()
await viewport.suspend_source()
assert tuple(viewport.body_roots()) == tuple(docs)
if '--tail-traversal' in sys.argv:
assert tuple(viewport.body_roots(reverse=True)) == tuple(reversed(docs))
assert viewport.source_tail is docs[-1]
view.contents.move_child(docs[-1], before=docs[0])
assert viewport.source_tail is docs[-2]
await docs[-2].remove()
assert viewport.source_tail is docs[-3]
assert tuple(viewport.body_roots(reverse=True)) == tuple(
reversed((docs[-1], *docs[:-2])))
assert app._exception is None
print('PASS: current native reorder and removal determine tail and reverse body order')
return
native_descendants = len(window.walk_children())
assert native_descendants > 400
originals = tuple(docs)
Expand Down
Loading