W1: cut ConversionViewModel.observe's state mapping into a seam, and choose all six arms #154
Closed
opened 2026-08-27 11:58:59 +00:00 by JMR-dev
·
0 comments
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
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#154
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.
ConversionViewModel.observemaps aWorkInfoonto aConversionState. That mapping is the app's main UI state machine, and no test chooses which arm it takes.The claim, stated precisely
This is not cold code.
ConversionViewModel$observe$1$1reports 28 covered lines and 24 covered branches — the collect block runs on every test that drives a real worker throughinstallTestWorkManager. But a real worker only ever produces a terminal state with well-formed output, so those are the only arms reached:SUCCEEDEDwith an output pathFAILEDwith a non-blank messageRUNNING, readingKEY_PROGRESSENQUEUED,runAttemptCount > 0→WaitingENQUEUED,runAttemptCount == 0→ConvertingSUCCEEDEDwith a null output pathFAILEDwith a blank or missing messageCANCELLEDBLOCKEDgrepforWorkInfo.State.acrossapp/src/testfinds all six constants, which looks like coverage until you see where they are:ReattachmentTestdrives every one of them intoReattachment.choose, a different function. The other two files that mention them (ConverterStateAffordancesTest,FailedSaveRetryTest) name theFAILEDarm in KDoc and do not construct aWorkInfoat all.So the enqueued-means-retry rule is tested in one of its two homes.
Reattachment.choosehas a test forrunAttemptCount = 0versus1;observe, which is what the user's screen actually reads, does not — and the comment above line 456 explains at length why the distinction matters. A rule with a documented rationale and two implementations should not have one of them untested.Why a seam, and which one
There is nothing to inject.
workManagerisprivate val workManager = WorkManager.getInstance(app), hard-wired in the constructor at line 183, andobserveis private. A test cannot hand this a chosenWorkInfo.Take the same answer #141 took for
MediaProbe: lift thewhen (info.state)out as aninternalpure function over the values it actually reads, and leave the collect, the null check and the ownership check behind as the thin edge.internalrather thanprivatefor the reasonMediaProbe.Extractedgives — the JVM test source set is a friend ofmain, so it stays invisible outside the module.Two things the seam must not swallow:
SUCCEEDEDarm's file ownership, not just the assignment. Moving it inside a pure mapper would change what it protects.SUCCEEDEDarm takes ownership of the staged file (468 onward), which is a side effect. The mapper should return the decision; the caller performs it. If that split is awkward, say so on the ticket rather than fusing them — a pure function that deletes files is not the seam this asks for.Done when
Each of the six arms is chosen by a test, and each is killed by a mutation of its own. Note
ENQUEUEDneeds two tests, not one — a single test passes against a mapper that ignoresrunAttemptCountentirely.Name any arm you decide is not worth pinning, and why.
BLOCKEDis the likeliest candidate: it maps to the sameConvertingas a freshENQUEUED, so a test for it asserts an equality rather than a rule.