diff --git a/README.md b/README.md index 6b786db..c2c0bd3 100644 --- a/README.md +++ b/README.md @@ -346,12 +346,27 @@ ownership before its result arrives. Native keyboard input, text selection, pointer presses, document loads and leaving the document release that ownership. An unsuccessful native caret placement does not undo a successful virtual move. -When a page replaces a paragraph or heading's only plain text child, navigation -can retain its offset through the same surviving parent and document generation. +When a page replaces a plain text child in a paragraph, heading, section or +ordinary link, navigation can retain its offset through the same surviving +parent and document generation. With multiple children, the replacement must +remain between the same generation-checked adjacent siblings (or the same +start/end boundary). +This prevents repeatedly restarting a paragraph when an inline text object is +recreated. No text-label matching is used to guess a replacement. +This includes CSS-generated link prefixes such as `::before`, which browsers +can recreate when placing the native caret. Explicitly named links retain their +separate label-navigation behavior. Recovery never transfers an activation to +a replacement link. +Read All uses navigation recovery too, and stops if the document generation +changes. Text that disappears during a native read requires a refresh rather +than silently losing that part of the line. When a larger subtree disappears, navigation can restart within its nearest surviving noninteractive container. Ambiguous children, editable controls and replaced parents do not inherit the old offset. Removing a native focus anchor does not reset a still-valid virtual reading position elsewhere in that document. +Verify repeated native replacements, forward/reverse lines and subsequent +Read All with +`CTHULHU_NATIVE_BROWSER_TESTS=replacement,generatedlinks python3 tests/native_browser.py`. Explicitly named links retain their complete accessible label when reading by line. Left/Right, Ctrl+Left/Right, and Home/End review that label by character, diff --git a/docs/testing/browser-release-review.md b/docs/testing/browser-release-review.md index 957d67b..286da1b 100644 --- a/docs/testing/browser-release-review.md +++ b/docs/testing/browser-release-review.md @@ -74,11 +74,42 @@ CTHULHU_NATIVE_BROWSER_TESTS=pointer,positions,dynamic,linkedheadings,document,e python3 tests/native_firefox.py ``` -## Live acceptance still required +## Generated-link recovery acceptance (2026-10-22) + +The original reproduction was the attribution link on +[the Techrights article](https://techrights.org/n/2026/10/22/Linux_Kernel_Needs_Diversity_and_Diversity_of_Good_Code_Not_LLM.shtml). +Brave recreated its CSS-generated `::before` text during native caret placement. +Navigation repeatedly fell back to the containing paragraph instead of advancing. +The first paragraph-only replacement fixture did not cover that link structure. + +Recovery now recognizes a replaced plain text child within the same surviving +ordinary link and adjacent sibling identities. Navigation-triggered defunct +events refresh the affected parent's children while preserving live siblings. +Native text disappearing during text/geometry queries requests a refresh instead +of silently dropping the fragment. Read All uses navigation recovery and rejects +document-generation changes; activation retains its stricter target checks. + +The `generatedlinks` browser fixture uses the page's CSS and reproduces the loop +without a script forcing replacements. It fails with the first recovery fix and +passes with the completed fix, including exact prefix/body text, both navigation +directions and Read All. Three consecutive generated-link runs passed, followed +by a passing combined run of `generatedlinks,replacement,tooltips,fragments,namedlinks,linkedheadings`. +The AT-SPI, review and app race suites, reader build and diff checks passed. + +On 2026-10-22 the maintainer confirmed that the updated reader could read the +entire original article without looping. This accepts full-article reading and +navigation recovery for that live Brave page. The input method was not specified; +separate manual reverse-navigation, Read All, activation and physical Braille +acceptance were not reported. This result does not close the other workflows +below or the separate dynamic-page flat-review failure reproduced before this fix. + +## Other live acceptance checks The contribution policy requires human review and live testing before submission. Automated speech requests and Braille frames do not verify audible output, physical -keys or a physical Braille display. The active reader has not been replaced. +keys or a physical Braille display. Those automated checks use private sessions +rather than the desktop reader; the live reading result above was reported by +the maintainer separately. 1. Quit the current Cthulhu with Cthulhu+Q. Press Ctrl+Escape to enter i3 personal mode, then separately press Shift+G. These are separate key presses. Shift+G diff --git a/docs/testing/flat-review-robustness.md b/docs/testing/flat-review-robustness.md index 990b370..6a90648 100644 --- a/docs/testing/flat-review-robustness.md +++ b/docs/testing/flat-review-robustness.md @@ -55,7 +55,7 @@ alone would not reproduce that behavior. | Clipped text ranges | Previously emitted one range per clipped visible character. | Confirmed defect; repaired here. Count contiguous visible spans against the range budget. | | Viewport discovery | Uses character rectangles first; large objects can use a bounded binary search over line rectangles. | Private GTK coverage seeks into a 101000-character scrolled object with unavailable character rectangles. Small objects keep their existing bounded path. | | Long horizontal lines | Oversized viewport intervals use glyph locations and bounded text retrieval; oversized native line responses also enter that path. | A real GTK 100000-character line is captured without increasing the character budget. New text requests contain at most 128 characters. Sparse or defective point providers remain bounded and explicitly limited. | -| Failure scope | Known unavailable text objects and failed child enumeration retain healthy content with explicit completeness counts. | A partial result announces a speech and Braille warning on entry or a changed omission count. Its line boundaries say top/bottom of available content. Root failure, cancellation, stale snapshots, invalid trees, and aggregate layout limits still fail the operation. | +| Failure scope | Known unavailable text objects and failed child enumeration retain healthy content with explicit completeness counts. | Partial-result counts remain diagnostic log data. Line boundaries always use "Top of screen." and "Bottom of screen."; no extra partial-content speech or Braille message is emitted. Root failure, cancellation, stale snapshots, invalid trees, and aggregate layout limits still fail the operation. | | Focus anchoring | Tries exact focus, displayed descendants, then the nearest displayed ancestor within the review root. | A targeted fixture proves pruned focus stays on its parent text rather than an unrelated first line. Preserved position still uses object generations and native offsets. | | Updates and cancellation | Cthulhu refreshes owned layout per command and rejects stale results; native capture and queues are bounded. | Preserve these safeguards. Snapshot refresh, provider timeout, and audible responsiveness are separate concerns. | | Diagnostics | Capture timings include `text_issues` counts for viewport, character, range, tree-byte, query-budget, and provider failures. Partial presentation logs omission counts. | These fields contain no accessible text or names. A wholly limited window retains its existing spoken text-limit message. | @@ -133,18 +133,19 @@ Bounded endpoint lookup also handles a huge line ending in a zero-area newline. atomic review snapshot. Recovery is restricted to review-only child enumeration; root enumeration failure and cancellation remain fatal. `FlatCompleteness` travels with each worker result. No partial object's accessible name is silently -substituted for its missing text. A warning is announced when entering a partial -layout or when its omission counts change; returning to a complete layout clears -that warning state. Ordinary invalidation triggers recapture as before; there -is no broad automatic retry loop. The warning uses the existing system-message -output path for both speech and Braille, while spelling retains its own request. +substituted for its missing text. Incomplete-capture diagnostics are logged on +entry or when omission counts change; returning to a complete layout clears +that diagnostic state. Ordinary invalidation triggers recapture as before; there +is no broad automatic retry loop. Partial layouts add no speech or Braille +warning, and boundaries retain the standard top/bottom-of-screen messages. +Spelling retains its own request. Seven private native cases cover cache reuse, bounded geometry, clipped spans, a 100000-character horizontal line, scrolled line-only geometry, unavailable child enumeration, and zero-area glyphs. Additional worker and presentation fixtures cover healthy-content recovery, omission counts, recovery to a complete -layout, ancestor anchoring, spelling, Braille warning delivery, and incomplete -boundary feedback. Run native modes in separate processes: +layout, ancestor anchoring, spelling without extra speech/Braille messages, +and standard boundary feedback on incomplete layouts. Run native modes in separate processes: ```sh python3 tests/native_test_session.py env CTHULHU_NATIVE_REVIEW_VIEWPORT=1 CTHULHU_NATIVE_REVIEW_VIEWPORT_MODE=long go test ./internal/atspi -run '^TestNativeFlatReviewLargeTextViewport$' -count=1 -v @@ -175,6 +176,111 @@ changed tree, and a subsequent complete harness run passed. The initial failure was not explained; passing reruns do not establish that this startup/event-order behavior is stable. Existing GTK `Atk-CRITICAL` role warnings also remain. +## Dynamic-page visibility cache regression + +On 2026-10-22, `TestNativeBrowserDynamicNavigation` reproduced a separate +flat-review failure after browse navigation scrolled a 1000-paragraph page to +newly inserted content. Window-end review returned "New content", but previous +line returned the same text with `Moved=false`, including after a text-triggered +recapture. + +Temporary capture diagnostics showed one review line: cached AT-SPI `SHOWING` +states still described the original viewport. Paragraphs now on screen were +treated as hidden, while the originally showing paragraphs had current bounds +far above the window. Cursor restoration was not the cause. The 40 omitted +objects were browser-chrome text-provider failures and remained after the fix; +they did not account for the missing page paragraphs. + +For a node entering a review-only native capture, refresh the cached state bits +before reading its snapshot and geometry. Preserve cached children, interfaces, +and the existing dirty-node refresh policy. This recovers the current viewport +without adding retries or changing any text, range, tree, or deadline limits. +The diagnostic capture then contained 26 review lines. Temporary text-bearing +diagnostics were removed from the code. + +```sh +CTHULHU_NATIVE_BROWSER_TESTS=dynamic python3 tests/native_browser.py +``` + +The strengthened regression keeps the original window-end/previous-line +sequence and requires "New content", "End of page", and "Unrelated paragraph +999" in order. It also checks forward lines, words, characters, the last +character at window end, and backward recovery after the bottom boundary. +Private GTK provider-cache and clipped-text regressions and the native AT-SPI +harness passed, including terminal and table workflows. The table harness still +emitted GTK `Atk-CRITICAL` role warnings while its assertions passed. +Race tests and vet for `internal/atspi`, `internal/review`, and `internal/app`, +plus `go build ./cmd/...`, also passed. The initial ordinary app-package run +could not create private Unix speech sockets inside the sandbox; the approved +race run outside that restriction passed all three packages. + +For live acceptance after an authorized build/restart, browse to the bottom of +a long dynamically updated page. Press Cthulhu+Numpad 9, then Numpad 7: speech +and Braille should move from the final visible line to its predecessor. Check +forward movement back to the final line, bottom feedback, and backward movement +again. Repeat after scrolling back up and check word/character review and a +native terminal. These automated checks do not establish physical-key, audible +speech, or Braille acceptance. + +## Browser chrome omissions and standard messages + +A private Chromium-family browser probe reproduced 40 omitted objects. Native +text queries exposed three distinct provider patterns: containers containing +only embedded-child placeholders, named controls returning their accessible +labels through Text but invalid line offsets, and real text with unavailable +geometry. Both character and range geometry were zero for the failing chrome +objects. The address entry's native Text contained its URL, not its label. + +After a provider failure, bounded verification now allows embedded-only +containers to use child-provided content. A noneditable named control or static +label can use the existing synthetic-name path only when its native text +exactly equals its accessible name and its component is fully inside the clip. +Editable text, passwords, differing names/text, mixed container content, capture +limits, and clipped labels do not qualify. Recovered names have no native text +offsets. This is a generic provider-content rule, not a browser-name exception. + +Tabs and compound menu rows also retain their own label beside independently +named child actions such as Close. Text/label descendants still suppress duplicate +parent labels. Ordinary nested-button suppression is preserved. + +The new browser proof fails with the fixes disabled: Back, Forward, Reload, +New Tab, and the tab label are absent, with 40 omissions. With the fixes enabled, +these controls and popup entries are reviewable. The window fixture reports +two omissions (the address entry and a mixed-text panel); its popup reports +none. These counts describe this fixture, not every browser or screen. +The mixed-text panel remains conservatively unresolved even though a static +child supplies its displayed label. The address URL remains unavailable in flat review because +its visible character span cannot be established from zero geometry. Neither +its label nor its entire potentially clipped value is substituted. Ordinary +address-bar focus and editing remain separate from geometric flat review. + +The partial-content speech/Braille warning is removed. Both complete and partial +layouts use "Top of screen." and "Bottom of screen." Omission counts remain in +diagnostics; fatal capture errors keep their existing messages. Ask before +adding or replacing established user-facing messages. + +```sh +CTHULHU_NATIVE_BROWSER_TESTS=flat-chrome,dynamic,menu python3 tests/native_browser.py +``` + +The new proof checks actual tab-label zones, toolbar controls, focused/unfocused +address handling, and popup review. The dynamic-page proof retains its stale +state-cache fix and backward/forward line, word, and character navigation. +Focused unit cases reject unsafe component recovery and verify tab/menu labels +with child actions and text-label deduplication. Existing cache, clipping, and +zero-area-glyph native checks also remain relevant. + +After an authorized build/restart, check speech and physical Braille separately: +review the tab strip and toolbar, including a tab's title and Close control; +open the browser menu and review its rows and inline controls; return to the +page and exercise dynamic-page backward review. At the first/last review line, +Numpad 7/9 must announce only the standard screen boundary. No partial-content +message should interrupt review or flash Braille. Check normal address-bar +focus/typing, a narrow/scrolled field, passwords, a native terminal, and native +text clipping. Address-value flat review remains a known limitation in the +observed provider. Private tests do not establish audible speech, physical +keys, or Braille acceptance, and the running reader was not replaced. + ## Human review and live acceptance Review the generated diff before submission. With an authorized build/restart: @@ -193,9 +299,10 @@ Review the generated diff before submission. With an authorized build/restart: Password contents must stay excluded. Review must stay in the foreground window and ordinary focus/caret navigation must still work afterward. 4. Exercise a window with one unavailable text object or child subtree. Healthy - content must remain reviewable with an explicit warning. Repeated navigation - should not repeat the warning continuously; after the provider recovers and - the tree is refreshed, ordinary top/bottom feedback must return. + content must remain reviewable without an additional partial-content + announcement. Verify omission diagnostics in the log, then refresh after the + provider recovers. Top/bottom feedback must use the same standard messages + before and after recovery. 5. Confirm audible speech and physical Braille separately, including routing within a merged span. Native capture and Go test success do not establish these outcomes. Preserve fresh logs for any remaining failure. diff --git a/internal/app/browser_dynamic_test.go b/internal/app/browser_dynamic_test.go index e3fbf32..238f7a1 100644 --- a/internal/app/browser_dynamic_test.go +++ b/internal/app/browser_dynamic_test.go @@ -171,20 +171,35 @@ func TestNativeBrowserDynamicNavigation(t *testing.T) { next("Unrelated paragraph 0") next("Unrelated paragraph 1") move(review.CaretDocumentEnd, "New content") - for _, unit := range []review.FlatUnit{review.WindowEnd, review.Line} { + // Browsing to the end scrolls paragraphs which were previously not + // showing into view. Flat review must capture those paragraphs even if + // the provider's state cache still describes the initial viewport. + for index, tc := range []struct { + unit review.FlatUnit + step int + text string + moved bool + }{ + {review.WindowEnd, 0, "New content", true}, + {review.Line, -1, "End of page", true}, + {review.Line, -1, "Unrelated paragraph 999", true}, + {review.Line, 1, "End of page", true}, + {review.Word, 1, "of", true}, + {review.Character, 1, "f", true}, + {review.WindowEnd, 0, "New content", true}, + {review.Character, 0, "t", false}, + {review.Line, 1, "New content", false}, + {review.Line, -1, "End of page", true}, + } { started := time.Now() - step := 0 - if unit == review.Line { - step = -1 - } - if err := worker.ReadFlat(unit, step); err != nil { + if err := worker.ReadFlat(tc.unit, tc.step); err != nil { t.Fatal(err) } select { case result := <-worker.Results(): - t.Logf("flat review unit %d elapsed=%s capture=%s reason=%v", unit, time.Since(started), result.CaptureDuration, result.CaptureReason) - if result.Err != nil || strings.TrimSpace(result.FlatPosition.Text) == "" || unit == review.Line && !result.Moved { - t.Fatalf("large-page flat review unit %d = %+v", unit, result) + t.Logf("flat review unit %d step=%d text=%q moved=%v elapsed=%s capture=%s reason=%v", tc.unit, tc.step, result.FlatPosition.Text, result.Moved, time.Since(started), result.CaptureDuration, result.CaptureReason) + if result.Err != nil || strings.TrimSpace(result.FlatPosition.Text) != tc.text || index > 0 && result.Moved != tc.moved { + t.Fatalf("large-page flat review unit %d step=%d want=%q moved=%v: %+v", tc.unit, tc.step, tc.text, tc.moved, result) } case <-ctx.Done(): t.Fatal(ctx.Err()) diff --git a/internal/app/browser_replacement_native_test.go b/internal/app/browser_replacement_native_test.go new file mode 100644 index 0000000..5e9cd10 --- /dev/null +++ b/internal/app/browser_replacement_native_test.go @@ -0,0 +1,188 @@ +// Copyright (c) 2026 Storm Dragon +// Authors: Storm Dragon, Angus Kola +// SPDX-License-Identifier: GPL-3.0-or-later + +package app + +import ( + "context" + "fmt" + "net/http" + "net/http/httptest" + "os" + "os/exec" + "testing" + "time" + + "git.stormux.org/storm/cthulhu/internal/atspi" + "git.stormux.org/storm/cthulhu/internal/review" +) + +func TestNativeBrowserInlineReplacementNavigation(t *testing.T) { + run_native_replacement_navigation(t, false) +} + +func TestNativeBrowserGeneratedLinkNavigation(t *testing.T) { + run_native_replacement_navigation(t, true) +} + +func run_native_replacement_navigation(t *testing.T, generated bool) { + t.Helper() + if os.Getenv("CTHULHU_NATIVE_BROWSER") != "1" { + t.Skip("requires private browser session") + } + ctx, cancel := context.WithTimeout(context.Background(), 25*time.Second) + defer cancel() + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if generated { + fmt.Fprint(w, `Inline replacement regression + +

Published by Publisher some hours ago. Article continues

`) + return + } + fmt.Fprint(w, `Inline replacement regression +

Published↺ by PublisherArticle continues

+`) + })) + defer server.Close() + adapter := atspi.New() + if err := adapter.Start(ctx); err != nil { + t.Fatal(err) + } + defer adapter.Stop(context.Background()) + command := func(args ...string) { + t.Helper() + if output, err := exec.CommandContext(ctx, "xdotool", args...).CombinedOutput(); err != nil { + t.Fatalf("xdotool: %v: %s", err, output) + } + } + command("key", "--clearmodifiers", "ctrl+l") + command("type", "--clearmodifiers", "--delay", "0", server.URL) + command("key", "Return") + var document atspi.ObjectID + for !document.Valid() { + select { + case event := <-adapter.Events(): + if event.Type == atspi.DocumentLoadCompleteEvent && event.Source.Name == "Inline replacement regression" { + document = event.Source.ID() + } + case <-ctx.Done(): + t.Fatal(ctx.Err()) + } + } + worker, err := review.NewWorker(adapter, 2*time.Second) + if err != nil { + t.Fatal(err) + } + if err := worker.Start(ctx); err != nil { + t.Fatal(err) + } + defer worker.Stop(context.Background()) + worker.SyncFocus(document) + dump_generated_tree := func() { + if !generated { + return + } + tree, captureErr := adapter.CaptureDocument(ctx, document) + if captureErr != nil { + return + } + ref, _ := tree.Reference(document) + doc, _ := tree.Document(ctx, ref) + for _, node := range doc.Nodes { + if node.Snapshot.Role == "static" { + text, err := adapter.ReadDocumentCaret(ctx, node.Reference, 0, atspi.DocumentCaretLine) + t.Logf("native node %s parent=%s name=%q count=%d text=%+v err=%v", node.Snapshot.Path, node.Parent.Path, node.Snapshot.Name, node.Snapshot.CharacterCount, text, err) + } + } + } + move := func(command review.DocumentCaretCommand, want string) review.Result { + t.Helper() + if err := worker.MoveDocumentCaret(command); err != nil { + t.Fatal(err) + } + select { + case result := <-worker.Results(): + // Generated text can disappear between a successful virtual move + // and native placement. A caret error must not undo that move; + // require the exact text and subsequent navigation/replacement + // checks rather than requiring the transient native caret to stick. + if result.Err != nil || result.CaretErr != nil && !generated || !result.Moved || result.DocumentCaretText != want { + dump_generated_tree() + t.Fatalf("%s: text=%q want=%q err=%v caret=%v diagnostics=%+v", command, + result.DocumentCaretText, want, result.Err, result.CaretErr, result.DocumentDiagnostics) + } + if generated && result.CaretErr != nil { + t.Logf("generated native caret: %v; virtual movement succeeded", result.CaretErr) + } + return result + case <-ctx.Done(): + t.Fatal(ctx.Err()) + return review.Result{} + } + } + move(review.CaretNextLine, "Published") + attribution, after := "↺ by Publisher", "Article continues" + if generated { + attribution, after = "↺ by Publisher some hours ago", ". Article continues" + } + current := move(review.CaretNextLine, attribution) + for generation := 0; generation < 4; generation++ { + old := current.DocumentPosition.Object + if !generated { + command("key", "--clearmodifiers", "F8") + } + // Require a genuinely replaced native static-text object. Merely + // changing a label would not exercise recovery of a missing cursor. + for { + tree, err := adapter.CaptureDocument(ctx, document) + if err != nil { + t.Fatal(err) + } + if _, err := tree.Resolve(old); err != nil { + break + } + select { + case <-adapter.Events(): + case <-ctx.Done(): + t.Fatal("native attribution object was not replaced: ", ctx.Err()) + } + } + if generation%2 == 0 { + move(review.CaretNextLine, after) + current = move(review.CaretPreviousLine, attribution) + } else { + move(review.CaretPreviousLine, "Published") + current = move(review.CaretNextLine, attribution) + } + } + if err := worker.ReadAll(ctx); err != nil { + t.Fatal(err) + } + select { + case result := <-worker.Results(): + if result.Err != nil || len(result.ReadAllLines) != 2 { + t.Fatalf("Read All after replacement: err=%v lines=%d", result.Err, len(result.ReadAllLines)) + } + for index, want := range []string{attribution, after} { + if got := result.ReadAllLines[index].Contents[0].Text; got != want { + dump_generated_tree() + t.Fatalf("Read All line %d: %q, want %q", index, got, want) + } + } + case <-ctx.Done(): + t.Fatal(ctx.Err()) + } +} diff --git a/internal/app/flat_review.go b/internal/app/flat_review.go index 1d37d84..1e9ce72 100644 --- a/internal/app/flat_review.go +++ b/internal/app/flat_review.go @@ -84,14 +84,8 @@ func presentFlatReviewResult(logger *slog.Logger, speech speechEnqueuer, result boundary = true if result.FlatStep < 0 { text = "Top of screen." - if result.FlatCompleteness.Incomplete() { - text = "Top of available content." - } } else { text = "Bottom of screen." - if result.FlatCompleteness.Incomplete() { - text = "Bottom of available content." - } } } else { text = presentation.FlatReviewText(result.FlatPosition.Text, result.FlatUnit == review.Character || result.FlatUnit == review.LineEnd) @@ -107,7 +101,6 @@ func presentFlatReviewResult(logger *slog.Logger, speech speechEnqueuer, result if result.FlatWarning { logger.Warn("flat review content incomplete", "omitted_text_objects", result.FlatCompleteness.OmittedObjects, "unavailable_subtrees", result.FlatCompleteness.UnavailableSubtrees) - speech.Enqueue(speechRequest{Text: "Some visible content is unavailable for flat review.", Role: "system", Cause: "flat-review-warning"}) } speech.Enqueue(request) if logger.Enabled(context.Background(), slog.LevelDebug) { diff --git a/internal/app/flat_review_test.go b/internal/app/flat_review_test.go index 5742c9e..8f1cb67 100644 --- a/internal/app/flat_review_test.go +++ b/internal/app/flat_review_test.go @@ -29,7 +29,7 @@ import ( "git.stormux.org/storm/cthulhu/internal/review" ) -func TestFlatReviewPartialWarningPreservesSpellingAndFlashesBraille(t *testing.T) { +func TestFlatReviewPartialDiagnosticsPreserveSpellingWithoutExtraMessages(t *testing.T) { live := &liveSettings{} live.Store(config.DefaultSettings()) braille := &flashRecorder{} @@ -38,18 +38,22 @@ func TestFlatReviewPartialWarningPreservesSpellingAndFlashesBraille(t *testing.T result := review.Result{FlatUnit: review.Word, FlatSpeech: review.FlatSpell, FlatWarning: true, FlatCompleteness: review.FlatCompleteness{OmittedObjects: 1}, FlatPosition: review.FlatPosition{Text: "cat"}} presentFlatReviewResult(slog.New(slog.DiscardHandler), output, result) - warning, content := <-queue.requests, <-queue.requests - if warning.Cause != "flat-review-warning" || len(warning.Spelling) != 0 || len(content.Spelling) != 3 || content.Text != "cat" { - t.Fatalf("warning/content metadata = %+v / %+v", warning, content) + content := <-queue.requests + if len(content.Spelling) != 3 || content.Text != "cat" || len(queue.requests) != 0 { + t.Fatalf("content metadata or extra message: %+v, queued=%d", content, len(queue.requests)) } - if len(braille.messages) != 1 || braille.messages[0] != warning.Text { - t.Fatalf("Braille warning missing: %v", braille.messages) + if len(braille.messages) != 0 { + t.Fatalf("unexpected Braille warning: %v", braille.messages) } - result.FlatWarning = false - result.FlatUnit, result.FlatStep, result.Moved = review.Line, 1, false + result.FlatUnit, result.FlatStep, result.Moved = review.Line, -1, false presentFlatReviewResult(slog.New(slog.DiscardHandler), output, result) - if boundary := <-queue.requests; boundary.Text != "Bottom of available content." { - t.Fatalf("partial boundary claimed complete screen: %+v", boundary) + if boundary := <-queue.requests; boundary.Text != "Top of screen." { + t.Fatalf("partial top boundary: %+v", boundary) + } + result.FlatStep = 1 + presentFlatReviewResult(slog.New(slog.DiscardHandler), output, result) + if boundary := <-queue.requests; boundary.Text != "Bottom of screen." || len(queue.requests) != 0 { + t.Fatalf("partial bottom boundary or extra message: %+v", boundary) } } diff --git a/internal/atspi/adapter_document_native.go b/internal/atspi/adapter_document_native.go index 6247d2e..97a9d69 100644 --- a/internal/atspi/adapter_document_native.go +++ b/internal/atspi/adapter_document_native.go @@ -291,6 +291,10 @@ func (adapter *Adapter) readNativeDocumentCaret(ctx context.Context, position Ob C.g_error_free(nativeErr) return DocumentCaretText{}, err } + if count == 0 && snapshot.CharacterCount > 0 && !snapshot.Editable && + (snapshot.Role == "static" || snapshot.Role == "text") { + return DocumentCaretText{}, adapter.document_text_became_empty(position.ID()) + } if count <= 0 || offset >= count { if unit != DocumentCaretBrailleLine || count <= 0 || offset != count { return DocumentCaretText{CharacterCount: count}, nil @@ -316,11 +320,34 @@ func (adapter *Adapter) readNativeDocumentCaret(ctx context.Context, position Ob // Geometry is optional: unavailable bounds keep object-local reading. // Query on the GLib owner; no native reference leaves this operation. if line.Start >= 0 && line.End > line.Start && line.End <= count { - line.Bounds, _ = (nativeReviewText{text: text}).bounds(ctx, line.Start, line.End) + var boundsErr error + line.Bounds, boundsErr = (nativeReviewText{text: text}).bounds(ctx, line.Start, line.End) + if boundsErr != nil { + if err := adapter.document_object_error(position.ID(), boundsErr); errors.Is(err, ErrDeadObject) { + return DocumentCaretText{}, err + } + } if err := ctx.Err(); err != nil { return DocumentCaretText{}, err } } + // Generated text can disappear between the count, line and geometry + // queries. Keep missing geometry optional for live text, but refresh a + // stale text object instead of dropping its fragment from the line. + if !snapshot.Editable && (snapshot.Role == "static" || snapshot.Role == "text") && + (!line.Bounds.Valid() || line.End <= line.Start) { + var verifyErr *C.GError + remaining := int(C.atspi_text_get_character_count(text, &verifyErr)) + if verifyErr != nil { + err := adapter.document_object_error(position.ID(), nativeError("verify document text count", verifyErr)) + C.g_error_free(verifyErr) + if errors.Is(err, ErrDeadObject) { + return DocumentCaretText{}, err + } + } else if remaining == 0 && count > 0 { + return DocumentCaretText{}, adapter.document_text_became_empty(position.ID()) + } + } if unit == DocumentCaretLineRemainder && line.Start < offset && offset < line.End && offset-line.Start <= utf8.RuneCountInString(line.Text) { line.Text = string([]rune(line.Text)[offset-line.Start:]) line.Start = offset diff --git a/internal/atspi/adapter_tree_native.go b/internal/atspi/adapter_tree_native.go index 67f8e38..ae89dff 100644 --- a/internal/atspi/adapter_tree_native.go +++ b/internal/atspi/adapter_tree_native.go @@ -135,12 +135,18 @@ func captureNativeTree(ctx context.Context, root *C.AtspiAccessible, reviewBusNa // Reusing live siblings matches Python's event-driven web cache and // prevents a small insertion from repeatedly timing out on a big page. // New document and flat-review nodes already have libatspi's - // event-maintained cache. Clearing it forces another child-count + // cached child lists. Clearing them forces another child-count // request even for a cached leaf, which can fail on a busy provider. // Known dirty entries still need a fresh provider snapshot. Preserve // the existing full refresh for desktop/object capture. if known || (!document && !reviewOnly) { C.atspi_accessible_clear_cache_single(source) + } else if reviewOnly { + // A browse scroll can leave SHOWING cached from the previous + // viewport without a state-change event for each descendant. + // Refresh states on entry to visual capture, while preserving + // cached children and interfaces for slow native providers. + source.cached_properties &^= C.ATSPI_CACHE_STATES } applicationName, knownApplication := applicationNames[nativeObjectID(source).BusName] if knownApplication { @@ -212,7 +218,7 @@ func captureNativeTree(ctx context.Context, root *C.AtspiAccessible, reviewBusNa text = cached.text } else { var textErr error - text, textErr = textFromNative(ctx, source, geometry, snapshot.Role, clip) + text, textErr = textFromNative(ctx, source, geometry, snapshot, clip) if textErr != nil { C.g_object_unref(C.gpointer(source)) releasePending() @@ -513,10 +519,9 @@ func (adapter *Adapter) applyTreeInvalidation(eventType string, event *C.AtspiEv detail1 := int(C.cthulhu_event_detail1(event)) // Setting Chromium's caret can retire the target or one of its descendants // and immediately replace it with a new provider object. That defunct event - // is part of the navigation echo, not evidence that the captured document - // order changed. Preserve the semantic document snapshot for the next move; - // object and visual-review trees still invalidate normally. Suppression is - // limited to the target subtree recorded immediately before caret placement. + // is part of the navigation echo, but its native object is still dead. + // Retain the document and live siblings while refreshing the affected + // parent's children, so navigation can recover the replacement. navigationDefunct := eventType == DefunctStateEvent && detail1 != 0 && adapter.navigationEcho[sourceID] != 0 adapter.invalidateTreeEventWithPolicy(eventType, detail1, sourceID, childID, navigationDefunct) if navigationDefunct { @@ -551,7 +556,7 @@ func (adapter *Adapter) invalidateTreeEvent(eventType string, detail1 int, sourc adapter.invalidateTreeEventWithPolicy(eventType, detail1, sourceID, childID, false) } -func (adapter *Adapter) invalidateTreeEventWithPolicy(eventType string, detail1 int, sourceID, childID ObjectID, preserveDocument bool) { +func (adapter *Adapter) invalidateTreeEventWithPolicy(eventType string, detail1 int, sourceID, childID ObjectID, navigationDefunct bool) { if eventType == DefunctStateEvent && detail1 == 0 { return } @@ -567,7 +572,14 @@ func (adapter *Adapter) invalidateTreeEventWithPolicy(eventType string, detail1 trees := []*AccessibleTree{adapter.tree, adapter.documentTree, adapter.documentTextTree} adapter.treeMutex.Unlock() for index, tree := range trees { - if preserveDocument && index == 1 { + if navigationDefunct && index == 1 && tree != nil { + tree.mu.RLock() + entry := tree.nodes[sourceID] + tree.mu.RUnlock() + adapter.treeInvalidations.Add(uint64(tree.Invalidate(sourceID))) + if entry.hasParent { + adapter.treeInvalidations.Add(uint64(tree.MarkChildrenChanged(entry.parent))) + } continue } // Structural matching consumes the semantic document snapshot. Other diff --git a/internal/atspi/adapter_tree_test.go b/internal/atspi/adapter_tree_test.go index 1549131..a19e4be 100644 --- a/internal/atspi/adapter_tree_test.go +++ b/internal/atspi/adapter_tree_test.go @@ -335,7 +335,7 @@ func TestAdapterTreeInvalidationPolicy(t *testing.T) { } }) - t.Run("navigation defunct preserves semantic document", func(t *testing.T) { + t.Run("navigation defunct refreshes semantic children", func(t *testing.T) { owned := testTree(t) document := testTree(t) visual := testTree(t) @@ -343,15 +343,22 @@ func TestAdapterTreeInvalidationPolicy(t *testing.T) { adapter.tree = owned adapter.documentTree = document adapter.documentTextTree = visual + root, _ := document.Root() + sibling, _ := document.Reference(testID("/second")) target := testID("/first") adapter.invalidateTreeEventWithPolicy(DefunctStateEvent, 1, target, ObjectID{}, true) - for name, tree := range map[string]*AccessibleTree{"owned": owned, "visual": visual} { + for name, tree := range map[string]*AccessibleTree{"owned": owned, "visual": visual, "document": document} { if _, err := tree.Reference(target); !errors.Is(err, ErrObjectNotFound) { t.Fatalf("%s target error = %v, want missing", name, err) } } - if _, err := document.Reference(target); err != nil { - t.Fatalf("semantic document target was invalidated: %v", err) + for _, reference := range []ObjectReference{root, sibling} { + if _, err := document.Resolve(reference); err != nil { + t.Fatalf("navigation defunct invalidated live context: %v", err) + } + } + if _, _, err := document.FirstChild(root); !errors.Is(err, ErrIncompleteTree) { + t.Fatalf("navigation defunct did not refresh parent children: %v", err) } }) } diff --git a/internal/atspi/document_error.go b/internal/atspi/document_error.go index 22c54d6..2370107 100644 --- a/internal/atspi/document_error.go +++ b/internal/atspi/document_error.go @@ -9,6 +9,27 @@ import ( "strings" ) +// A removed Chromium generated-text object can return zero characters before +// its removal event reaches us. Refresh its metadata and parent's child order +// rather than silently skipping text from an obsolete snapshot. Empty text +// alone does not prove removal, so keep identities and live siblings intact. +func (adapter *Adapter) document_text_became_empty(object ObjectID) error { + adapter.treeMutex.Lock() + tree := adapter.documentTree + adapter.treeMutex.Unlock() + if tree != nil { + tree.mu.RLock() + entry := tree.nodes[object] + tree.mu.RUnlock() + adapter.treeInvalidations.Add(uint64(tree.InvalidateSnapshot(object))) + if entry.hasParent { + adapter.treeInvalidations.Add(uint64(tree.MarkChildrenChanged(entry.parent))) + } + } + delete(adapter.documentLineCache, object) + return ErrStaleText +} + // libatspi forwards Chromium's missing-object response as an untyped GError. // Match the queried path exactly; a timeout or unsupported caret is not proof // that the virtual reading position has disappeared. diff --git a/internal/atspi/document_error_test.go b/internal/atspi/document_error_test.go index c20e9eb..9efc084 100644 --- a/internal/atspi/document_error_test.go +++ b/internal/atspi/document_error_test.go @@ -58,3 +58,28 @@ func TestDocumentCaretFailuresDoNotRetireLiveTargets(t *testing.T) { }) } } + +func TestDocumentEmptyTextRefreshesMetadataAndParentWithoutRetiringTargets(t *testing.T) { + adapter := New() + tree := testTree(t) + adapter.documentTree = tree + object := testID("/second") + target, _ := tree.Reference(object) + sibling, _ := tree.Reference(testID("/first")) + if err := adapter.document_text_became_empty(object); !errors.Is(err, ErrStaleText) { + t.Fatalf("unexpected empty-text classification: %v", err) + } + if current, err := tree.Reference(object); err != nil || current != target { + t.Fatalf("empty text retired an unconfirmed target: %v", err) + } + if _, err := tree.Resolve(target); !errors.Is(err, ErrStaleSnapshot) { + t.Fatalf("text metadata did not require refresh: %v", err) + } + if _, err := tree.Resolve(sibling); err != nil { + t.Fatalf("live sibling was invalidated: %v", err) + } + root, _ := tree.Root() + if _, _, err := tree.FirstChild(root); !errors.Is(err, ErrIncompleteTree) { + t.Fatalf("parent's children did not require refresh: %v", err) + } +} diff --git a/internal/atspi/text.go b/internal/atspi/text.go index 4b4dbf6..2236979 100644 --- a/internal/atspi/text.go +++ b/internal/atspi/text.go @@ -499,3 +499,54 @@ func searchTextOffset(ctx context.Context, source reviewTextSource, count int, a } return low, nil } + +// recover_review_component distinguishes synthetic Text interfaces from failed +// text-bearing objects. It never invents offsets or uses editable values as names. +// A label is usable only when it exactly matches the bounded native text and the +// component is fully inside the clip. Embedded-only text belongs to children. +func recover_review_component(ctx context.Context, source interface { + reviewTextSource + reviewSpanSource +}, snapshot Snapshot, geometry Geometry, clip Rectangle) (VisibleText, bool) { + if snapshot.Editable { + return VisibleText{}, false + } + label := false + switch snapshot.Role { + case "button", "push button", "toggle button", "check box", "radio button", "page tab", + "menu item", "check menu item", "radio menu item", "link", "label", "static", "separator": + label = true + case "frame", "panel", "tool bar", "page tab list", "alert", "menu", "menu bar": + default: + return VisibleText{}, false + } + count, err := source.count(ctx) + if err != nil || count <= 0 || count > maxReviewLineCharacters { + return VisibleText{}, false + } + var content strings.Builder + for start := 0; start < count; { + end := start + min(count-start, maxReviewBoundsCharacters) + span, err := source.text_span(ctx, start, end) + if err != nil || !utf8.ValidString(span) || utf8.RuneCountInString(span) != end-start { + return VisibleText{}, false + } + content.WriteString(span) + start = end + } + if ctx.Err() != nil { + return VisibleText{}, false + } + value := content.String() + if strings.Trim(value, "\ufffc") == "" { + // Review will visit the embedded children and count unavailable + // subtrees separately. No text of this object's own was lost. + return VisibleText{Known: true}, true + } + if label && snapshot.Name != "" && value == snapshot.Name && geometry.BoundsKnown && geometry.Bounds == clip { + // Leave text unknown: layout uses the existing synthetic name path + // only if children do not already supply displayed content. + return VisibleText{}, true + } + return VisibleText{}, false +} diff --git a/internal/atspi/text_component_test.go b/internal/atspi/text_component_test.go new file mode 100644 index 0000000..86e2f0e --- /dev/null +++ b/internal/atspi/text_component_test.go @@ -0,0 +1,54 @@ +// Copyright (c) 2026 Storm Dragon +// Authors: Storm Dragon, Angus Kola +// SPDX-License-Identifier: GPL-3.0-or-later + +package atspi + +import ( + "context" + "strings" + "testing" + "unicode/utf8" +) + +func TestReviewComponentRecoveryRequiresVerifiedContent(t *testing.T) { + clip := Rectangle{Width: 200, Height: 20} + for _, tc := range []struct { + name, role, native, label string + editable, clipped, want, known bool + }{ + {name: "named toolbar control", role: "button", native: "Back", label: "Back", want: true}, + {name: "named separator", role: "separator", native: "Separator", label: "Separator", want: true}, + {name: "named label", role: "static", native: "Café 猫", label: "Café 猫", want: true}, + {name: "child-only container", role: "panel", native: "\ufffc\ufffc", want: true, known: true}, + {name: "child-only tab", role: "page tab", native: "\ufffc", label: "Tab metadata", want: true, known: true}, + {name: "mixed container", role: "panel", native: "Text\ufffc", label: "Text"}, + {name: "mismatched name", role: "button", native: "Visible", label: "Other"}, + {name: "editable field", role: "entry", native: "Visible", label: "Visible", editable: true}, + {name: "readonly field", role: "entry", native: "Visible", label: "Visible"}, + {name: "password", role: "password text", native: "Secret", label: "Secret"}, + {name: "terminal", role: "terminal", native: "Text", label: "Text"}, + {name: "clipped label", role: "static", native: "Hidden suffix", label: "Hidden suffix", clipped: true}, + {name: "oversized label", role: "button", native: strings.Repeat("x", maxReviewLineCharacters+1), label: strings.Repeat("x", maxReviewLineCharacters+1)}, + } { + t.Run(tc.name, func(t *testing.T) { + source := &pointReviewText{fakeReviewText: fakeReviewText{characters: utf8.RuneCountInString(tc.native)}, textByOffset: map[int]string{}} + for i, r := range []rune(tc.native) { + source.textByOffset[i] = string(r) + } + geometry := Geometry{Bounds: clip, BoundsKnown: true} + if tc.clipped { + geometry.Bounds.Width++ + } + got, ok := recover_review_component(context.Background(), source, Snapshot{Role: tc.role, Name: tc.label, Editable: tc.editable}, geometry, clip) + if ok != tc.want || got.Known != tc.known || len(got.Ranges) != 0 || got.CaretKnown { + t.Fatalf("recovery = %+v, %v", got, ok) + } + ctx, cancel := context.WithCancel(context.Background()) + cancel() + if _, ok := recover_review_component(ctx, source, Snapshot{Role: tc.role, Name: tc.label}, geometry, clip); ok { + t.Fatal("recovered canceled request") + } + }) + } +} diff --git a/internal/atspi/text_native.go b/internal/atspi/text_native.go index 11f0670..8ffc16c 100644 --- a/internal/atspi/text_native.go +++ b/internal/atspi/text_native.go @@ -269,11 +269,11 @@ func (source nativeReviewText) range_bounds(ctx context.Context, start, end int) // Only called from captureNativeTree on the adapter's GLib thread. Unsupported, // hidden, protected, and failed text queries remain unavailable to review. -func textFromNative(ctx context.Context, accessible *C.AtspiAccessible, geometry Geometry, role string, clip Rectangle) (VisibleText, error) { +func textFromNative(ctx context.Context, accessible *C.AtspiAccessible, geometry Geometry, snapshot Snapshot, clip Rectangle) (VisibleText, error) { if err := ctx.Err(); err != nil { return VisibleText{}, err } - if !geometry.BoundsKnown || !clip.Valid() || role == "password text" { + if !geometry.BoundsKnown || !clip.Valid() || snapshot.Role == "password text" { return VisibleText{}, nil } text := C.atspi_accessible_get_text_iface(accessible) @@ -281,13 +281,21 @@ func textFromNative(ctx context.Context, accessible *C.AtspiAccessible, geometry return VisibleText{}, ctx.Err() } defer C.g_object_unref(C.gpointer(text)) - result, err := captureVisibleText(ctx, nativeReviewText{text: text, terminal: role == "terminal"}, clip) + result, err := captureVisibleText(ctx, nativeReviewText{text: text, terminal: snapshot.Role == "terminal"}, clip) if err != nil { if ctx.Err() != nil { return VisibleText{}, ctx.Err() } result = VisibleText{Issue: TextProviderFailure} } + if result.Issue == TextProviderFailure && ctx.Err() == nil { + // Some providers advertise Text on component-only controls and + // containers. Verify their bounded content before allowing the + // established accessible-name/child-content path to handle them. + if recovered, ok := recover_review_component(ctx, nativeReviewText{text: text}, snapshot, geometry, clip); ok { + result = recovered + } + } if result.Issue != "" { capture_diagnostics(ctx).text_issue(result.Issue) } diff --git a/internal/review/document.go b/internal/review/document.go index fe650c9..e74190f 100644 --- a/internal/review/document.go +++ b/internal/review/document.go @@ -66,9 +66,9 @@ type documentPlace struct { offset int tableCell atspi.ObjectID tableRow, tableColumn int - // A single text child can be replaced while its paragraph remains live. - // Retain the generation-checked parent rather than search by label/index. - textParent atspi.ObjectReference + // A text child can be replaced while its parent and adjacent siblings live. + // Generation-checked boundaries distinguish replacement from insertion. + textParent, textPrevious, textNext atspi.ObjectReference // Bounded surviving ancestry is a navigation fallback, never an action target. recoveryParents []atspi.ObjectReference } diff --git a/internal/review/document_inline_replacement_test.go b/internal/review/document_inline_replacement_test.go new file mode 100644 index 0000000..5d6b98f --- /dev/null +++ b/internal/review/document_inline_replacement_test.go @@ -0,0 +1,269 @@ +// Copyright (c) 2026 Storm Dragon +// Authors: Storm Dragon, Angus Kola +// SPDX-License-Identifier: GPL-3.0-or-later + +package review + +import ( + "context" + "fmt" + "testing" + "time" + "unicode/utf8" + + "git.stormux.org/storm/cthulhu/internal/atspi" +) + +func inline_replacement_cursor(t *testing.T, role string, slot int) (*DocumentCursor, caretTextReader, []atspi.TreeNode) { + t.Helper() + reader := caretTextReader{webID("/before"): "Published", webID("/old"): "↺ by Publisher", webID("/after"): "Article continues"} + paths := []string{"/before", "/after"} + paths = append(paths[:slot], append([]string{"/old"}, paths[slot:]...)...) + nodes := []atspi.TreeNode{ + {Snapshot: atspi.Snapshot{BusName: webID("/doc").BusName, Path: "/doc", Role: "document web"}, Children: []atspi.ObjectID{webID("/paragraph")}}, + {Snapshot: atspi.Snapshot{BusName: webID("/doc").BusName, Path: "/paragraph", Role: role}}, + } + if role == "link" { + nodes[1].Snapshot.Focusable, nodes[1].Snapshot.SupportsClick = true, true + } + for _, path := range paths { + nodes[1].Children = append(nodes[1].Children, webID(path)) + nodes = append(nodes, atspi.TreeNode{Snapshot: atspi.Snapshot{BusName: webID(path).BusName, + Path: path, Role: "static", CharacterCount: utf8.RuneCountInString(reader[webID(path)])}}) + } + tree, err := atspi.NewAccessibleTree(webID("/doc"), nodes) + if err != nil { + t.Fatal(err) + } + cursor, err := NewDocumentCursor(tree) + if err != nil { + t.Fatal(err) + } + if _, err := cursor.SyncFocus(context.Background(), webID("/paragraph")); err != nil { + t.Fatal(err) + } + if _, err := cursor.MoveCaret(context.Background(), reader, CaretReadLine); err != nil { + t.Fatal(err) + } + for index := 0; index < slot; index++ { + if _, err := cursor.MoveCaret(context.Background(), reader, CaretNextLine); err != nil { + t.Fatal(err) + } + } + return cursor, reader, nodes +} + +func TestDocumentCaretRecoversReplacedInlineText(t *testing.T) { + for _, role := range []string{"paragraph", "heading", "section", "link"} { + for slot := 0; slot < 3; slot++ { + t.Run(fmt.Sprintf("%s/%d", role, slot), func(t *testing.T) { + cursor, reader, nodes := inline_replacement_cursor(t, role, slot) + ctx := context.Background() + for generation := 0; generation < 4; generation++ { + path := fmt.Sprintf("/replacement%d", generation) + reader[webID(path)] = "↺ by Publisher" + nodes[1].Children[slot] = webID(path) + nodes[slot+2].Snapshot.Path = path + if err := cursor.tree.Replace(webID("/doc"), nodes); err != nil { + t.Fatal(err) + } + position, recovery, err := cursor.sync_focus(ctx, webID("/paragraph")) + if err != nil || recovery != "replaced-text-child" || position.Object.ID() != webID(path) { + t.Fatalf("replacement %d: %+v, %s, %v", generation, position, recovery, err) + } + move := func(command DocumentCaretCommand, want string) { + t.Helper() + result, err := cursor.MoveCaret(ctx, reader, command) + if err != nil || !result.Moved || result.Text != want { + t.Fatalf("%s after replacement %d: %+v, %v; want %q", command, generation, result, err, want) + } + } + move(CaretNextCharacter, " ") // Unicode offsets remain character based. + move(CaretPreviousCharacter, "↺") + if slot == 2 { + move(CaretPreviousLine, "Article continues") + move(CaretNextLine, "↺ by Publisher") + } else { + want := "Article continues" + if slot == 0 { + want = "Published" + } + move(CaretNextLine, want) + move(CaretPreviousLine, "↺ by Publisher") + } + } + }) + } + } +} + +func TestDocumentLinkReplacementPreservesActivationOwnership(t *testing.T) { + for _, kind := range []string{"same link", "replaced link", "named link", "editable link"} { + t.Run(kind, func(t *testing.T) { + cursor, _, nodes := inline_replacement_cursor(t, "link", 1) + ctx := context.Background() + originalTarget, err := cursor.ActivationTarget() + if err != nil || originalTarget.ID() != webID("/paragraph") { + t.Fatalf("original link target: %v, %v", originalTarget.ID(), err) + } + nodes[1].Children[1] = webID("/new") + nodes[3].Snapshot.Path = "/new" + switch kind { + case "replaced link": + cursor.tree.Invalidate(webID("/paragraph")) + case "named link": + nodes[1].Snapshot.ExplicitName = true + case "editable link": + nodes[1].Snapshot.Editable = true + } + if err := cursor.tree.Replace(webID("/doc"), nodes); err != nil { + t.Fatal(err) + } + if _, err := cursor.syncActionFocus(ctx, webID("/paragraph")); err == nil { + t.Fatal("activation silently recovered a missing text target") + } + position, recovery, err := cursor.sync_focus(ctx, webID("/paragraph")) + if err != nil { + t.Fatal(err) + } + if kind != "same link" { + if recovery == "replaced-text-child" || position.Object.ID() == webID("/new") { + t.Fatal("changed link inherited the old text cursor") + } + return + } + target, err := cursor.ActivationTarget() + if err != nil || recovery != "replaced-text-child" || target != originalTarget { + t.Fatalf("navigation changed link ownership: target=%v recovery=%s err=%v", target.ID(), recovery, err) + } + }) + } +} + +func TestReadAllAfterInlineReplacementRecovery(t *testing.T) { + cursor, reader, nodes := inline_replacement_cursor(t, "paragraph", 1) + nodes[1].Children[1] = webID("/new") + nodes[3].Snapshot.Path = "/new" + reader[webID("/new")] = reader[webID("/old")] + if err := cursor.tree.Replace(webID("/doc"), nodes); err != nil { + t.Fatal(err) + } + worker, _ := NewWorker(&readAllCapturer{tree: cursor.tree, caretTextReader: reader}, time.Second) + worker.SyncFocus(webID("/paragraph")) + result := worker.readAll(context.Background(), cursor) + if result.Err != nil || len(result.ReadAllLines) != 2 { + t.Fatalf("Read All after inline replacement: %+v", result) + } + for index, want := range []string{"↺ by Publisher", "Article continues"} { + if got := result.ReadAllLines[index].Contents[0].Text; got != want { + t.Fatalf("line %d = %q, want %q", index, got, want) + } + } +} + +func TestReadAllRecoveryRejectsReplacedDocument(t *testing.T) { + for _, refresh := range []bool{false, true} { + t.Run(fmt.Sprint(refresh), func(t *testing.T) { + cursor, reader, nodes := inline_replacement_cursor(t, "link", 1) + cursor.tree.Invalidate(webID("/doc")) + if err := cursor.tree.Replace(webID("/doc"), nodes); err != nil { + t.Fatal(err) + } + worker, _ := NewWorker(&readAllCapturer{tree: cursor.tree, caretTextReader: reader}, time.Second) + worker.SyncFocus(webID("/paragraph")) + if refresh { + if _, err := worker.refresh_read_all_cursor(context.Background(), cursor, webID("/paragraph")); err == nil { + t.Fatal("Read All refresh crossed a document generation") + } + return + } + result := worker.readAll(context.Background(), cursor) + if result.Err == nil || len(result.ReadAllLines) != 0 { + t.Fatal("Read All inherited the position in a replacement document") + } + }) + } +} + +func TestDocumentInlineReplacementRetainsAndClampsUnicodeOffset(t *testing.T) { + for _, replacement := range []string{"↺ by Another publisher", "↺"} { + t.Run(replacement, func(t *testing.T) { + cursor, reader, nodes := inline_replacement_cursor(t, "paragraph", 1) + ctx := context.Background() + move, err := cursor.MoveCaret(ctx, reader, CaretNextWord) + if err != nil || move.Position.Offset != 4 { + t.Fatalf("word movement: offset=%d err=%v", move.Position.Offset, err) + } + nodes[1].Children[1] = webID("/new") + nodes[3].Snapshot.Path = "/new" + nodes[3].Snapshot.CharacterCount = utf8.RuneCountInString(replacement) + reader[webID("/new")] = replacement + if err := cursor.tree.Replace(webID("/doc"), nodes); err != nil { + t.Fatal(err) + } + position, recovery, err := cursor.sync_focus(ctx, webID("/paragraph")) + wantOffset := min(move.Position.Offset, utf8.RuneCountInString(replacement)-1) + if err != nil || recovery != "replaced-text-child" || position.Offset != wantOffset { + t.Fatalf("replacement: offset=%d want=%d recovery=%s err=%v", position.Offset, wantOffset, recovery, err) + } + }) + } +} + +func TestDocumentInlineReplacementRejectsAmbiguousOrInteractiveChanges(t *testing.T) { + for _, kind := range []string{"inserted child", "removed neighbor", "replaced neighbor", "reordered neighbors", + "replaced parent", "replaced document", "hidden parent", "editable parent", "clickable parent", "focusable parent", + "hidden child", "editable child", "clickable child", "focusable child", "named child", "password child", "native origin"} { + t.Run(kind, func(t *testing.T) { + cursor, reader, nodes := inline_replacement_cursor(t, "paragraph", 1) + nodes[1].Children[1] = webID("/new") + nodes[3].Snapshot.Path = "/new" + reader[webID("/new")] = reader[webID("/old")] + switch kind { + case "inserted child": + nodes[1].Children = append(nodes[1].Children[:2], webID("/extra"), webID("/after")) + nodes = append(nodes, atspi.TreeNode{Snapshot: atspi.Snapshot{BusName: webID("/extra").BusName, Path: "/extra", Role: "static", CharacterCount: 5}}) + case "removed neighbor": + nodes[1].Children = nodes[1].Children[1:] + nodes = append(nodes[:2], nodes[3:]...) + case "replaced neighbor": + cursor.tree.Invalidate(webID("/before")) + case "reordered neighbors": + nodes[1].Children[0], nodes[1].Children[2] = nodes[1].Children[2], nodes[1].Children[0] + case "replaced parent": + cursor.tree.Invalidate(webID("/paragraph")) + case "replaced document": + cursor.tree.Invalidate(webID("/doc")) + case "hidden parent": + nodes[1].Geometry.VisibilityKnown = true + case "editable parent": + nodes[1].Snapshot.Editable = true + case "clickable parent": + nodes[1].Snapshot.SupportsClick = true + case "focusable parent": + nodes[1].Snapshot.Focusable = true + case "hidden child": + nodes[3].Geometry.VisibilityKnown = true + case "editable child": + nodes[3].Snapshot.Editable = true + case "clickable child": + nodes[3].Snapshot.SupportsClick = true + case "focusable child": + nodes[3].Snapshot.Focusable = true + case "named child": + nodes[3].Snapshot.ExplicitName = true + case "password child": + nodes[3].Snapshot.Role = "password text" + case "native origin": + cursor.places[0].origin = NativeNavigation + } + if err := cursor.tree.Replace(webID("/doc"), nodes); err != nil { + t.Fatal(err) + } + position, recovery, err := cursor.sync_focus(context.Background(), webID("/paragraph")) + if err != nil || recovery == "replaced-text-child" || position.Object.ID() == webID("/new") { + t.Fatalf("unsafe replacement accepted: object=%+v recovery=%s err=%v", position.Object.ID(), recovery, err) + } + }) + } +} diff --git a/internal/review/document_replacement.go b/internal/review/document_replacement.go index 1c3f3c6..4d6298b 100644 --- a/internal/review/document_replacement.go +++ b/internal/review/document_replacement.go @@ -7,11 +7,12 @@ package review import "git.stormux.org/storm/cthulhu/internal/atspi" // Orca recovers removed caret contexts from the surviving parent. Here the -// bounded case is one plain text leaf under the same paragraph or heading. -// Multiple children, interactive containers and replaced parent/document -// generations cannot establish that the old offset still belongs here. +// bounded case is one plain text leaf between the same adjacent siblings. +// Retain only its parent and two generation-checked boundary references; +// labels and child indices alone cannot establish the old reading position. func remember_text_parent(doc atspi.DocumentSnapshot, place *documentPlace) { place.textParent = atspi.ObjectReference{} + place.textPrevious, place.textNext = atspi.ObjectReference{}, atspi.ObjectReference{} place.recoveryParents = nil // Nodes are in provider preorder. Walking backwards follows the parent // chain in one scan, without rescanning all nodes for each ancestor. @@ -28,6 +29,29 @@ func remember_text_parent(doc atspi.DocumentSnapshot, place *documentPlace) { } if len(place.recoveryParents) == 0 && plainText && replacement_text_parent(node) { place.textParent = node.Reference + for childIndex, id := range node.Children { + if id != place.object.ID() { + continue + } + if len(node.Children) == 1 { + break + } + for _, sibling := range doc.Nodes { + if childIndex > 0 && sibling.Reference.ID() == node.Children[childIndex-1] { + place.textPrevious = sibling.Reference + } + if childIndex+1 < len(node.Children) && sibling.Reference.ID() == node.Children[childIndex+1] { + place.textNext = sibling.Reference + } + if (childIndex == 0 || place.textPrevious.Valid()) && (childIndex+1 == len(node.Children) || place.textNext.Valid()) { + break + } + } + if childIndex > 0 && !place.textPrevious.Valid() || childIndex+1 < len(node.Children) && !place.textNext.Valid() { + place.textParent = atspi.ObjectReference{} + } + break + } } if node.Reference == place.document || len(place.recoveryParents) == 32 { break @@ -60,13 +84,34 @@ func replacement_text_node(doc atspi.DocumentSnapshot, saved documentPlace) (ats if saved.document != doc.Context.TopLevel || !saved.textParent.Valid() || saved.origin != CaretNavigation { return atspi.DocumentNode{}, false } + byID := make(map[atspi.ObjectID]*atspi.DocumentNode, len(doc.Nodes)) + for index := range doc.Nodes { + node := &doc.Nodes[index] + byID[node.Reference.ID()] = node + } for _, parent := range doc.Nodes { if parent.Reference != saved.textParent || !replacement_text_parent(parent) { continue } - for _, child := range doc.Nodes { - if child.Reference.ID() == parent.Children[0] && replacement_text_leaf(child) { - return child, true + for index, id := range parent.Children { + var previous, next atspi.ObjectReference + if index > 0 { + sibling := byID[parent.Children[index-1]] + if sibling == nil { + continue + } + previous = sibling.Reference + } + if index+1 < len(parent.Children) { + sibling := byID[parent.Children[index+1]] + if sibling == nil { + continue + } + next = sibling.Reference + } + child := byID[id] + if previous == saved.textPrevious && next == saved.textNext && child != nil && replacement_text_leaf(*child) { + return *child, true } } } @@ -74,9 +119,18 @@ func replacement_text_node(doc atspi.DocumentSnapshot, saved documentPlace) (ats } func replacement_text_parent(node atspi.DocumentNode) bool { - return len(node.Children) == 1 && !node.Hidden && !node.ParentEditable && - !node.Snapshot.Editable && !node.Snapshot.Focusable && !node.Snapshot.SupportsClick && - (node.Snapshot.Role == "paragraph" || node.Snapshot.Role == "heading") + if len(node.Children) == 0 || node.Hidden || node.ParentEditable || node.Snapshot.Editable { + return false + } + // Ordinary links retain their native text children. CSS-generated text + // (including ::before) can be recreated when its native caret is placed. + // Recover only navigation within the same surviving link and sibling + // boundaries. Activation still checks the saved target before SyncFocus. + if node.Snapshot.Role == "link" { + return !node.Snapshot.ExplicitName + } + return !node.Snapshot.Focusable && !node.Snapshot.SupportsClick && + (node.Snapshot.Role == "paragraph" || node.Snapshot.Role == "heading" || node.Snapshot.Role == "section") } func replacement_text_leaf(node atspi.DocumentNode) bool { diff --git a/internal/review/document_worker.go b/internal/review/document_worker.go index 3be107c..c03527f 100644 --- a/internal/review/document_worker.go +++ b/internal/review/document_worker.go @@ -421,6 +421,17 @@ func (cursor *DocumentCursor) syncActionFocus(ctx context.Context, focus atspi.O // Refresh before an action, retaining the virtual position only within the same // document and focus. Never substitute another link if the selected one vanished. func (worker *Worker) refreshDocumentCursor(ctx context.Context, cursor *DocumentCursor, focus atspi.ObjectID) (*DocumentCursor, error) { + return worker.refresh_document_cursor(ctx, cursor, focus, false) +} + +// Read All is navigation: a missing text child can recover within the same +// captured tree using its generation-checked parent and sibling boundaries. +// Activation keeps the stricter refreshDocumentCursor path above. +func (worker *Worker) refresh_read_all_cursor(ctx context.Context, cursor *DocumentCursor, focus atspi.ObjectID) (*DocumentCursor, error) { + return worker.refresh_document_cursor(ctx, cursor, focus, true) +} + +func (worker *Worker) refresh_document_cursor(ctx context.Context, cursor *DocumentCursor, focus atspi.ObjectID, recoverNavigation bool) (*DocumentCursor, error) { var saved documentPlace if cursor != nil && len(cursor.places) > 0 { saved = cursor.places[len(cursor.places)-1] @@ -431,6 +442,13 @@ func (worker *Worker) refreshDocumentCursor(ctx context.Context, cursor *Documen if err != nil { return cursor, err } + if recoverNavigation && cursor != nil && cursor.tree == tree { + position, err := cursor.SyncFocus(ctx, focus) + if err == nil && saved.document.Valid() && (saved.focus.ID() == focus || saved.object.ID() == focus) && saved.document != position.Document { + return cursor, errors.New("read all: document changed") + } + return cursor, err + } fresh, err := NewDocumentCursor(tree) if err != nil { return cursor, err diff --git a/internal/review/flat_browser_native_test.go b/internal/review/flat_browser_native_test.go new file mode 100644 index 0000000..c5503b8 --- /dev/null +++ b/internal/review/flat_browser_native_test.go @@ -0,0 +1,147 @@ +// Copyright (c) 2026 Storm Dragon +// Authors: Storm Dragon, Angus Kola +// SPDX-License-Identifier: GPL-3.0-or-later + +package review + +import ( + "context" + "os" + "os/exec" + "strings" + "testing" + "time" + + "git.stormux.org/storm/cthulhu/internal/atspi" +) + +func TestNativeBrowserChromeFlatReview(t *testing.T) { + if os.Getenv("CTHULHU_NATIVE_BROWSER") != "1" { + t.Skip("requires private browser session") + } + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + adapter := atspi.New() + if err := adapter.Start(ctx); err != nil { + t.Fatal(err) + } + defer adapter.Stop(context.Background()) + keys := func(chord string) { + t.Helper() + if out, err := exec.CommandContext(ctx, "xdotool", "key", "--clearmodifiers", chord).CombinedOutput(); err != nil { + t.Fatalf("keys: %v %s", err, out) + } + } + wait := func(match func(atspi.Event) bool) atspi.Event { + t.Helper() + for { + select { + case e := <-adapter.Events(): + if match(e) { + return e + } + case <-ctx.Done(): + t.Fatal("missing browser event: ", ctx.Err()) + return atspi.Event{} + } + } + } + capture := func(focus atspi.ObjectID) ([]flatLine, atspi.ReviewSnapshot) { + t.Helper() + tree, err := adapter.CaptureReviewWindow(ctx, focus) + if err != nil { + t.Fatal(err) + } + snapshot, err := tree.ReviewWindow(ctx, focus) + if err != nil { + t.Fatal(err) + } + lines, status, err := build_flat_layout(ctx, snapshot.Nodes) + if err != nil { + t.Fatal(err) + } + t.Logf("review lines=%d completeness=%+v", len(lines), status) + return lines, snapshot + } + contains := func(lines []flatLine, want string) bool { + for _, line := range lines { + for _, zone := range line.zones { + if strings.Contains(zone.text, want) { + return true + } + } + } + return false + } + keys("ctrl+l") + address := wait(func(e atspi.Event) bool { + return (e.Type == atspi.FocusEvent || e.Type == atspi.FocusedStateEvent && e.Detail1 != 0) && e.Source.Role == "entry" + }) + lines, snapshot := capture(address.Source.ID()) + for _, name := range []string{"Back", "Forward", "Reload", "New Tab"} { + if !contains(lines, name) { + t.Errorf("browser control missing from review: %q", name) + } + } + tabLabel := false + for _, line := range lines { + for _, zone := range line.zones { + tabLabel = tabLabel || zone.role == "page tab" && strings.Contains(zone.text, "Cthulhu Browser Probe") + } + } + if !tabLabel { + t.Error("tab's label missing beside its Close button") + } + for _, n := range snapshot.Nodes { + if n.Text.Issue != "" { + t.Logf("unresolved text object: role=%s issue=%s children=%d", n.Snapshot.Role, n.Text.Issue, len(n.Children)) + } + } + // Chrome currently returns zero character/range geometry for the address + // value. Do not substitute its accessible label for the missing URL. + for _, n := range snapshot.Nodes { + if n.Snapshot.ID() != address.Source.ID() { + continue + } + if !n.Text.Known && n.Text.Issue == "" { + t.Fatal("unavailable address text lost its diagnostic") + } + if n.Text.Issue != "" { + for _, line := range lines { + for _, zone := range line.zones { + if zone.object == address.Source.ID() { + t.Fatalf("address label substituted for unavailable URL: %+v", zone) + } + } + } + t.Logf("address value remains unavailable: %s", n.Text.Issue) + } else { + t.Logf("address value captured in %d spans", len(n.Text.Ranges)) + } + } + keys("F6") + wait(func(e atspi.Event) bool { + return (e.Type == atspi.FocusEvent || e.Type == atspi.FocusedStateEvent && e.Detail1 != 0) && e.Source.Role != "entry" + }) + unfocusedLines, unfocusedSnapshot := capture(address.Source.ID()) + for _, n := range unfocusedSnapshot.Nodes { + if n.Snapshot.ID() == address.Source.ID() && !n.Text.Known && n.Text.Issue == "" { + t.Fatal("unfocused address text lost its diagnostic") + } + } + if !contains(unfocusedLines, "Reload") { + t.Fatal("toolbar lost after leaving address bar") + } + keys("Escape") + keys("F10") + wait(func(e atspi.Event) bool { + return (e.Type == atspi.FocusEvent || e.Type == atspi.FocusedStateEvent && e.Detail1 != 0) && e.Source.Role == "button" + }) + keys("Down") + menu := wait(func(e atspi.Event) bool { return e.Type == atspi.WindowActivatedEvent && e.Source.Role == "menu" }) + lines, _ = capture(menu.Source.ID()) + if !contains(lines, "New tab") && !contains(lines, "New Tab") { + t.Fatal("popup menu entries missing from flat review") + } + keys("Escape") +} diff --git a/internal/review/flat_layout.go b/internal/review/flat_layout.go index b6133e9..5a31d5f 100644 --- a/internal/review/flat_layout.go +++ b/internal/review/flat_layout.go @@ -150,6 +150,7 @@ func collect_flat_zones(ctx context.Context, nodes []atspi.TreeNode, parents map var zones []flatZone textBytes := 0 hasContent := make(map[atspi.ObjectID]bool, len(nodes)) + labelContent := make(map[atspi.ObjectID]bool, len(nodes)) // Reverse tree order allows container names to be suppressed when their // children already supply displayed content. for i := len(nodes) - 1; i >= 0; i-- { @@ -162,6 +163,9 @@ func collect_flat_zones(ctx context.Context, nodes []atspi.TreeNode, parents map if hasContent[id] { hasContent[parent.ID()] = true } + if labelContent[id] && !flat_label_control(n.Snapshot.Role) { + labelContent[parent.ID()] = true + } if hidden[id] { continue } @@ -234,7 +238,12 @@ func collect_flat_zones(ctx context.Context, nodes []atspi.TreeNode, parents map zones = append(zones, z) } } - if len(zones) == before && !hasContent[id] && !n.ChildrenUnavailable { + // An independently named child control (for example a tab's Close + // button) does not supply its parent's label. Ordinary text children + // still suppress that label, avoiding duplicate displayed text. + composite := n.Snapshot.Role == "page tab" || n.Snapshot.Role == "menu item" + needsName := !hasContent[id] || composite && !labelContent[id] + if len(zones) == before && needsName && !n.ChildrenUnavailable { // Never derive review text from focus-speech Text, ValueText, or // password contents. Names are synthetic and have no text offset. base.text = n.Snapshot.Name @@ -255,10 +264,24 @@ func collect_flat_zones(ctx context.Context, nodes []atspi.TreeNode, parents map if len(zones) > before || hasContent[id] { hasContent[parent.ID()] = true } + if !flat_label_control(n.Snapshot.Role) && (len(zones) > before || labelContent[id]) { + labelContent[parent.ID()] = true + } } return zones, nil } +// Named child controls represent independent actions rather than their +// enclosing control's label. Text/label descendants retain normal deduplication. +func flat_label_control(role string) bool { + switch role { + case "button", "push button", "toggle button", "check box", "radio button", "page tab", + "menu item", "check menu item", "radio menu item": + return true + } + return false +} + // arrange_flat_lines keeps stable provider order for geometry ties and computes // Unicode word spans only after all bounded content has been collected. func arrange_flat_lines(ctx context.Context, nodes []atspi.TreeNode, zones []flatZone) ([]flatLine, error) { diff --git a/internal/review/flat_robustness_test.go b/internal/review/flat_robustness_test.go index 55631f5..66b5a9c 100644 --- a/internal/review/flat_robustness_test.go +++ b/internal/review/flat_robustness_test.go @@ -123,3 +123,48 @@ func TestFlatWorkerWarnsOnceAndClearsRecoveredCompleteness(t *testing.T) { t.Fatalf("recovery result = %+v", result) } } + +func TestFlatReviewCompositeControlKeepsLabelBesideChildAction(t *testing.T) { + for _, role := range []string{"page tab", "menu item"} { + for _, withLabel := range []bool{false, true} { + t.Run(role+map[bool]string{false: " action only", true: " with text label"}[withLabel], func(t *testing.T) { + parent := flatNode("/parent", "", 0, 0) + parent.Snapshot.Role, parent.Snapshot.Name = role, "Primary label" + parent.Text = atspi.VisibleText{Known: true} + child := flatNode("/child", "", 150, 0) + child.Geometry.Bounds.Width = 20 + child.Snapshot.Role, child.Snapshot.Name = "button", "Close" + child.Text = atspi.VisibleText{} + parent.Children = []atspi.ObjectID{child.Snapshot.ID()} + nodes := []atspi.TreeNode{parent, child} + if withLabel { + label := flatNode("/label", "Primary label", 0, 0) + label.Snapshot.Role = "static" + label.Geometry.Bounds.Width = 100 + label.Text.Ranges[0].Bounds = label.Geometry.Bounds + parent.Children = append(parent.Children, label.Snapshot.ID()) + nodes[0] = parent + nodes = append(nodes, label) + } + lines, status, err := build_flat_layout(context.Background(), nodes) + if err != nil || status.Incomplete() { + t.Fatalf("layout: %+v %v", status, err) + } + names, actions := 0, 0 + for _, line := range lines { + for _, zone := range line.zones { + if zone.text == "Primary label" { + names++ + } + if zone.text == "Close" { + actions++ + } + } + } + if names != 1 || actions != 1 { + t.Fatalf("label count=%d action count=%d", names, actions) + } + }) + } + } +} diff --git a/internal/review/read_all.go b/internal/review/read_all.go index a0ac032..4a8de0f 100644 --- a/internal/review/read_all.go +++ b/internal/review/read_all.go @@ -23,15 +23,24 @@ func (worker *Worker) readAll(ctx context.Context, cursor *DocumentCursor) Resul } if cursor != nil { cursor = &DocumentCursor{tree: cursor.tree, active: cursor.active, places: append([]documentPlace(nil), cursor.places...)} - _, result.Err = cursor.syncActionFocus(ctx, result.DocumentFocus) + var saved documentPlace + if len(cursor.places) > 0 { + saved = cursor.places[len(cursor.places)-1] + } + position, err := cursor.SyncFocus(ctx, result.DocumentFocus) + result.Err = err + if err == nil && saved.document.Valid() && (saved.focus.ID() == result.DocumentFocus || saved.object.ID() == result.DocumentFocus) && saved.document != position.Document { + result.Err = errors.New("read all: document changed") + return result + } } else { result.Err = ErrNoCurrent } if documentNeedsCapture(result.Err) { - cursor, result.Err = worker.refreshDocumentCursor(ctx, cursor, result.DocumentFocus) + cursor, result.Err = worker.refresh_read_all_cursor(ctx, cursor, result.DocumentFocus) } if documentNeedsCapture(result.Err) { - cursor, result.Err = worker.refreshDocumentCursor(ctx, cursor, result.DocumentFocus) + cursor, result.Err = worker.refresh_read_all_cursor(ctx, cursor, result.DocumentFocus) } if errors.Is(result.Err, atspi.ErrNotInDocument) { if reader, ok := worker.nativeCapturerFor(result.DocumentFocus).(interface { @@ -111,7 +120,7 @@ func (worker *Worker) readAll(ctx context.Context, cursor *DocumentCursor) Resul result.Err = err return result } - refreshed, refreshErr := worker.refreshDocumentCursor(ctx, cursor, result.DocumentFocus) + refreshed, refreshErr := worker.refresh_read_all_cursor(ctx, cursor, result.DocumentFocus) if refreshErr != nil { result.Err = refreshErr return result @@ -147,7 +156,7 @@ func (worker *Worker) readAllMove(ctx context.Context, cursor *DocumentCursor, r if err == nil || !documentNeedsCapture(err) { return movement, cursor, err } - cursor, refreshErr := worker.refreshDocumentCursor(ctx, cursor, focus) + cursor, refreshErr := worker.refresh_read_all_cursor(ctx, cursor, focus) if refreshErr != nil { return movement, cursor, refreshErr } diff --git a/testdata/parity-ledger.csv b/testdata/parity-ledger.csv index fa680fa..f2d67fb 100644 --- a/testdata/parity-ledger.csv +++ b/testdata/parity-ledger.csv @@ -19,7 +19,7 @@ managed-descendant-presentation,src/cthulhu/scripts/default.py,focus,Resolve foc ssip-speak-cancel,src/cthulhu/speechdispatcherfactory.py,speech,Send speech and cancellation through SSIP,Storm Dragon,internal/speech,in-progress,go test ./internal/speech -count=1,Maintainer accepted audible non-consuming Control/Shift interruption in the Stage 1 physical Xorg checklist on 2026-09-11.,,Maintainer heard lifecycle and terminal speech plus Control/Shift interruption during the accepted Stage 1 physical Xorg checklist on 2026-09-11.,,Protocol replies 230 and 225 were confirmed against the local service; broader backend and X11 coverage remains pending. web-structural-navigation,src/cthulhu/scripts/web/script.py,web,Move by headings and other document structure,Storm Dragon,internal/input internal/review internal/app,implemented,go test -race ./... -count=1; python3 tests/native_browser.py,Private Brave/Xvfb structural and mode/chrome sequences pass on 2026-09-20.,,Maintainer confirms extensive live browser testing passes in Firefox and Chromium-based browsers on 2026-10-22; element lists and jumping to selected items are explicitly confirmed. See docs/testing/release-acceptance.md.,,Structural navigation follows native caret movement. Echo suppression ends on subsequent input. Failed same-object context capture retries. Delayed document carets cannot override editable focus and stale results cannot overwrite unresolved unrelated focus. All 27 browse symbols pass through after routing is disabled. Complete Python structural settings and dialogs remain pending. Parity review corrections and remaining physical gates: docs/testing/parity-review-follow-up.md. web-document-recapture,src/cthulhu/ax_object.py,web,Recover heading navigation after browser document replacement,Storm Dragon,internal/atspi internal/review internal/app,implemented,go test -race ./... -count=1; python3 tests/native_browser.py,Private Brave/Xvfb passes immediate H after loading a new page and after activating its return link on 2026-09-20.,,Maintainer confirms extensive live browser testing passes in Firefox and Chromium-based browsers on 2026-10-22; element lists and jumping to selected items are explicitly confirmed. See docs/testing/release-acceptance.md.,,Native caches refresh on recapture. Load completion retains the new root and resets browser context and pending reading. Worker page epochs retire queued and in-flight results across reused paths. Native reload and mode/chrome tests remain covered. Installed Go preview and Brave Origin are not verified. On 2026-09-21 semantic invalidation was scoped to captured objects so browser chrome and other applications cannot discard the document. Focused race tests and the full private Brave suite pass; heading/link jumps assert capture reuse. Large-page latency and logged stale-object failures still require physical retesting. September 22 log regressions: native invalid text-end recovery and bounded embedded text expansion; web name-event suppression; background load preserves verified chrome focus. Focused race tests and private Brave proofs pass. See docs/testing/chromium-browser.md for reference behavior and remaining physical gates. September 23 ownership correction rejects loads outside the current application or known window and after owner loss; accepted loads update the focus owner for correct defunct recovery. Five event-loop regressions and app race tests pass; physical acceptance remains pending. September 24 same-geometry window recovery now requires fresh active/showing/non-iconified state before foreground correlation; private recovery regression fails on the earlier preview and passes on the rebuilt one. Address changes outside the owned field are suppressed; popup-associated typing remains supported. September 25 review: recovery now checks the fresh tree when text/geometry recapture discovers a removed focus; deterministic regression and focused race checks pass. -web-caret-line-reading,src/cthulhu/scripts/web/script.py,web,Read displayed document content at the browser caret,Storm Dragon,internal/atspi internal/review internal/app internal/presentation,implemented,go test -race ./... -count=1; python3 tests/native_browser.py,Private Brave/Xvfb H/Down/H and expanded page transition sequences pass on 2026-09-20.,,Maintainer confirms extensive live browser testing passes in Firefox and Chromium-based browsers on 2026-10-22; element lists and jumping to selected items are explicitly confirmed. See docs/testing/release-acceptance.md.,,Captured and assembled document lines use role/state sound categories and speech fallback. Unit tests cover visited links and per-object cue deduplication and sound-only versus speech-only policy. Character and word intents remain separate. Ordinary caret movement updates structural position. Initial read-all is implemented; braille and complete line-presentation parity remain pending. September 22 log regressions: native invalid text-end recovery and bounded embedded text expansion; web name-event suppression; background load preserves verified chrome focus. Focused race tests and private Brave proofs pass. See docs/testing/chromium-browser.md for reference behavior and remaining physical gates. September 24 prerequisite review: pending caret/terminal timers extracted under the same event-loop owner; adjacent-character word navigation and whitespace and embedded-marker traversal corrected; whole caret movement deadline added. Full race and isolated Brave/X11/ownership proofs pass; physical and installed-preview gates remain pending. See docs/testing/chromium-browser.md for dependency order. September 24 log correction: browse word and line speech includes link and heading ancestors with role sound policy; character output retains character granularity. Native Brave assertions cover link words and document-start heading level. See docs/testing/chromium-browser.md. September 25 review: trailing non-text objects no longer cause false stale-location errors for line/document-edge movement; focused regression and private Brave suite pass. Physical listening remains open. Explicitly named links retain whole-label line speech while character and word review use accessible-label offsets independently of native text. Generic unit and private Brave named-link regressions cover empty native text and badges plus both directions across following punctuation. Live speech and physical Braille acceptance remain pending. +web-caret-line-reading,src/cthulhu/scripts/web/script.py,web,Read displayed document content at the browser caret,Storm Dragon,internal/atspi internal/review internal/app internal/presentation,implemented,"go test -race ./... -count=1; python3 tests/native_browser.py; go test -race ./internal/atspi ./internal/review ./internal/app -count=1; CTHULHU_NATIVE_BROWSER_TESTS=generatedlinks,replacement,tooltips,fragments,namedlinks,linkedheadings python3 tests/native_browser.py",Private Brave/Xvfb H/Down/H and expanded page transition sequences pass on 2026-09-20. On 2026-10-22 the maintainer confirmed reading the entire original Techrights article in Brave without looping after the generated-link recovery fix. See docs/testing/browser-release-review.md#generated-link-recovery-acceptance-2026-10-22.,,Maintainer confirms extensive live browser testing passes in Firefox and Chromium-based browsers on 2026-10-22; element lists and jumping to selected items are explicitly confirmed. See docs/testing/release-acceptance.md. Original Techrights full-article reading accepted after the generated-link fix on 2026-10-22; see docs/testing/browser-release-review.md#generated-link-recovery-acceptance-2026-10-22.,,Captured and assembled document lines use role/state sound categories and speech fallback. Unit tests cover visited links and per-object cue deduplication and sound-only versus speech-only policy. Character and word intents remain separate. Ordinary caret movement updates structural position. Initial read-all is implemented; braille and complete line-presentation parity remain pending. September 22 log regressions: native invalid text-end recovery and bounded embedded text expansion; web name-event suppression; background load preserves verified chrome focus. Focused race tests and private Brave proofs pass. See docs/testing/chromium-browser.md for reference behavior and remaining physical gates. September 24 prerequisite review: pending caret/terminal timers extracted under the same event-loop owner; adjacent-character word navigation and whitespace and embedded-marker traversal corrected; whole caret movement deadline added. Full race and isolated Brave/X11/ownership proofs pass; physical and installed-preview gates remain pending. See docs/testing/chromium-browser.md for dependency order. September 24 log correction: browse word and line speech includes link and heading ancestors with role sound policy; character output retains character granularity. Native Brave assertions cover link words and document-start heading level. See docs/testing/chromium-browser.md. September 25 review: trailing non-text objects no longer cause false stale-location errors for line/document-edge movement; focused regression and private Brave suite pass. Physical listening remains open. Explicitly named links retain whole-label line speech while character and word review use accessible-label offsets independently of native text. Generic unit and private Brave named-link regressions cover empty native text and badges plus both directions across following punctuation. Live speech and physical Braille acceptance remain pending. October 22 generated-link regression verifies exact prefix/body text with forward/reverse lines and Read All in private Brave. The maintainer accepted full-article reading on the original Techrights page after the fix; other live gates remain scoped to their named workflows. See docs/testing/browser-release-review.md#generated-link-recovery-acceptance-2026-10-22. config-read-preview,src/cthulhu/backends/toml_backend.py,settings,Read existing Cthulhu TOML and merge the startup profile,Storm Dragon,internal/config,implemented,go test ./internal/config ./cmd/cthulhu -count=1,,,,,Read-only preview bridge available only through explicit --config selection. The Go-native schema and default path are intentionally separate; the one-shot importer remains Phase 8 work. config-speech-preview,src/cthulhu/speechdispatcherfactory.py,speech,Apply supported active-profile speech settings,Storm Dragon,internal/config internal/speech internal/app,implemented,go test ./internal/config ./internal/speech ./internal/presentation ./internal/app -count=1,,,Maintainer confirms speech preferences; previews; Apply and Cancel; saved settings; and interruption-key settings work in live testing on 2026-10-22. See docs/testing/release-acceptance.md.,,Applies enablement description punctuation capitalization and default voice settings. typing-printable-key-echo,src/cthulhu/typing_echo_presenter.py,input,Apply printable typing-echo category settings to terminal and editable text insertions,Storm Dragon,internal/config internal/atspi internal/presentation internal/app,implemented,go test ./internal/config ./internal/atspi ./internal/presentation ./internal/app -count=1,Maintainer reported the configured printable echo settings worked in minimal physical Xorg tests on 2026-09-12; broader application coverage remains pending.,,Maintainer confirms thorough live testing of native application and terminal workflows; typing echo; selection; clipboard feedback; and object navigation on 2026-10-22. These workflows pass. See docs/testing/release-acceptance.md.,,Single-character terminal and editable AT-SPI insertions honor enableKeyEcho enableEchoByCharacter and alphabetic numeric punctuation space and diacritical categories. Multi-character insertions remain presentation events. Preferences offer disabled enabled and edit-fields-only radio choices; edit-fields-only uses native editable metadata and Wine editor focus while preserving configured echo voices. Automated focus and persistence checks pass; live speech and physical Braille acceptance for the new mode remain pending. @@ -41,7 +41,7 @@ nvda-controller-ssml-rejection,src/cthulhu/dbus_service.py,remote,Reject invalid flat-review-keys,src/cthulhu/flat_review_presenter.py,review,Navigate and present content with desktop and laptop review keys,Storm Dragon,internal/input internal/review internal/app internal/platform/xorg,in-progress,DISPLAY=:0 go test -race ./internal/atspi ./internal/review ./internal/app ./internal/input ./internal/platform/xorg ./internal/presentation -count=1; DISPLAY=:0 python3 tests/native_atspi.py; DISPLAY=:0 python3 tests/native_x11.py,Private Xvfb tests pass all nine desktop and laptop sequential review commands; both laptop release orders; NumLock numeric keypad typing; laptop keypad pass-through; existing command and shutdown checks.,,Maintainer reports current flat review working well after the previous day's fixes on 2026-10-22. This is general live-use acceptance rather than confirmation of every parity feature or historical fixture. See docs/testing/release-acceptance.md.,Maintainer reports all Braille behavior testable on Orbit passes on 2026-10-22. The display has no routing keys; physical cursor routing is untested. See docs/testing/release-acceptance.md.,Basic previous/current/next line word and code-point character commands are wired to owned window layout and the existing review worker. Sequential line boundaries announce top or bottom of screen. Capture limits are reported explicitly. Native GTK text navigation and edit recovery pass. Mode toggling same-object caret following after leaving review state/value zones advanced bindings mouse review and full application parity remain pending. See docs/testing/flat-review-robustness.md for the current capture comparison and clipped-text regression. Parity review corrections and remaining physical gates: docs/testing/parity-review-follow-up.md. Numpad 2 supports phonetic double press; Numpad 5 and 8 support literal and phonetic spelling on second and third presses within 500 ms. Shared desktop/laptop routing plus private X11 consumption and OCR cursor tests pass; live spelling listening remains pending. See docs/testing/phonetic-review.md. preferences-basic-speech,src/cthulhu/cthulhu_gui_prefs.py,settings,Open accessible basic speech preferences and apply or save settings,Storm Dragon,internal/preferences internal/app internal/config,implemented,go test -race ./... -count=1; python3 tests/native_preferences.py; python3 tests/native_x11.py,Private Xvfb GTK and command checks pass; maintainer accepted save shutdown restart and restored settings on physical Xorg on 2026-09-13; broader desktop traversal pending,,Maintainer confirms speech preferences; previews; Apply and Cancel; saved settings; and interruption-key settings work in live testing on 2026-10-22. See docs/testing/release-acceptance.md.,,Apply and OK update the active schema-v2 profile while preserving other profiles and application mappings; Apply stays open and OK closes. Default-voice rate pitch volume and server-default toggles preview immediately without committing settings; Cancel restores the last applied voice configuration. Independent capital pitch beep and cap checkboxes replace the capitalization style dropdown; default pitch is enabled and all combinations apply to custom echo and spelling. Private GTK traversal and Apply/reload plus SSIP and persistence checks pass; general speech preferences listening is accepted by the maintainer on 2026-10-22; control-specific Braille acceptance was not separately stated. Explicitly selected legacy files remain session-only and cannot be overwritten. Advanced preferences and importer remain pending. Phonetic character hints is an unchecked Speech Reading option; plain Left/Right character navigation can append a cancellable 300 ms phonetic hint. Private GTK default toggle Apply/reload and cancellation checks pass; physical listening remains pending. See docs/testing/phonetic-review.md. review-component-geometry,src/cthulhu/flat_review.py,review,Capture component screen bounds and visibility for flat-review clipping,Storm Dragon,internal/atspi,implemented,DISPLAY=:0 go test ./internal/atspi -count=1; DISPLAY=:0 python3 tests/native_atspi.py,Private Xvfb D-Bus GtkBox tests verify screen bounds resize invalidation changed dimensions hide invalidation and recapture. Physical acceptance deferred by maintainer on 2026-09-14.,,,,Geometry queries run only during owned-tree capture. Bounds and visibility events invalidate geometry without removing identities. Negative coordinates overflow-safe clipping malformed geometry and concurrent invalidation have unit tests. Component bounds do not establish occlusion text ranges zones reading order or flat-review key support. -review-visible-text,src/cthulhu/flat_review.py,review,Capture bounded visible text with character offsets and screen clipping,Storm Dragon,internal/atspi,in-progress,DISPLAY=:0 go test -race ./internal/atspi ./internal/review ./internal/app ./internal/parity -count=1; DISPLAY=:0 python3 tests/native_atspi.py,Private ListBox and GtkBox capture edit clipping hidden-text and password-exclusion checks pass. Physical acceptance deferred.,,Maintainer reports current flat review working well after the previous day's fixes on 2026-10-22. This is general live-use acceptance rather than confirmation of every parity feature or historical fixture. See docs/testing/release-acceptance.md.,,Exact Unicode offsets and owned ranges include captured caret offsets. Text caret and geometry events invalidate cached text without retiring identities. Capture budgets are 65536 characters and 256 visible spans per object and 1 MiB per tree. Bounded line-rectangle discovery supports large objects without character rectangles; oversized lines use viewport glyph locations and bounded text spans. Zero-area glyphs no longer discard other visible text. Known unavailable objects and child subtrees leave healthy content reviewable with an explicit speech and Braille warning. Root failures and aggregate layout budgets remain fatal. Private GTK fixtures and worker tests pass; physical speech and Braille acceptance remain pending. See docs/testing/flat-review-robustness.md. +review-visible-text,src/cthulhu/flat_review.py,review,Capture bounded visible text with character offsets and screen clipping,Storm Dragon,internal/atspi,in-progress,DISPLAY=:0 go test -race ./internal/atspi ./internal/review ./internal/app ./internal/parity -count=1; DISPLAY=:0 python3 tests/native_atspi.py,Private ListBox and GtkBox capture edit clipping hidden-text and password-exclusion checks pass. Physical acceptance deferred.,,Maintainer reports current flat review working well after the previous day's fixes on 2026-10-22. This is general live-use acceptance rather than confirmation of every parity feature or historical fixture. See docs/testing/release-acceptance.md.,,Exact Unicode offsets and owned ranges include captured caret offsets. Text caret and geometry events invalidate cached text without retiring identities. Capture budgets are 65536 characters and 256 visible spans per object and 1 MiB per tree. Bounded line-rectangle discovery supports large objects without character rectangles; oversized lines use viewport glyph locations and bounded text spans. Zero-area glyphs no longer discard other visible text. Known unavailable objects and child subtrees leave healthy content reviewable with diagnostic omission counts and standard screen-boundary messages. Verified synthetic Text on controls uses accessible names or child content; tabs retain their label beside Close controls. Chromium address-value geometry remains unavailable. Root failures and aggregate layout budgets remain fatal. Private GTK fixtures and worker tests pass; physical speech and Braille acceptance remain pending. See docs/testing/flat-review-robustness.md. date-time-commands,src/cthulhu/date_and_time_presenter.py,command,Speak local time with Cthulhu+T and date with a double tap using saved formats,Storm Dragon,internal/input internal/app internal/preferences internal/config,implemented,go test ./... -count=1; focused race checks; native keyboard double-tap checks,Private Xvfb press-time and both-release-order checks passed; physical Xorg pending,,Maintainer confirms date/time; spoken version; window-title; and clipboard-reading commands pass live testing on 2026-10-22. See docs/testing/release-acceptance.md.,Pending braille,All 7 Python time and 16 Python date format choices are wired including locale seconds word numeric full and abbreviated variants; see docs/testing/time-date.md. notifications,src/cthulhu/notification_presenter.py;src/cthulhu/scripts/apps/notification-daemon/script.py;src/cthulhu/scripts/apps/notify-osd/script.py;src/cthulhu/mako_notification_monitor.py,notification,Present provider notifications save history expose mako live actions speak the last notification and open the notification-list GUI,Storm Dragon,internal/notification internal/app internal/notificationui internal/atspi internal/input,implemented,NO_COLOR=1 GOCACHE=/tmp/cthulhu-build-cache go test ./... -count=1; NO_COLOR=1 python3 tests/native_notifications.py,,,Automated speech-queue history list-state and list-action assertions and private GUI checks pass. Maintainer confirms notification announcements and the notification list work in live testing on 2026-10-22. See docs/testing/release-acceptance.md.,Mako notification announcements implement Braille flashes through notificationAnnouncer.Announce. Provider-specific physical display acceptance was not separately stated.,Go registers window-create and accessible-name events maps notification-daemon mate and xfce4 providers handles notify-osd gauge and name events keeps a 55-entry history and adds Cthulhu+N plus Cthulhu+Ctrl+N. The modal accessible list opens in a GTK helper process with sortable rows copy dismiss clear close dynamic actions and mako live refresh. Parity review corrections and remaining physical gates: docs/testing/parity-review-follow-up.md. ordinary-key-speech-interrupt,src/cthulhu/input_event.py,input,Interrupt speech on an ordinary key press even if focus does not move,,internal/input internal/app,implemented,go test ./internal/input ./internal/app -run TestProcessInputEventsInterruptsSpeechOnKeyPress -count=1,,,,,Python KeyboardEvent._present interrupts on press outside game mode. Go interrupts on every observed press by default; Speech preferences can restrict interruption to common or recorded keys. Physical FastSMRW table-boundary listening remains pending. @@ -58,7 +58,7 @@ steam-notifications,src/cthulhu/scripts/apps/steamwebhelper/script.py;tests/test libreoffice-calc-basic,Orca src/orca/scripts/apps/soffice/script.py; Orca src/orca/ax_utilities_table.py; Orca src/orca/speech_generator.py,libreoffice,Present Calc cells and recover logical focus around editing and sheet changes,Storm Dragon,internal/app internal/atspi internal/presentation,in-progress,GOCACHE=/tmp/cthulhu-go-cache go test -race ./internal/atspi ./internal/app ./internal/presentation -count=1; /usr/bin/python3 tests/native_libreoffice.py,Private real LibreOffice Calc 26.2.6.3 on Xvfb and a private AT-SPI bus validates cell movement blanks F2 typing Escape Enter and sheet changes.,,Recorded speech assertions pass. Maintainer confirms basic cell navigation and editing work in live use on 2026-10-22. Selection and sheet-switching acceptance await real-world testing. See docs/testing/release-acceptance.md.,Recorded value and coordinate frames pass; physical Braille and editor routing acceptance pending.,Current Orca is the primary Office reference. Dedicated application policy follows verified process identity after foreground/security gates; native capture remains bounded. Formula presence and explicit formula/basic Where Am I speech are implemented with bounded uncached cell attributes and recorded real-Calc checks; physical acceptance remains pending. Bounded selection deltas for small ranges and row/column selections plus count summaries for large selections and Select All are implemented. Real Calc checks cover disjoint cells and huge selections; physical speech/input/Braille acceptance remains pending. Dynamic row and column headers now use session choices scoped by provider bus document view window and exact sheet name; native reads are bounded to two cells. Four assignable commands preserve existing shortcuts. Private i3 Calc checks cover heading edits independent axis clearing sheet round trips both workbook-return directions with distinct headings and Find and Replace typing/cancellation. Frame activation and X11 foreground recovery avoid stale descendant searches; physical speech/input/Braille acceptance remains pending. Full-row reading Writer workflows and full topology reporting for large selections remain open. See LIBREOFFICE_SUPPORT.md. steam-shader-progress,Steam shader dialog AT-SPI events,web,Report Steam Vulkan shader percentages through shared progress output,,internal/webscripts internal/app,in-progress,go test ./internal/app ./internal/webscripts ./internal/presentation ./internal/sound -count=1; python3 tests/native_progress.py; CTHULHU_NATIVE_BROWSER_TESTS=progress python3 tests/native_browser.py,Private GTK and Brave HTML/ARIA progress checks passed.,,Tone requests verified; live Steam listening pending.,Unrelated Braille ownership covered by unit tests; physical check pending.,English static shader-status name changes only; verified steamwebhelper identity; see PROGRESS_BARS.md. wayland-shared-keyboard-access,src/cthulhu/input_event_manager.py,input,Monitor keys and grab reader shortcuts through the shared accessibility keyboard interface,Storm Dragon,internal/platform/wayland internal/app internal/sessionbus,in-progress,Private dbus-run-session race tests cover wire protocol runtime dispatch configuration rollback secure transitions and cleanup; go test ./... -count=1; python3 tests/check_speech.py,Existing native_x11.py keyboard harness passed; browser tabs and editing passed; browser modes passed on isolated rerun after one failure whose cause was not established.,Shared D-Bus fixture passed without an X display. On 2026-10-22 the maintainer reports minimal live testing and user reports of poorer behavior than native Xorg. Specific compositor and physical key-suppression acceptance remain unverified. See docs/testing/release-acceptance.md.,Minimal live Wayland testing reported by the maintainer on 2026-10-22; broad listening acceptance is not established.,Pending physical Braille on Wayland,No compositor-specific code. See WAYLAND_SUPPORT.md for supported commands limitations and live acceptance. X11 production listeners are unchanged; the suspension probe now links its existing xkbcommon dependency. -web-browse-recovery-activation,Orca src/orca/scripts/web/script_utilities.py; master:src/cthulhu/scripts/web/script.py,web,Recover dynamic browse positions and activate custom clickables silently,,internal/atspi internal/review internal/app,implemented,go test -race ./... -count=1; python3 tests/native_browser.py; python3 tests/native_browser_navigation.py; python3 tests/native_firefox.py,Private Chromium and Firefox fixtures; real-reader changing-page and activation checks use private Xvfb and D-Bus.,,Maintainer confirms extensive live browser testing passes in Firefox and Chromium-based browsers on 2026-10-22; element lists and jumping to selected items are explicitly confirmed. See docs/testing/release-acceptance.md.,Selection-collapse regression and native mode frames covered; physical routing remains pending.,See docs/testing/browser-release-review.md for findings and live acceptance. No full Orca parity claim. +web-browse-recovery-activation,Orca src/orca/scripts/web/script_utilities.py; master:src/cthulhu/scripts/web/script.py,web,Recover dynamic browse positions and activate custom clickables silently,,internal/atspi internal/review internal/app,implemented,"go test -race ./... -count=1; python3 tests/native_browser.py; python3 tests/native_browser_navigation.py; python3 tests/native_firefox.py; go test -race ./internal/atspi ./internal/review ./internal/app -count=1; CTHULHU_NATIVE_BROWSER_TESTS=generatedlinks,replacement,tooltips,fragments,namedlinks,linkedheadings python3 tests/native_browser.py",Private Chromium and Firefox fixtures; real-reader changing-page and activation checks use private Xvfb and D-Bus. On 2026-10-22 the maintainer confirmed reading the entire original Techrights article in Brave without looping after the generated-link recovery fix. See docs/testing/browser-release-review.md#generated-link-recovery-acceptance-2026-10-22.,,Maintainer confirms extensive live browser testing passes in Firefox and Chromium-based browsers on 2026-10-22; element lists and jumping to selected items are explicitly confirmed. See docs/testing/release-acceptance.md. Original Techrights full-article reading accepted after the generated-link fix on 2026-10-22; see docs/testing/browser-release-review.md#generated-link-recovery-acceptance-2026-10-22.,Selection-collapse regression and native mode frames covered; physical routing remains pending.,See docs/testing/browser-release-review.md for findings and live acceptance. No full Orca parity claim. October 22 generated-link recovery retains the same parent and adjacent sibling identities; refreshes navigation-defunct child order and disappearing native text; and gives Read All navigation recovery with document-generation rejection. The page-CSS fixture reproduces the first fix failure and passes after correction. Full-article reading on the original Brave page is accepted; separate manual reverse-navigation Read All activation and physical Braille checks were not reported. The separate dynamic-page flat-review failure remains open. web-structural-lists,Orca src/orca/structural_navigator.py; src/orca/structural_navigator_command_definitions.py,web,List browser elements and move to a selected item,,internal/input internal/review internal/interaction internal/app,implemented,"go test -race ./... -count=1; CTHULHU_NATIVE_BROWSER_TESTS=lists,keys,document,modes,editing python3 tests/native_browser.py; python3 tests/native_internal_ui.py",Private Brave/Xvfb list workflow covers 302 links hidden content current row selection Escape clickables heading level and empty list.,,Maintainer confirms extensive live browser testing passes in Firefox and Chromium-based browsers on 2026-10-22; element lists and jumping to selected items are explicitly confirmed. See docs/testing/release-acceptance.md.,Shared internal UI frames covered; physical Braille acceptance pending.,25 browse shortcuts use Alt+Shift. All Orca list types are registered including unbound annotations internal frames and math. Exact targets and page ownership are validated before selection. See docs/testing/browser-lists.md for manual review and regression checks. mozilla-leaf-text-reading,Orca src/orca/scripts/web/script_utilities.py,web,Read native heading and link text leaves in Firefox and Thunderbird,,internal/atspi tests/native_mozilla.py,implemented,python3 tests/native_firefox.py; CTHULHU_BINARY=/tmp/cthulhu-mozilla-review /usr/bin/python3 tests/native_mozilla.py; go test -race ./internal/atspi ./internal/review ./internal/presentation ./internal/app -count=1 -timeout=120s,Private Firefox 158.0 and Thunderbird 158.0 sessions each cover 17 navigation commands and Read All with zero native caret synchronization errors.,,Maintainer confirms extensive live browser testing passes in Firefox and Chromium-based browsers on 2026-10-22; element lists and jumping to selected items are explicitly confirmed. See docs/testing/release-acceptance.md.,Shared Chromium selection and routing checks passed; physical Mozilla Braille acceptance pending.,Shared document text metrics now include heading and link roles. Native Firefox metadata assertion failed before the fix. See docs/testing/mozilla-reading.md. Thunderbird folders message lists and composition remain outside this reading baseline. thunderbird-local-mail-composition,Orca src/orca/scripts/apps/Thunderbird/script.py;src/orca/script_utilities.py,application,Navigate local folders and message tabs; select messages; compose replies and forwards; save and add attachments,,internal/atspi internal/app tests/native_thunderbird.py,implemented,go test -race ./internal/atspi ./internal/app ./internal/review ./internal/presentation -count=1 -timeout=120s; CTHULHU_BINARY=/tmp/cthulhu-mozilla-review /usr/bin/python3 tests/native_thunderbird.py,Private Thunderbird 158.0 HTML and plain-text local mailbox checks cover message-tab return; Subject and body editing; reply and reply-all recipients with Cc; inline forwarding; exact selected rows after Shift and Ctrl navigation; received attachment saving with content verification; and adding a local file to an unsent draft.,,SSIP verifies focus handoff and row roles; selection toggling; Subject and body echo; reply and forward editing; attachment menus and picker return. Maintainer relays third-party confirmation on 2026-10-22 that message reading; replies; forwards; and attachments work well in live testing. See docs/testing/release-acceptance.md.,Event-loop regression checks paragraph cursor and routing metadata; physical display acceptance pending.,Foreground replacement requires a registered application and fresh complete window membership. Editable paragraph events belong only to their focused editable document. Title echoes require owned editable focus and recent editing plus unchanged title prefix/suffix; unrelated status titles still announce. See docs/testing/thunderbird-workflows.md; no sending remote mailbox or page-load-option acceptance claimed. diff --git a/tests/native_browser.py b/tests/native_browser.py index 7f4e0f2..8654c7f 100644 --- a/tests/native_browser.py +++ b/tests/native_browser.py @@ -12,6 +12,9 @@ from native_test_session import run_private_session BROWSER_PROOFS = { + "flat-chrome": ("./internal/review", "^TestNativeBrowserChromeFlatReview$", 35, 40), + "generatedlinks": ("./internal/app", "^TestNativeBrowserGeneratedLinkNavigation$", 30, 35), + "replacement": ("./internal/app", "^TestNativeBrowserInlineReplacementNavigation$", 30, 35), "tooltips": ("./internal/app", "^TestNativeBrowserTooltipNavigation$", 30, 35), "menu": ("./internal/app", "^TestNativeBrowserMenuControls$", 30, 35), "lists": ("./internal/app", "^TestNativeBrowserLists$", 35, 40, "browser-lists.html"),