dsh-better-debug 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +19 -2
- package/README.md +16 -2
- package/package.json +4 -3
package/README.en.md
CHANGED
|
@@ -184,7 +184,7 @@ dsh plugin add dsh-better-debug
|
|
|
184
184
|
**Or from the Release tarball (pnpm treats it as a normal package):**
|
|
185
185
|
|
|
186
186
|
```bash
|
|
187
|
-
dsh plugin add https://github.com/Leonlee114514/dsh-better-debug/releases/download/v0.2.
|
|
187
|
+
dsh plugin add https://github.com/Leonlee114514/dsh-better-debug/releases/download/v0.2.4/dsh-better-debug-0.2.4.tgz
|
|
188
188
|
```
|
|
189
189
|
|
|
190
190
|
(Both install the same package: the npm tarball is byte-identical to the Release asset.
|
|
@@ -302,6 +302,7 @@ node --check lib/index.js && node --check lib/panel.js && node --check lib/text.
|
|
|
302
302
|
node test/sim.mjs # 46 cases: gate semantics + portability
|
|
303
303
|
node test/panel.mjs # 40 cases: log parsing, aggregation, generation scoping, instrumentation
|
|
304
304
|
npm run test:posix # re-runs both suites under POSIX path semantics
|
|
305
|
+
npm run test:linux # re-runs both suites under Linux platform semantics (no case folding)
|
|
305
306
|
npm run verify # all of the above (with syntax checks)
|
|
306
307
|
```
|
|
307
308
|
|
|
@@ -318,7 +319,7 @@ Semantics (each with a positive and a negative):
|
|
|
318
319
|
|
|
319
320
|
**No DSH runtime required** — run it first after any change.
|
|
320
321
|
|
|
321
|
-
### Why there
|
|
322
|
+
### Why there are `test:posix` and `test:linux` passes
|
|
322
323
|
|
|
323
324
|
Every path in `test/sim.mjs` is written in Windows dialect (`C:/work/...`). The suite still
|
|
324
325
|
runs on a Linux box, but it exercises a *different* set of semantics — which was exactly a
|
|
@@ -335,6 +336,21 @@ and then **re-runs both suites unchanged** — so a Windows dev machine reproduc
|
|
|
335
336
|
semantics. CI runs `npm run verify` on ubuntu / windows / macos × node 20 / 22 / 24, so this
|
|
336
337
|
cannot quietly regress. (24 is not padding: the desktop build runs Electron's bundled node 24.)
|
|
337
338
|
|
|
339
|
+
`test:linux` covers the other axis. `test:posix` swaps only `node:path` and **does not fake
|
|
340
|
+
`process.platform`**, so `CASE_INSENSITIVE` stays `true` in that pass. The case-folding branch
|
|
341
|
+
never executes on a Windows dev machine — until 2026-11-14, when real ubuntu CI turned the two new
|
|
342
|
+
v0.2.2 assertions red: they hard-coded lowercase expectations (`c:/users/u/...`,
|
|
343
|
+
`['/home/u/projb']`), while Linux keeps the case you wrote. The defect was not in the code under
|
|
344
|
+
test but **in assertions that had absorbed this machine's platform** — they were testing "passes on
|
|
345
|
+
Windows".
|
|
346
|
+
|
|
347
|
+
`test/linux/register.mjs` overrides `process.platform` to `linux` and touches nothing else (it is
|
|
348
|
+
a getter, so it needs `Object.defineProperty`; a plain assignment is silently ignored). With the
|
|
349
|
+
two axes separated, three of the four "path dialect × case sensitivity" combinations run on a
|
|
350
|
+
Windows dev machine and CI supplies the fourth. The assertions no longer hard-code a case:
|
|
351
|
+
`samePath` / `sameDirs` compare per platform, and expectations are written in their **original
|
|
352
|
+
case** (`C:/Users/u/...`, `/home/u/projB`).
|
|
353
|
+
|
|
338
354
|
The rest of the same family, all fixed in v0.2 / v0.2.1 / v0.2.2 / v0.2.3:
|
|
339
355
|
|
|
340
356
|
| Symptom | Root cause | Now |
|
|
@@ -348,6 +364,7 @@ The rest of the same family, all fixed in v0.2 / v0.2.1 / v0.2.2 / v0.2.3:
|
|
|
348
364
|
| `a1.js` and `a2.js` are treated as the same place | normalisation replaced every digit in the path with `<n>`; only line/column should go | only the trailing `(:\d+)+$` is stripped |
|
|
349
365
|
| Running tests in a sibling directory washed out this directory's blind-edit count | `measureDirs` treated `cd <dir>` as a file and took its parent (`cd ~/projB` → `~`) | `cd` is recognised; that segment is a directory |
|
|
350
366
|
| The panel kept showing "the plugin is currently disabled" while it was clearly running | the banner counted `disabled` / `panel failed` over the **whole log**, so one historical failure counted as "broken now" forever | the banner only reads the generation after the last `apply` (`log.current`); history is reported separately in the footer |
|
|
367
|
+
| New assertions were green on Windows and red on real Linux CI | they hard-coded the `CASE_INSENSITIVE` fold result; `test:posix` swaps `node:path` but not `platform`, so that branch never ran here | the `test:linux` pass overrides `process.platform`, and assertions compare through `samePath` per platform |
|
|
351
368
|
|
|
352
369
|
**Case folding is decided per platform** (`CASE_INSENSITIVE`): only on `win32` / `darwin`.
|
|
353
370
|
The cost of folding wrong is asymmetric — not folding when you should under-reports, folding
|
package/README.md
CHANGED
|
@@ -222,7 +222,7 @@ dsh plugin add dsh-better-debug
|
|
|
222
222
|
**或者从 Release tarball 装(pnpm 会把它当普通包装进 profile):**
|
|
223
223
|
|
|
224
224
|
```bash
|
|
225
|
-
dsh plugin add https://github.com/Leonlee114514/dsh-better-debug/releases/download/v0.2.
|
|
225
|
+
dsh plugin add https://github.com/Leonlee114514/dsh-better-debug/releases/download/v0.2.4/dsh-better-debug-0.2.4.tgz
|
|
226
226
|
```
|
|
227
227
|
|
|
228
228
|
(两条装的是同一个包:npm 上的 tarball 与 Release 资产逐字节相同。走 npm 的好处是
|
|
@@ -366,6 +366,7 @@ node --check lib/index.js && node --check lib/panel.js && node --check lib/text.
|
|
|
366
366
|
node test/sim.mjs # 46 个用例:闸门语义 + 可移植性
|
|
367
367
|
node test/panel.mjs # 40 个用例:日志解析、聚合、世代判定、埋点落盘
|
|
368
368
|
npm run test:posix # 把上面两套用 POSIX 路径语义再跑一遍
|
|
369
|
+
npm run test:linux # 再把上面两套用 Linux 平台语义(不折叠大小写)跑一遍
|
|
369
370
|
npm run verify # 上面全部(含语法检查)
|
|
370
371
|
```
|
|
371
372
|
|
|
@@ -387,7 +388,7 @@ npm run verify # 上面全部(含语法检查)
|
|
|
387
388
|
|
|
388
389
|
**不依赖 DSH 运行时**,改动后先跑它。
|
|
389
390
|
|
|
390
|
-
### 为什么有 `test:posix`
|
|
391
|
+
### 为什么有 `test:posix` 与 `test:linux` 两轮
|
|
391
392
|
|
|
392
393
|
`test/sim.mjs` 里的路径全是 `C:/work/...` 这种 Windows 方言。它在一台 Linux 机器上照样
|
|
393
394
|
能跑,但跑的是**另一套语义**——这正是 v0.2 之前的一个真事故:
|
|
@@ -402,6 +403,18 @@ npm run verify # 上面全部(含语法检查)
|
|
|
402
403
|
ubuntu / windows / macos × node 20 / 22 / 24 上跑 `npm run verify`,所以这条不会退回去。
|
|
403
404
|
(24 不是凑数:桌面版 DSH 跑的是 Electron 内置的 node 24。)
|
|
404
405
|
|
|
406
|
+
`test:linux` 补的是另一根轴。`test:posix` 只换 `node:path`,**不伪造 `process.platform`**,
|
|
407
|
+
所以那一轮里 `CASE_INSENSITIVE` 仍然是 `true`。大小写折叠这条分支因此在本机永远不执行——
|
|
408
|
+
直到 2026-11-14,真机 ubuntu CI 把 v0.2.2 的两组新断言打红:期望值写死成小写
|
|
409
|
+
(`c:/users/u/...`、`['/home/u/projb']`),而 Linux 上路径区分大小写、原样保留大小写。
|
|
410
|
+
根因不在被测代码,在**断言本身也沾了本机平台**——它测的是「Windows 上通过」。
|
|
411
|
+
|
|
412
|
+
`test/linux/register.mjs` 只把 `process.platform` 覆盖成 `linux`(它是 getter,必须
|
|
413
|
+
`Object.defineProperty`;直接赋值会被静默忽略),不碰 path 模块。两轴分开之后,
|
|
414
|
+
「path 方言 × 大小写敏感」四种组合里有三种能在 Windows 开发机上跑到,剩下的
|
|
415
|
+
Linux + posix 由 CI 补。断言里因此不再写死某种大小写,而是用 `samePath` / `sameDirs`
|
|
416
|
+
按平台比较,期望值用**原始大小写**书写(`C:/Users/u/...`、`/home/u/projB`)。
|
|
417
|
+
|
|
405
418
|
同一类问题的其余各处,都在 v0.2 / v0.2.1 / v0.2.2 / v0.2.3 修掉了:
|
|
406
419
|
|
|
407
420
|
| 症状 | 根因 | 现在 |
|
|
@@ -415,6 +428,7 @@ ubuntu / windows / macos × node 20 / 22 / 24 上跑 `npm run verify`,所以
|
|
|
415
428
|
| `a1.js` 与 `a2.js` 被当成同一处 | 归一化把路径里每个数字都换成 `<n>`,只该剥行号列号 | 只剥末尾 `(:\d+)+$` |
|
|
416
429
|
| 在兄弟目录跑测试,把这个目录的盲改计数洗白了 | `measureDirs` 把 `cd <dir>` 当文件取父目录(`cd ~/projB` → `~`) | 认 `cd` 形式,那段路径按目录处理 |
|
|
417
430
|
| 面板永远红着脸说「插件当前被关闭」,而它明明在跑 | 横幅数的是**整份日志**里的 `disabled` / `panel failed`,历史里挂过一次就永久算「现在坏了」 | 横幅只认最后一次 `apply` 之后(`log.current`),历史单独的个数写在页脚 |
|
|
431
|
+
| 新加的用例在 Windows 上全绿,真机 Linux CI 全红 | 断言把 `CASE_INSENSITIVE` 的折叠结果写死了;`test:posix` 只换 `node:path`、不伪造 `platform`,那条分支本机永不执行 | `test:linux` 轮覆盖 `process.platform`,断言改用 `samePath` 按平台比 |
|
|
418
432
|
|
|
419
433
|
**大小写折叠按平台判**(`CASE_INSENSITIVE`):只在 `win32` / `darwin` 上折叠。折叠错了的
|
|
420
434
|
后果不对称——该折叠却不折叠是漏报,不该折叠却折叠是**误报**(狼来了),后者才是这道闸门
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-better-debug",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "卡住闸门的代码化:同一文件连续盲改 / 同一操作重复报错 / 改完没有回路又动手,命中就在下一步注入一次提醒,逼出一条几秒能跑的反馈回路。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -49,10 +49,11 @@
|
|
|
49
49
|
"dsh": ">=0.2.1-rc.5"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
|
-
"check": "node --check lib/index.js && node --check lib/panel.js && node --check lib/text.js && node --check client.js && node --check test/sim.mjs && node --check test/panel.mjs && node --check test/posix/register.mjs && node --check test/posix/hooks.mjs && node --check test/posix/path.mjs",
|
|
52
|
+
"check": "node --check lib/index.js && node --check lib/panel.js && node --check lib/text.js && node --check client.js && node --check test/sim.mjs && node --check test/panel.mjs && node --check test/posix/register.mjs && node --check test/posix/hooks.mjs && node --check test/posix/path.mjs && node --check test/linux/register.mjs",
|
|
53
53
|
"test:unit": "node test/sim.mjs && node test/panel.mjs",
|
|
54
54
|
"test:posix": "node --import ./test/posix/register.mjs test/sim.mjs && node --import ./test/posix/register.mjs test/panel.mjs",
|
|
55
|
-
"test": "
|
|
55
|
+
"test:linux": "node --import ./test/linux/register.mjs test/sim.mjs && node --import ./test/linux/register.mjs test/panel.mjs",
|
|
56
|
+
"test": "npm run test:unit && npm run test:posix && npm run test:linux",
|
|
56
57
|
"verify": "npm run check && npm test"
|
|
57
58
|
}
|
|
58
59
|
}
|