callstack / callstack/agent-device

scroll top/bottom reports "Already at bottom" when the capture is unreadable

Aperta
#2,468 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
4.6k
Fork
299
Merge medio
10h 42m
PR unite (30g)
493

Descrizione

`captureEdgeState` in [src/daemon/scroll-runtime.ts](https://github.com/callstack/agent-device/blob/main/src/daemon/scroll-runtime.ts) coerces a failed read to `[]`, and `analyzeScrollEdgeState` reads an empty tree as no hidden content at the edge. So a capture that fails, or comes back sparse, makes `scroll bottom` report "Already at bottom; no hidden content below detected" instead of saying it could not see the screen.

Same defect class as the one fixed for `scroll --until` in #2436: a failed observation presented as a fact about the content. That PR refuses an unreadable capture before the edge analyzer runs, using `sparseCaptureQuality` from `@agent-device/selectors/absence-observation` as the single definition of readable.

## The shape of the fix

Reviewer's suggestion on #2436, and it is the right one: `runScrollUntilVisible` and `runScrollEdgePasses` are the same loop — capture, test a stop condition, scroll, count, cap. Today they are two loops with two budgets (12 and 40), two error vocabularies and two capture closures. One `runScrollPasses({ shouldStop, passLimit })` in capture-kit would carry both, `scroll bottom` becomes a stop condition, and the capture refusal lands once for both callers.

Kept out of #2436 deliberately: it changes the failure surface of `scroll top`/`scroll bottom`, which is separate from adding `--until`.

## Acceptance

`scroll bottom` against an unreadable or sparse capture fails with a typed capture refusal rather than an edge verdict, and both scroll loops share one pass-loop definition.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia in src/daemon/scroll-runtime.ts tracciando captureEdgeState, analyzeScrollEdgeState, runScrollUntilVisible e runScrollEdgePasses, quindi esamina la direzione del loop condiviso di #2436. Usa sparseCaptureQuality da @agent-device/selectors/absence-observation come controllo di leggibilità; il lavoro è completo quando entrambi i loop condividono un’unica definizione del loop dei passaggi e le catture illeggibili o sparse producono un rifiuto della cattura tipizzato invece di un verdetto sull’edge.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
cli, mobile-dev, testing
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Specificata chiaramente
Idoneità per principianti
67/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.