Repository navigation
A fresh mount is judged by its own probe, and the ghost path says what it did - #168
Merged
Merged
Conversation
Connect had to be pressed three times on 2026-10-27, and the app was the one taking the card away: each attempt reached "card up" and 0.4 to 3 seconds later asked diskarbitrationd to force-unmount the volume. The verdict behind that is the uncached read of MEMORY1.RC0, whose result lived in one probe state keyed by the file's PATH and was never reset when a new volume mounted at the same place. So the first verdict on each fresh mount answered with the previous mount's failed read, before the fresh mount had been asked anything at all. Two rules now stand between a read and a condemned mount, in MountProbe.h so all three backends share them and so they can be tested without a device: - a probe result belongs to ONE mount incarnation, and a verdict about a mount the stored result does not speak for ignores it and starts a fresh probe. The identity is the device plus whatever the system's own bookkeeping offers that a remount cannot repeat: on macOS the IOMedia object's registry entry ID (a recycled disk10s1 is not the medium that used to carry the name) plus the mount and unmount events DiskArbitration reports for that path, on Linux the mount id from /proc/self/mountinfo, on Windows the volume arrivals and removals WM_DEVICECHANGE reports. Never a number read out of the medium: those answers stop coming exactly when the medium dies, which would change the identity at the moment a ghost appears and leave the mount forever unprobed instead of gone. - a mount in its first three seconds is not condemned by ONE failed read. It takes a second refusal in a row, or the platform agreeing there is no medium behind the mount. A dead mount is still cleared, two scans later. The wedge case is untouched: a read that never comes back is still a ghost at two seconds, which is what the ghost path was built for in 2026-07-22. The probe also carries its numbers out now (bytes, errno, and on Linux the third outcome - a filesystem that cannot do an uncached read at all, which gives no verdict and may not condemn anything), and the backends hand the reason to onGhostVerdict for the journal. Closes #166
Three forced unmounts of a live card left no line in the journal at all. The status line said "device detached (ghost mount)" for a moment, and the only record of who had pulled the volume was the system log, where diskarbitrationd names the process that asked. The verdict's reason now reaches the journal as the watcher makes it, once per episode, with everything that went into it: what the read did (bytes and errno), whether the system still lists a medium behind the mount, and how long that mount had been in front of us. The forced unmount that follows writes its own line, cleared or refused, with the dissent when there was one. The words live in MountProbe.h next to the decision they explain, so a line can never describe a verdict that was not taken - asking for a ghost's line about a live mount throws. The two call sites are in MainComponent, which no headless suite can build, so the suite proves them by reading it as text: the way hidden_features_tests proves what this release hid.
The line chose its sentence by whether a probe was out, which is not the same question as what made the mount a ghost. A refusal that came before a probe still standing is a ghost while that probe runs, and the journal would have called it a wedged filesystem and printed the running probe's age as if nothing had come back - a sentence about something that never happened, in the one place a player goes to find out what did. It now asks the same question decide() asks: wedged only when the read outstanding has passed the two seconds. The suite has the case that was wrong, and it fails on the old wording.
… it too A fresh pair of eyes broke the fix in two places, both of which would have left the reported episode happening. The second chance was counted in failures, and the count measured nothing. A probe is launched on every verdict with none in flight, and the worker takes a verdict after every job it runs, so right after a card comes up the probes are a few hundred milliseconds apart: the second refusal lands inside the very transient the first one did. The episode of issue #166 was condemned 0.4 s and 0.7 s after "card up" - a two-strike rule would have allowed exactly that. The settling period is now the whole of it: inside the window nothing the probe does condemns the mount, and it is asked again on the next scan. Past the window one refusal is enough, as it always was. The wedge rule reached around the window. A read that has not come back in two seconds is a dead filesystem on a mount we have been watching, but on a mount that came up a moment ago it is a first read taking its time - and condemning it force-unmounts a live card whose answer was about to arrive. The wedge now waits for the window as well; past it, it is unchanged. A mutation that takes that guard away fails the suite, which it did not before. Smaller things from the same review: - the macOS mount count was bumped by unmounts too, including our own forced unmount of a ghost. That reset the probe state right after the verdict that asked for it: the mount would read live again on the next scan and the ghost would oscillate, with writes allowed in between. Only a volume ARRIVING at the path we watch counts now. - Windows counted every volume event on the machine. Any stick, any ISO, any card reader's media change reset the pedal's probe state, and events closer together than the window could hide a wedge indefinitely. It now counts only arrivals under the drive it watches, and names in a comment the one case it cannot cover (no device window, no count). - the mountinfo mount id is NOT unique: the kernel hands out the lowest free one and frees it on unmount, so the next mount of the same device usually gets the same number and would have inherited the dead mount's result - issue #166 on Linux, deterministically. Linux now asks statx for the unique mount id (6.8+) and keeps the table's id only as the fallback, with the remaining risk named where it lives. - a read of zero bytes was a refusal on two backends and proof of life on the third. It is neither: reading nothing needs no device, and the app truncates the probe file itself when it writes a memory, so a probe racing that write could have called a live card dead mid-batch. All three now report it as no verdict. - `registryHasMedia` could never be false: every backend answers a registry miss before it consults the probe. The field and its branch are gone, and the journal's line says what is true where it is written. - the constructor registered DA callbacks before the last thing that can throw, and a throw there leaves them pointing at an Impl about to be freed, with no destructor of ours to run. Everything that can fail now happens first. - posix_memalign returns its error and does not touch errno; Linux recorded whatever errno held.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #166.
Connect had to be pressed three times on 2026-10-27, and the app was the one taking the card away: every attempt reached
card upand then asked diskarbitrationd to force-unmount the volume. The verdict behind that is the uncached read ofMEMORY1.RC0, whose result lived in one probe state keyed by the file's PATH and was never reset when a new volume mounted at the same place — so the first verdict on each fresh mount answered with the previous mount's failed read, and the path wrote nothing at all intooperations.log.What now stands between a read and a condemned mount
app/MountProbe.hholds the decision and its words, pure, shared by all three backends:major:minorplus statx's unique mount id (6.8+), with the mountinfo id as a named fallback — that id is reusable, which would have reproduced this bug on Linux deterministically. Windows: the drive letter plus the arrivalsWM_DEVICECHANGEreports under it.The journal now carries the episode. Exactly what a player will see:
One line per ghost episode, not per scan.
Deliberate departure from the issue's proposal
The issue asked for "two consecutive failures" inside the grace period. Implemented literally that bounds nothing: a probe launches on every verdict with none in flight, and the worker takes a verdict after every job it runs, so right after a card comes up the probes are a few hundred milliseconds apart and the second refusal lands inside the very transient the first one did. This episode's own forced unmounts came 0.4 s and 0.7 s after
card up— a two-strike rule would have allowed them. The window is therefore time, and the cost is that a dead mount is cleared three seconds later than before.Tests
tests/mount_probe_tests.cpp(83 checks) tests the decision as a GUI-free function, from the issue's spec: a fresh mount after a failed probe on the previous mount, a young mount refused once / twice / five times, a first read that outlasts the wedge timeout inside the window, a stuck probe past it, both boundaries of the window, the capability gap that may never condemn, and every journal line including the ones that must throw rather than describe a decision nobody took. Seven mutations of the decision were each caught by the suite, including the one an adversarial review used to show the earlier version could not fail.tests/mount_table_tests.cppgains the mountinfo field the Linux identity falls back to.The two call sites in
MainComponentare proved by reading it as text, the wayhidden_features_testsproves what this release hid: a component that wants a pedal, a worker and a screen cannot be asked headlessly, and silence on this path is half of what the issue is about.Not verified here
The live ghost needs the pedal: the decision and the words are proved by the suite, and the backends' own plumbing (IOKit, DiskArbitration, udev,
WM_DEVICECHANGE) is reviewed, not exercised. The reproduction in the issue is the check — press Connect, and the journal should now explain anything that still goes wrong.