S3 — sweepStaging's re-read race has no seam to provoke it #143
Closed
opened 2026-08-27 03:07:10 +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
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#143
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.
Child 3 of 3 decomposing #133. Independent of S1 (#141). Touches the same file as S2 (#142) — take them in either order, but not in parallel.
Why this exists
StagingSweep.collectableis pure and well covered —StagingSweepTesthas seven tests. This is theguard around it, and the branch that never fires is the one that matters: a file that was
collectable in the listing and is not by the time the delete is reached.
That is the entire failure this re-read prevents, and it is the one thing standing between the sweep
and a live job's output.
defect-audit.mdD2 and D8 are the entries this line came out of.Scope
Something that can move a file's mtime between the listing and the re-read. Two shapes, both small:
— override it to touch a file on the way out; or hoist the listing into an overridable call and do
the same. Either leaves
StagingSweep's rule untouched, which is the point: this is about the guard,not the policy.
Same precedent as S2 (#142) —
WorkerStubs.kt's publishers override one method to force one condition.Note the interaction:
sweepStagingalready takesnowMsas a parameter specifically so the clockis the caller's, so the seam needed here is the listing, not the time.
Done means
A file that the listing reports as collectable, whose mtime is then advanced before the delete is
reached, is left on disk. Assert on the file existing, not on a call count.
Mutation: delete the
ifand delete unconditionally. The test must go red on the surviving file.Worth checking while here
:271—canonicalOrAbsolute'sgetOrDefault(absoluteFile)fallback is 9 instructions neverexecuted, and belongs to
discardStagedrather than the sweep. C6 (#140) of #132 names it; if that childhas not landed, it is a two-line addition here rather than a reason to open anything further.
The seam this ticket proposed does not reach the branch. Recording the measurement, because the mistake is easy to repeat and the test looks right while making it.
This ticket suggested:
I cut exactly that, wrote the race test — a file aged past the grace period, touched to
nowfrom inside the override — and it passed. Then the mutation came back green: deletingif (StagingSweep.isCollectable(...))outright left the test passing.The reason is the ordering:
An
entriesInseam fires before the snapshot, so the touch lands inentriesitself,collectablenever proposes the file, and the loop body is never entered. The test passes for the wrong reason — it demonstrates the first read protecting the file, not the second.The race is a file that was collectable when the snapshot was taken and is not by the time the delete comes round. So the seam has to sit at the snapshot:
With that, deleting the guard reddens the test. Done in PR #151, with the reasoning on the seam's own KDoc so it is not moved back.
Worth noting generally: this is the second seam in this batch where the obvious placement was one step off, and in both cases the only thing that caught it was running the mutation. A green race test is close to meaningless on its own — the whole point of the branch is that it fires rarely.