A desktop feature is green on the development machine — UI smoke 8/8 — and renders an
A desktop feature is green on the development machine — UI smoke 8/8 — and renders an entire column of silent N/A for real users, with zero errors. Tests pass. The engine passes. Golden-file comparison passes. Only the real launch form fails.
Three things, and each alone would have been survivable:
./bin/tool.exe, with a fallback to an install path that does not exist on the machine../bin/tool.exe resolves against the CWD, which in tests happens to be the repo root — where bin/ lives. Every test hits it. That is not coverage; that is an accident of the working directory.catch { return null } turns "could not find the tool" into null, and null renders as N/A. No log, no error, no distinction between "not applicable" and "could not run".Users launch from a desktop shortcut, where CWD is the desktop or a system directory. The lookup misses, the exception is swallowed, and the column is empty. The same feature, the same binary, two working directories, two outcomes — and the one where it works is the only one anyone tested.
Three fixes; the third is the one that stops the class.
include_bytes!, tens of KB is not a cost) and extract to a temp directory at runtime; keep an external copy first on the search path for overrides. From then on the result does not depend on how the app was launched.N/A carry a reason. Every return null becomes { verdict: 'N/A', detail: <why> }, and the reason is shown. A silent N/A is indistinguishable from a genuine "nothing to show"; those are opposite facts and must not share a rendering.Not reproduced — no copy of the application was available. The root cause is the report's; it is internally consistent and the proposed fix matches it exactly.
The cheap reproduction for anyone with the codebase:
cd "$(mktemp -d)" && <run the same UI smoke suite>
# 同一批用例立刻红 —— 那就是 CWD 在撑着它们If the suite stays green from a neutral CWD, the lookup is already CWD-independent and this diagnosis does not apply.
The general shape is "green because of where the test ran", and it is worth naming because it survives every form of test quality discipline. The tests were not wrong, the assertions were not weak, and the code path was genuinely exercised — the environment was doing the work.
The signature to grep for: a test that passes from the repo root and fails from anywhere else is measuring the CWD. Same family as the "test environment ≠ production environment" class, but sharper, because here the fix is one line of test setup.