q08

The Red Is the Truth

2026-09-14 · sumimakito/Mac-Duo

Mac Duo is a small menubar application that brings the iPhone's dual-display effect to a MacBook: as the lid closes, the screen content tilts, blurs, and fades, as if the display were folding back into a second panel behind the glass. It renders the effect with Metal, captures the live screen with ScreenCaptureKit, and reads one physical input: the lid angle sensor. The project's README contains a sentence that is easy to read past and is the entire structure of what happens next: only MacBooks with a compatible lid angle sensor can use the effect — the app reports when no sensor is available — and the sensor must be one that macOS marks as built-in, because an external display with a similar sensor is ignored. The operating system already knows something the app does not fully honor: this particular stream of measurements is only trustworthy under conditions the app cannot verify.

When the lid passes halfway, the effect sometimes fails the way it fails for the people who filed the bug reports: the screen floods with a red gradient, a flickering crimson wash where the smooth fold should be. The failure is usually described as a rendering glitch, and the description is wrong. The hinge sensor reports the lid angle in discrete steps — it quantizes, it lags the hand that moved the lid, and its readings arrive on a clock of their own. The Metal pipeline consumes that stream as if it were continuous: it interpolates between angle values as if each were exact, extrapolates beyond the range it was calibrated for when a jump arrives, and feeds the result into a perspective transform whose tone mapping clamps over-bright values into saturated red. The red is not a bug in the shader. The shader is the most honest component in the chain: it renders the sensor's true state — its steps, its staleness, its dead zones — as pixels, faithfully, for anyone to see.

This is a class of failure, not a device, and the class has a precise shape. A sensor produces values that are approximate in three distinct ways: they are discrete where the world is continuous, they lag the motion they describe, and they occasionally leave the range the downstream stage was sized for. The downstream stage consumes the stream as if none of that were true. Every system with that shape — a physical measurement on one side, a computation that treats it as fact on the other, and no validation layer between them — will render its sensor's lies eventually, and the failure will always appear at the output, as an artifact that looks like a rendering bug but is actually a measurement being displayed. Camera metering trusts the shutter to have opened when the electronics asked it to. A drone trusts its barometer to hold steady. The MacBook effect trusts the hinge. The artifact is the one honest witness.

The class's most expensive member flew in 1996. Ariane 5 flight 501 lifted off on the fourth of June, and thirty-seven seconds later the rocket self-destructed over the Atlantic. The failure chain began with a 64-bit floating-point value — the rocket's horizontal velocity — converted into a 16-bit integer that could not hold it. The conversion overflowed, the exception shut down the inertial guidance computer, the identical backup computer ran the identical code and shut down too, and the launcher, now flying blind, tore itself apart. The code was correct. It was correct for Ariane 4, whose trajectory never produced a horizontal velocity that overflowed the integer, and it had been reused, unvalidated, in a faster rocket with a different flight envelope. The boundary between measurement and computation had been built for the wrong vehicle, and the missing validation cost a launcher. The second famous member is the pitot tube: when ice blocks the airspeed probes, the instruments report a consistent, confident, entirely false airspeed, and the automation trusts it because nothing at the boundary between probe and computer is watching for the failure mode. The system cannot know its sensors are lying, because the boundary where that knowledge would live was never built.

The computation field encoded the lesson in a different register long ago: floating-point arithmetic specifies that a calculation can produce NaN, a value that means "this was never a number," and the discipline that grew up around it is to validate at the boundary — check the input where it enters, clamp it to the envelope, and refuse to let poison propagate. The validation is cheap precisely because it happens once, at the edge, where the measurement becomes a number. Sensor pipelines are the same problem in physical form, and they rarely build the boundary, because the boundary belongs to nobody. The sensor is one team's hardware. The rendering is another team's software. The seam between them — where the approximate world of the first meets the exact world of the second — appears in no component's specification, because each team's contract covers its own artifact and stops at the edge of it. Every party in the chain behaves rationally, and the artifact at the end is where the contracts' silence becomes visible. By the time it is visible, it is pixels, and pixels cannot be blamed on a missing requirement.

The app's own documentation shows it standing on the edge of the boundary without crossing it. It checks that a sensor exists, and that the sensor is on the allowlist the operating system maintains — an honest, careful check. What it does not check is whether the stream leaving the sensor is valid at the moment of rendering: whether the values sit inside the calibrated envelope, whether a reading is stale, whether a jump of thirty degrees in a single frame is real motion or a quantization artifact. Availability is not validity, and the distance between the two checks is exactly where the red lives. The check that exists is about the sensor's identity; the check that does not exist is about the sensor's stream. A system that verifies its instruments but not their measurements has built half a boundary, and a half-built boundary fails exactly the way this one does — on the measurement, not the instrument.

There is also an economic reason the second half goes unbuilt, and it explains the pattern across every member of the class. Validation is pure cost in the success case: when the sensor behaves, the calibration layer does nothing, adds nothing visible, and delays nothing the user can see. Its entire value is concentrated in the failure case, which is rare, so a system built for the success case omits it, the way an uninsured building omits the fire wall. The Ariane 5 analysis made the point in engineering language: the overflow handler had been disabled because the Ariane 4 trajectory could never trigger it — protection against a failure that could not happen — and the rocket paid for the insurance it skipped. The MacBook effect skipped the same premium on a smaller scale, and the red flare is the invoice.

The red flare, read correctly, is a diagnostic the designers did not intend but the system performs anyway: it marks the exact point where the measurement stopped being a measurement, where the sensor's quantization and latency stopped being hidden and started being rendered. The screen is not broken. It is showing the sensor what the sensor is — and the systems that survive longest are not the ones with the best sensors or the best shaders, but the ones that built the boundary nobody owned, and built it early, in the only color the pipeline had left.

Was this worth your time? yesflatno

Sources & further reading