Repository navigation
Commit 2d81af3
authored
host: abbreviate every home the report prints, so a long one keeps its reload advice (#2947)
Fixes #2944
Owner: Dev-1
Written-by: Dev-1
Reviewer: Birfy
Claim-Id: caae840c7c1c43ed93884afb23503c9e
Base: 6af7d04
Verified commit: 462e9bc13300707fcfe0382c07199ced532ae816 (tree
8a9733e)
Pushed head: 23d885f
Risk tier: T3 (`risk-gate (report only): PR #2947 tier T3; basis: the
`.dsh`/`DSH_HOME` diff rule matched `core/src/host/diagnostics.js` and
`core/test/diagnostics.test.js`; the change reads no `DSH_HOME`)
## What was wrong
The report abbreviated only the **OS home**: `clean`
(`core/src/host/diagnostics.js`) called `cleanText` with no `home`, so
it fell back to `homedir()`, while `cleanPath` passed `rt.home`. A DSH
home outside the OS home therefore stood in full in the `Read-only` row
and in the log lines the report prints, while the `state file:` row on
the same page said `~/state.json`. On a long home the row's 200 bound
then cut the sentence before its advice — `close the other one and
reload.` and `fix or move the file and reload.` disappeared.
## What changed
- `core/src/host/diagnostics.js`: `cleanText` takes one folder or a
**set** of them and abbreviates the longest first, so a team file under
both the OS home and this host's own reads `~/state.json` whichever
order the pair arrives in (`homeFolders`). `install` keeps its
log/stderr cleaner as it was (the process's home), and adds `show` for
what the report and the downloaded log print: the `Read-only` row, the
log lines, the file rows (`cleanPath`), the journal sentence, the
log-state sentence and the browser-client fields now all use both
folders. Abbreviation still happens before `cut()`, so the bound
measures the shortened text and the tail survives.
- `core/test/diagnostics.test.js`: the probe (`realHost(t, { locked:
true })` — no row may carry the home, the row names it `~`, and the
reload advice is still there), the same claim for a log line the report
prints, and the two `#2167` long-path fixtures now expect `~/state.json`
with the whole sentence instead of a cut. A third case keeps `#2936`
pinned: a sentence over the bound, with a path no home abbreviates, is
still cut between words with one `…`.
- `docs/subsystems/core-host.md`: the diagnostics sentence now says
`cleanText` turns **every** home folder into `~` first.
- `changelog.d/728-diagnostics-home-abbrev.fixed.md`: one fragment.
- `patches/ds-bot/0001-core-fixes.patch` and
`0007-version-and-tooling.patch`: generated once, after the edit, from
the committed tree. `core/src/client/**`, `core/client.js` and
`patches/ds-bot/0008-client-bundle.patch` are untouched.
In the usual layout, where the DSH home sits inside the OS home, the
same rule now shortens `~/.dsh/bot/state.json` to `~/state.json`: that
is the intended consequence of abbreviating every home, not an
unintended change to what the report says.
## Red first, on base `6af7d044` (tests in the tree, fix not yet
written)
1. Probe — `TZ=UTC node --test --import ./test/harness-resolve.mjs
--test-name-pattern='#2944' test/diagnostics.test.js`:
```
not ok 44 - no row of the report carries this host's home folder (#2944)
error: |-
no row carries the home folder: | | |
|---|---|
| FlyBot | 0.2.30 |
| DSH | 0.2.1-rc.2 |
| OS | linux 5.15.0-194-generic x64 |
| Node | v22.23.2 |
| Team | 0 Bots, 0 Main, 0 group chats |
| Read-only | The Bot team in /tmp/ds-bot-diag-ro-tYeKTd is open in another dsh (Web or Desktop, pid 1 on bluefox). This window shows the team but cannot change it; close the other one and reload. |
...
true !== false
```
2. The CI false green the issue names — a self-invented long home, the
file untouched at the base:
```
$ L=/tmp/$(printf 'h%.0s' {1..70}); TMPDIR=$L node --test --import ./test/harness-resolve.mjs test/diagnostics.test.js
not ok 41 - the Read-only row keeps the other-dsh wording when a live lock names it (#2167)
| Read-only | The Bot team in /tmp/hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh/ds-bot-diag-ro-7IbgpY is open in another dsh (Web or Desktop, pid 1 on bluefox). This window shows the team… |
# tests 70 / # pass 69 / # fail 1
```
Under the default `TMPDIR=/tmp` the same file at the same base is `#
tests 70 / # pass 70 / # fail 0` — the home there is short, so only a
long home exposes the cut.
## Mutations (each half of the change must go red alone)
- `Read-only` fact cleaned with the log cleaner (the report loses the
second home): `# tests 73 / # pass 70 / # fail 3` — cases 38 and 39 (the
two `#2167` long-home fixtures) and 44 (the probe).
- The report's log lines cleaned with the log cleaner: `# tests 73 / #
pass 72 / # fail 1` — only `a log line the report prints names the home
as ~ (#2944)`.
- `homeFolders` sorted shortest first: `# tests 73 / # pass 72 / # fail
1` — only the `cleanText` ordering assertion.
## What I ran, at `462e9bc13300707fcfe0382c07199ced532ae816` (tree
`8a9733e21c3f68ec35e3e95865c9fa8285abefbf`)
- `TZ=UTC npm run verify` (`TMPDIR=/tmp`, `DSH_HARNESS=…`): core lint
ok, `arch-docs: OK (6 changed file(s))`, plugin lint ok,
`build-client.mjs --check` ok, `ds-bot-patches check` `ok core/ equals
ds-bot/ + patches/ds-bot/`, `canonical` `ok patches/ds-bot/ is what
generate writes (generate is a no-op)`, then core `# tests 3178 / # pass
3176 / # fail 2`.
- The two core reds are `bench.sh refuses before writing the profile
when pnpm is missing` and `bench.sh shows a failed pnpm install and
leaves no half-built profile` in `core/test/bench-preflight.test.js`.
They are this box, not this change: a clean detached worktree at base
`6af7d044` runs the same file `# tests 7 / # pass 5 / # fail 2` with the
same two names.
- Because `npm run verify` stops at that suite, its later steps ran
separately at the same commit: `plugins/social` 619/619, `plugins/tree`
149/149, `plugins/timeline` 172/172, `plugins/workflow` 531/531,
`plugins/project` 147/147, `.github/scripts` + `policy` 675/675,
`changelog.mjs check` `18 fragment(s) … well formed`, `lint:interop`
exit 0, `test:interop` exit 0, `lint:live-e2e` exit 0, `test:live-e2e`
exit 0 — all exit 0.
- `core/test/diagnostics.test.js` on its own: `# tests 73 / # pass 73 /
# fail 0`, and under the long home (`L=/tmp/$(printf 'h%.0s' {1..70})`,
`TMPDIR=$L`) also `# tests 73 / # pass 73 / # fail 0`.
## Not run
- The smoke bench (`dev/bench.sh smoke`) — this box's bench preflight is
the known red above (`pnpm` missing), so a bench run would report the
environment, not this card; nothing here changes start-up.
- No browser/client build: `core/src/client/**` is untouched and
`build-client.mjs --check` confirms `client.js` still is the build of
`src/client`.
## Checkpoint
<!-- flybot:checkpoint -->
```json
{
"pr": 2947,
"claim": "Dev-1",
"issue": 2944,
"summary": "The report abbreviated only the OS home, so a DSH home outside it stood in full in the Read-only row and in the log lines the report prints, while the file rows beside it said ~/state.json; on a long home the 200 bound then cut the reload advice off the sentence. cleanText now takes one folder or a set of them, longest first, and the report and the downloaded log hand it both the process's home and this host's own, while the host's own log and stderr keep the folder a person can open. Abbreviation still happens before the bound, so a long home no longer loses the tail.",
"files": ["core/src/host/diagnostics.js", "core/test/diagnostics.test.js", "docs/subsystems/core-host.md", "changelog.d/728-diagnostics-home-abbrev.fixed.md", "patches/ds-bot/0001-core-fixes.patch", "patches/ds-bot/0007-version-and-tooling.patch"],
"checks": {"ran": "TZ=UTC npm run verify; plugins/social|tree|timeline|workflow|project test; node --test .github/scripts/*.test.mjs policy/*.test.mjs; lint:interop test:interop lint:live-e2e test:live-e2e; changelog check; ARCH_DOCS_BASE=6af7d044 npm run arch-docs; diagnostics 73/73 default and under a long TMPDIR", "result": "green", "at": "462e9bc13300707fcfe0382c07199ced532ae816"},
"next": "waiting for a Verdict naming the pushed head"
}
```
<!-- /flybot:checkpoint -->1 parent 1b2408e commit 2d81af3
6 files changed
Lines changed: 193 additions & 57 deletions
File tree
- changelog.d
- core
- src/host
- test
- docs/subsystems
- patches/ds-bot
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
26 | 33 | | |
27 | 34 | | |
28 | 35 | | |
| |||
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
| 52 | + | |
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
48 | | - | |
49 | | - | |
| 56 | + | |
| 57 | + | |
50 | 58 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
55 | 63 | | |
56 | 64 | | |
57 | 65 | | |
| |||
162 | 170 | | |
163 | 171 | | |
164 | 172 | | |
| 173 | + | |
| 174 | + | |
165 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
166 | 181 | | |
167 | 182 | | |
168 | 183 | | |
| |||
269 | 284 | | |
270 | 285 | | |
271 | 286 | | |
272 | | - | |
273 | | - | |
| 287 | + | |
| 288 | + | |
274 | 289 | | |
275 | 290 | | |
276 | 291 | | |
| |||
311 | 326 | | |
312 | 327 | | |
313 | 328 | | |
314 | | - | |
315 | | - | |
316 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
317 | 333 | | |
318 | 334 | | |
319 | 335 | | |
| |||
434 | 450 | | |
435 | 451 | | |
436 | 452 | | |
437 | | - | |
| 453 | + | |
438 | 454 | | |
439 | 455 | | |
440 | 456 | | |
| |||
444 | 460 | | |
445 | 461 | | |
446 | 462 | | |
447 | | - | |
| 463 | + | |
448 | 464 | | |
449 | 465 | | |
450 | 466 | | |
| |||
456 | 472 | | |
457 | 473 | | |
458 | 474 | | |
459 | | - | |
| 475 | + | |
460 | 476 | | |
461 | 477 | | |
462 | | - | |
| 478 | + | |
463 | 479 | | |
464 | 480 | | |
465 | 481 | | |
466 | 482 | | |
467 | | - | |
| 483 | + | |
468 | 484 | | |
469 | 485 | | |
470 | 486 | | |
| |||
473 | 489 | | |
474 | 490 | | |
475 | 491 | | |
476 | | - | |
| 492 | + | |
477 | 493 | | |
478 | 494 | | |
479 | 495 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
1022 | 1026 | | |
1023 | 1027 | | |
1024 | 1028 | | |
1025 | | - | |
| 1029 | + | |
1026 | 1030 | | |
1027 | 1031 | | |
1028 | 1032 | | |
1029 | 1033 | | |
1030 | 1034 | | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
1034 | 1040 | | |
1035 | 1041 | | |
1036 | 1042 | | |
1037 | 1043 | | |
1038 | | - | |
| 1044 | + | |
1039 | 1045 | | |
1040 | 1046 | | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
1041 | 1062 | | |
1042 | | - | |
1043 | 1063 | | |
1044 | | - | |
1045 | 1064 | | |
1046 | 1065 | | |
1047 | 1066 | | |
| |||
1062 | 1081 | | |
1063 | 1082 | | |
1064 | 1083 | | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
1065 | 1106 | | |
1066 | 1107 | | |
1067 | 1108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
469 | | - | |
| 469 | + | |
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
| |||
0 commit comments