Fix document retention and helper retry regressions

Keep failed cursor trials and native recapture anchored to the original document, and restore the requested cached root before LRU eviction. Base braille retry resets on established connection time rather than stalled startup. Poll private AT-SPI daemon ownership without triggering service activation and clean up partial startup failures. Add focused regressions and update browser testing notes.
This commit is contained in:
Storm Dragon committed 2026-11-03 11:37:36 -05:00
1 parent a4d427099e
commit 4da61465b0
11 files changed
+282 -132

No files matched your search

+56
View File
@@ -583,6 +583,62 @@ func TestDocumentSlotsRetainTreesAcrossRoots(t *testing.T) {
}
}
func TestDocumentSlotsRestoreOldestAtCapacity(t *testing.T) {
adapter := New()
var first *AccessibleTree
for index := range maxStashedDocuments + 1 {
root := NewObjectID(":1.42", fmt.Sprintf("/doc%d", index))
adapter.rotateDocumentSlots(root)
snapshot := NewSnapshot(root.Path, "Document", "document web", "", "")
snapshot.BusName = root.BusName
tree, err := adapter.installCapturedTree(root, []TreeNode{{Snapshot: snapshot}}, true, false)
if err != nil {
t.Fatal(err)
}
if index == 0 {
first = tree
}
}
adapter.rotateDocumentSlots(NewObjectID(":1.42", "/doc0"))
if adapter.documentTree != first {
t.Fatal("returning to oldest retained document evicted it before restoration")
}
if len(adapter.stashedDocuments) != maxStashedDocuments {
t.Fatalf("stashed documents = %d, want %d", len(adapter.stashedDocuments), maxStashedDocuments)
}
}
// These fixtures describe source membership without owning native handles.
func documentSourceKeys[T any](_ map[ObjectID]T, ids ...ObjectID) map[ObjectID]T {
sources := make(map[ObjectID]T, len(ids))
var value T
for _, id := range ids {
sources[id] = value
}
return sources
}
func TestRetainedDocumentRootDoesNotCrossTabsOnSameBus(t *testing.T) {
adapter := New()
active, inactive := testID("/active"), testID("/inactive")
adapter.documentSlotRoot = active
adapter.nativeDocument = documentSourceKeys(adapter.nativeDocument, testID("/active_child"))
adapter.stashedDocumentIDs = []ObjectID{inactive}
adapter.stashedDocuments = map[ObjectID]stashedDocument{
inactive: {sources: documentSourceKeys(adapter.nativeDocument, testID("/removed_child"))},
}
for _, item := range []struct{ focus, want ObjectID }{
{testID("/active_child"), active},
{testID("/removed_child"), inactive},
{testID("/chrome"), ObjectID{}},
{NewObjectID(":1.99", "/removed_child"), ObjectID{}},
} {
if got := adapter.retainedDocumentRoot(item.focus); got != item.want {
t.Fatalf("owner of %v = %v, want %v", item.focus, got, item.want)
}
}
}
// A provider whose capture just timed out is probably still stuck. The
// next document capture for that bus must fail fast with ErrProviderHung
// instead of queueing another multi-second native stall, and the mark