|
| 1 | +--- |
| 2 | +"@objectstack/cli": patch |
| 3 | +--- |
| 4 | + |
| 5 | +fix(cli): `os doctor` no longer prints `✓ Unique scope` when it could not read the installed-package ledger (#5412) |
| 6 | + |
| 7 | +`readInstalledPackageEntries()` wrapped two unrelated facts in one un-bound |
| 8 | +`catch` and returned an empty entry list for both: |
| 9 | + |
| 10 | +- **`@objectstack/cloud-connection` does not resolve** — the optional package is |
| 11 | + not installed. Silence is correct here and stays: `os doctor` must run to |
| 12 | + completion in a checkout that never had it. |
| 13 | +- **The ledger directory exists and could not be read** — `fs.existsSync()` had |
| 14 | + already confirmed the directory is there, and producing its entry list threw |
| 15 | + (the path is occupied by a file, the filesystem refused, the read failed). |
| 16 | + |
| 17 | +The second was handled as the first. It reached the ADR-0120 D5e unique-scope |
| 18 | +advisory as "no installed packages", the advisory found nothing to report, and |
| 19 | +the run printed: |
| 20 | + |
| 21 | +``` |
| 22 | + ✓ Unique scope No unconfirmed installation-wide uniques for this 'isolated' environment |
| 23 | +``` |
| 24 | + |
| 25 | +So an environment **with** installed packages, whose ledger doctor could not |
| 26 | +read, got a clean bill of health for the one constraint the `isolated` posture |
| 27 | +makes dangerous. That is worse than a missing check: a false PASS is what stops |
| 28 | +an operator looking further. |
| 29 | + |
| 30 | +The two are now separate. The `import()` failure keeps its own silent `catch`; |
| 31 | +a ledger read failure comes back as a cause the caller can report, and the |
| 32 | +success line is withheld — it is a claim about **both** halves of the advisory |
| 33 | +(this project's metadata, and the manifests of installed packages), so it may |
| 34 | +only be printed when both halves ran. In its place doctor prints an ordinary |
| 35 | +`HealthCheckResult` through the same renderer every other check uses: |
| 36 | + |
| 37 | +``` |
| 38 | + ⚠ Unique scope Could not read the installed-package ledger (installed packages NOT |
| 39 | + checked for installation-wide uniques) — ENOTDIR: not a directory, … |
| 40 | +``` |
| 41 | + |
| 42 | +**Warning, not error**, and the exit code is unchanged: the environment still |
| 43 | +runs; what broke is doctor's ability to see part of it. The cause is quoted from |
| 44 | +the thrower rather than paraphrased, and `--verbose` expands the untruncated |
| 45 | +original plus which half of the check did not run — both free from reusing |
| 46 | +`renderHealthCheckResult()`. |
| 47 | + |
| 48 | +Findings from the half that **did** run are still reported: a ledger failure |
| 49 | +does not swallow the uniques this project's own metadata declares. |
| 50 | + |
| 51 | +**Not covered by this change**: a single *corrupt entry* inside an otherwise |
| 52 | +readable ledger. `LocalManifestSource.list()` skips unparseable files in its own |
| 53 | +per-file `catch`, so a truncated manifest is dropped inside the producer and the |
| 54 | +call succeeds with a short list that no consumer can distinguish from a complete |
| 55 | +one. Fixing that is a change to `@objectstack/cloud-connection`'s own contract |
| 56 | +and is tracked separately; the boundary is pinned by a test so it is not |
| 57 | +mistaken for covered. |
0 commit comments