Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

debug(a11y): log AXLineForIndex return value for one node per process

Louis Beaumont79373ea164c4
diff --git a/crates/screenpipe-a11y/src/tree/macos_lines.rs b/crates/screenpipe-a11y/src/tree/macos_lines.rs
index 33be6478c..e8dcabf6e 100644
--- a/crates/screenpipe-a11y/src/tree/macos_lines.rs
+++ b/crates/screenpipe-a11y/src/tree/macos_lines.rs
@@ -308,7 +308,22 @@ pub(crate) fn capture_line_spans(
if !budget.try_consume(1) {
return None;
}
- let last_line = line_for_index(elem, total_utf16 - 1)?;
+ let last_line_opt = line_for_index(elem, total_utf16 - 1);
+ {
+ // DIAGNOSTIC: log the first few AXLineForIndex results per process so
+ // we can see what browsers are actually returning. Once-only to avoid
+ // log spam on busy pages.
+ static LOGGED: AtomicBool = AtomicBool::new(false);
+ if !LOGGED.swap(true, Ordering::Relaxed) {
+ warn!(
+ "lines: probe — total_chars={} total_utf16={} AXLineForIndex(last)={:?}",
+ text.chars().count(),
+ total_utf16,
+ last_line_opt,
+ );
+ }
+ }
+ let last_line = last_line_opt?;
if last_line <= 0 {
return None;
}