Files
cthulhu/docs/testing/browser-audit-fixes.md
2026-10-24 18:33:04 -04:00

8.6 KiB

Browser audit fixes

This work addresses the browser review of bf4b9d7 against local Orca. The first implementation batch fixes the four reproduced defects and two navigation costs. It also adds busy live-region deferral. It does not establish complete Orca parity.

Implemented behavior

  • Crossing objects validates dirty hypertext ancestors, because parent-owned text can change embedded offsets without changing accessible child identities. A failed move preserves the position; the refreshed retry reads the insertion. A local character move within an unchanged child still avoids recapture.
  • Atomic updates read the enclosing atomic region for both text changes and child additions. The source's effective container-atomic metadata gates this path. Chromium exposes atomic=false on ordinary descendants, so those default values do not terminate the ancestor walk.
  • Table movement crosses missing cells, including neighbors in lower rows of a spanning cell. It uses captured cells rather than iterating huge sparse row or column dimensions. Real blank cells remain stops. Table validation and lookup operate on the table subtree and its ancestors, preserving refreshes for changed coordinates, headers and cell data while allowing unrelated page updates.
  • Word movement skips whitespace using blocks of at most 128 native Unicode characters. Only observed whitespace triggers this path, so ordinary word and character movement do not gain an extra block request. Native word boundaries, spelling metadata and embedded-object limits retain their existing handling.
  • The cursor indexes object-to-range positions once per immutable document view. A hypertext object can have multiple ranges, and lookup preserves their actual traversal order. Retired views rebuild both the ranges and their index.
  • Busy live regions defer updates until their busy flag clears. The GLib owner keeps at most 32 region/document identities, without retained native references or intermediate text. Completion rereads the active region and enters the live insertion path, without acquiring focus or producing document-loading speech. Secure input, tab selection, object destruction, document lifecycle and shutdown retire the relevant deferred state. Live attributes are fetched together once per candidate event, after foreground filtering.

The browser must expose accurate live attributes. A diagnostic Chromium fixture which set aria-busy=true and replaced descendant text in the same JavaScript turn reported container-busy=false on the initial descendant event. Cthulhu cannot reliably defer an update which the provider reports as not busy. The retained regression establishes busy state before the initial accessibility capture and proves that clearing the flag alone releases the deferred content. Nested explicit atomic=false boundaries likewise depend on correct effective container-atomic metadata from the provider.

Automated evidence

The AT-SPI, review and app packages passed with the race detector. The full race run failed in internal/sound at TestNewPresentationInterruptsOldCueAndDiscardsPendingCues with “stale link cues remained queued.” Ten isolated repetitions also reproduced that failure in an untouched snapshot of bf4b9d7; the sound files were not changed. This remains an existing gate, so the full suite is not described as passing.

Thirteen selected Chromium fixtures passed in a private X11/D-Bus session: generatedlinks,replacement,fragments,namedlinks,linkedheadings,tables,selection,modes,document,editing,tabs,live,live-atomic. The final live-atomic run also verifies that busy completion requires no new text insertion. It covers atomic text updates, atomic child additions, non-atomic updates, suppression while busy, and release after busy becomes false.

Firefox baseline reading passed. Its tab regression timed out on the second “New Tab” announcement in both the modified checkout and an untouched bf4b9d7 snapshot. The recorded events include a selected-state event for the previous unselected tab. This is an unresolved existing/provider case, not a verified regression introduced by these changes.

The affected go vet checks, normal reader build, BrlAPI helper build, Python syntax check, parity-ledger validation and whitespace check passed. No installed reader was replaced. The native fixtures record protocol/snapshot behavior; they do not prove audible output or physical keyboard/Braille acceptance.

A counting reader crossed 1,000 whitespace characters with three word commands using 39 reads, including 16 character-block reads. The old implementation used 1,003 reads for a single forward word command. This is an API-call count, not a measurement of audible latency.

Three 100 ms synthetic benchmark repetitions still show character round trips near 12 microseconds at 10,000 content nodes. Allocation traffic remains about 16 KB per character round trip and 52 KB per worker heading round trip. These runs overlapped other checks and are informational, not a controlled timing comparison. They exclude native IPC, initial capture, speech and physical input.

Run the relevant checks:

python3 tests/native_test_session.py env GOCACHE=/tmp/cthulhu-cache go test -race ./internal/atspi ./internal/review ./internal/app -count=1
CTHULHU_NATIVE_BROWSER_TESTS=live-atomic,generatedlinks,replacement,fragments,namedlinks,linkedheadings,tables,selection,modes,document,editing,tabs,live python3 tests/native_browser.py
python3 tests/native_firefox.py
go vet ./internal/atspi ./internal/review ./internal/app
go run ./cmd/parityledger validate testdata/parity-ledger.csv

Human acceptance before submission

Review the generated diff under the project's AI-assisted contribution policy. With an explicitly rebuilt reader, test these workflows in Chromium and Firefox:

  1. Read forward and backward through links and changing text between them. Read All must include inserted text once and continue through generated links.
  2. Check atomic status updates retain their surrounding label, non-atomic updates announce the change, and busy updates wait for the completed region.
  3. Navigate ragged and merged-cell tables in all directions. Verify headers, blank cells, logical row/column retention, nested tables and boundary messages. Repeat with an unrelated page ticker and then a changed cell/header.
  4. Move by word through long indentation, tabs, newlines and Unicode whitespace. Check reverse movement, emoji, named links, and character-by-character spacing.
  5. Type/select in an editor; return from the address bar and another tab; check Steam browsing/search; verify stale targets never activate replacement controls. Compare speech and physical Braille where available.

Do not submit or replace the active reader automatically. Preserve logs if a workflow fails and distinguish provider metadata from reader-owned state.

Remaining review work

The user authorized addressing the whole review, in priority order. On October 24, the maintainer prioritized stabilizing the current release before adding new functionality. MathCAT was left to implementation judgment and is deferred with the other feature additions below. Release work should concentrate on the existing fixes, the recorded test failures, and live acceptance. These items remain open and must not be reported as implemented:

  • Automatic language switching, including language runs within a line, native focus, structural navigation, character reading and Read All. The current speech queue and client selection do not carry per-content language metadata.
  • Structured math speech, Braille and exploration. MathCAT's maintained C interface provides a shared engine, but adds a Rust-built library and its rule data to packaging. No MathCAT dependency has been added in this batch.
  • Constrained label inference for controls without an accessible name or explicit label relationship. Keep explicit labels authoritative and reject ambiguous neighboring text. This is a deliberate presentation-policy addition.
  • Demand-driven capture for pages exceeding the 30,000-object safety bound. The bound and whole-document initial capture remain unchanged. A partial tree must represent unloaded branches explicitly so it cannot silently report false end-of-document or incomplete element lists as complete results.

MathCAT integration should keep Go as the policy owner, use the upstream C ABI, serialize engine state on a dedicated worker, and preserve browser responsiveness when the engine or rules are unavailable. Revisit dependency and packaging choices after the current release is stable; no MathCAT dependency is being added now.