SafPickerRoundTripTest races the probe and the window focus: make it deterministic without weakening what it asserts #268
Closed
opened 2026-09-07 18:26:37 +00:00 by JMR-dev
·
1 comment
No Branch/Tag Specified
main
fix/102-picker-back-press-overshoot
fix/268-saf-picker-determinism
feat/ogg-vorbis-libvorbis
feat/expedited-conversion-work
fix/gate-cache-in-worktrees
chore/gate-runs-shellcheck
test/publish-delete-arm-real-provider
docs/e8-instrumented-coverage
docs/api37-carrier-count-drift
docs/e7-second-constraint
test/publish-to-a-real-saf-destination
fix/api37-report-match-line
fix/api37-task-snapshot-crash
test/join-failure-message-on-device
docs/e2e-read-findings-e7
test/cancelling-a-running-export
test/reattach-to-a-running-job
test/content-uri-reaches-ffmpeg
fix/launcher-wiring-waits-for-the-pick
fix/cancel-tests-need-a-slower-encode
test/cancelling-a-running-join
test/cancelling-a-running-session
test/notification-cancel-action
test/ffmpeg-progress-is-observed
test/fallback-asserts-the-path
test/flac-and-opus-assert-their-format
docs/e2e-read-findings
docs/wave4-coverage-numbers
fix/injectable-startup-sweep-scope
test/session-outcome-seam
test/launcher-callback-identity
test/theme-follows-system-dark
test/audio-drop-arm
fix/rotation-waits-for-recreation
fix/convert-guards-on-ready
test/retry-save-mime
test/hardware-progress-reaches-workmanager
test/ffprobe-mapping-seam
test/device-codec-enumeration-seam
test/unknown-container-row
test/null-message-fallbacks
test/cancel-reaches-workmanager
docs/coverage-wave3-recovery
test/concat-engine-seam
docs/coverage-wave3
test/mediaprobe-merge-seam
test/adaptive-shell-wiring
test/aac-audio-args
test/notification-progress-text
test/media3-muxer-guard
test/hardware-fallback-and-cancellation
test/unprobeable-join-clip
test/one-branch-outcomes
test/foreground-type-regimes
fix/bound-wedge-diagnostics
docs/coverage-wave2
test/screen-wiring
test/viewmodel-setters
test/join-state-mapping
test/conversion-state-mapping
test/dedupe-user-messages
fix/restore-stack-merges
test/refused-jobs
test/concatworker-failure-arms
test/container-capabilities-audio
test/readspec-enum-fallbacks
test/outputpublisher-seams
test/mediaprobe-track-seam
test/outputpublisher-partial-branches
test/fake-provider-scaffolding
docs/coverage-read-findings
chore/gitignore-kotlin
test/bound-the-hangs
docs/coverage-remeasure
ci/baseline-counter-precision
fix/invalid-suggestion-chip
ci/wedged-leg-report
fix/reattachment-overwrites-pick
test/theme-live-branches
fix/failed-save-retry
fix/empty-composition-crash
ci/advisory-failure-report
docs/seven-run-counts
test/release-permission-guard
ci/build-workflow-permissions
docs/api37-point-release
docs/benchmark-populate-path
fix/dead-assertion-probe-test
ci/actionlint
test/device-codecs-encode-consequence
fix/sdkmanager-pipefail
docs/readme-restart-claim
fix/saf-picker-root-discovery
fix/probe-dispatcher-seam
test/media3engine-mime-tables
test/mediaprobe-pure-helpers
fix/codec-vocabulary-drift
docs/robolectric-rationale-correction
docs/api37-advisory-counts
test/r38-8-saf-e2e
test/r38-7-join-states
test/r38-6-conversion-states
test/r38-5-state-seam
fix/jacoco-robolectric-coverage
docs/instrumented-tests-correction
test/r38-2-filecard
test/r38-4-advanced-picker
test/r38-3-pickers
tools/file-issue-script
tools/api-37-emulator
fix/review-app-gaps
docs/review-corrections
No results found.
Labels
Clear labels
above-cut
accessibility
backlog
bug
confirmed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
plausible
question
sev:high
sev:low
sev:medium
wontfix
Worked autonomously overnight: local, JVM-verifiable, no product decision
Barrier affecting people with disabilities
Held for manual review: product/UX call, CI/workflow, hardware, or unverifiable here
Something isn't working
Reviewer demonstrated the defect
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Good for newcomers
Extra attention is needed
This doesn't seem right
Reviewer could not fully demonstrate it; treat as unproven
Further information is requested
High severity
Low severity
Medium severity
This will not be worked on
No labels
bug
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: JMR-dev/LibreMediaConverter#268
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
SafPickerRoundTripTestfails intermittently on the gating legs — roughly half the runs during#261, which needed three re-runs to get past it. It is not caused by #261: the same test
failed the same way on
test/publish-delete-arm-real-provideratexpected: 71, before that branchexisted (runs
34056545386API 35,34057706195API 34).The symptom is always the same:
ComposeTimeoutExceptionwaiting onaction.saveFile, after aConvert tap that reached nothing. No
WM-SystemJobScheduler: Scheduling work ID, no FFmpegcommand, screen still on
Readyfive minutes later.Two mechanisms, both measured from logcat
Diagnosed across four failures in three CI runs.
A — the tap is lost in the post-probe relayout.
ConversionViewModel.onInputPickedwrites statetwice:
The second write relays out the file card, which moves the Convert button down. The test's
performScrollTo/assertIsEnabled/performClickstraddles that relayout, so the injected taplands where the button used to be. Logcat carries no
START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS ...}at all — the tap reached nothing.Measured gaps between the pick's FFprobe closing (
Closed fd N for SAF id M) and the tap:B — the app is not the focused window. One failure had a 416 ms gap and the tap did land
(
GrantPermissionsActivitystarted), back was pressed, and still nothing was enqueued.awaitNodereported
No compose hierarchies found in the app— the hazarddismissThePermissionDialog's ownKDoc already documents.
Do not fix only A. A 416 ms gap failed through B, so any fix keyed purely on the probe having
landed will still flake.
What the fix must satisfy
Thread.sleep, a biggerwaitUntilbudget or aretry count is not a fix — it re-tunes the race rather than removing it. The test must
synchronise on observable state: the probe having landed and the layout having settled before the
tap is dispatched, and the app window being focused before Compose is queried.
real system picker —
aSaveWritesToTheDocumentTheSystemPickerCreatedthat the bytes reach thedocument DocumentsUI created, and
aFailedSaveDeletesTheDocumentItCouldNotWrite(#250) that afailed save deletes it. Neither may be reduced to "the conversion succeeded" or "some file
exists". If making it deterministic requires restructuring how the test reaches the save, the
round trip through the picker must survive the restructure.
delete-on-failure arm must redden
aFailedSaveDeletesTheDocumentItCouldNotWrite, exactly as D4's delete arm has still never run against a real DocumentsProvider: #226 proved the premise, not the fix (#250)required.
Worth considering
The second state write may be the real defect rather than the test's problem. A single
Ready(file, probe = null)that fills in without changing the card's height, or a card thatreserves its final height, would remove mechanism A for every test and for users — the button moving
under a finger is a real UI flaw, not only a test hazard. Decide that before patching the test;
if the production fix is right, say so and do that instead.
Notes
@FailsOnEmulatorApi37. The marker count and the gating-leg figure must bere-derived after any change, per
CLAUDE.md— currently 72 tests, 7 markers, 65 gating.tools/local-emulator/run-e2e.shruns them locally.ConverterScreen.kt's format picker is a wrappingFlowRowoverOutputFormat.entriessittingabove the Convert button, so every added output format widens mechanism A's window. #254 added
one. That is an argument for fixing the cause rather than the symptom.
Correction: the "every added output format widens mechanism A" note is wrong
That line is mine and it does not survive reading the layout. Recording it rather than deleting it,
because the ticket was used to brief work and the claim may already have been acted on.
What I wrote: the format picker is a wrapping
FlowRowoverOutputFormat.entriessitting abovethe Convert button, so each added format widens mechanism A's window — and therefore #254 made this
flake worse.
Why it is wrong. Mechanism A is about how far Convert moves between the test's
performScrollTo/assertIsEnabledand the tap being dispatched. The chip row's height is constantacross that transition — it does not depend on the probe — so it contributes nothing to the delta.
Adding a format changes where Convert starts, not how far it moves.
And in the
Readystate the chips are not even in that vertical path.ConverterScreen.kt:Convert sits directly under
FileCard, andFileCard(:615) branches oninput.probe == null(
:636-637). So the displacement is the card growing when the probe lands, full stop.What this changes. The "Worth considering" section's argument for a production fix is weaker than
written: it rested partly on the flaw getting worse with every added format, and it does not. The
double state write is still a real UI behaviour worth its own discussion, but it is not degrading
over time, and that removes the urgency this ticket implied.
It does not change the acceptance criteria, which never depended on it: no timing dependence, the
assertion must not weaken, and the mutation must still redden
aFailedSaveDeletesTheDocumentItCouldNotWrite. Mechanism B is likewise untouched — a 416 ms gapfailed through window focus, so a probe-keyed fix alone was never sufficient.