servediff 0.4.0__tar.gz → 0.4.2__tar.gz

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.
Files changed (35) hide show
  1. {servediff-0.4.0 → servediff-0.4.2}/CHANGELOG.md +19 -0
  2. {servediff-0.4.0 → servediff-0.4.2}/PKG-INFO +47 -6
  3. {servediff-0.4.0 → servediff-0.4.2}/README.md +46 -5
  4. {servediff-0.4.0 → servediff-0.4.2}/README.zh-CN.md +17 -1
  5. {servediff-0.4.0 → servediff-0.4.2}/pyproject.toml +1 -1
  6. {servediff-0.4.0 → servediff-0.4.2}/src/servediff/cli.py +33 -7
  7. {servediff-0.4.0 → servediff-0.4.2}/src/servediff.egg-info/PKG-INFO +47 -6
  8. {servediff-0.4.0 → servediff-0.4.2}/tests/test_cli.py +9 -0
  9. {servediff-0.4.0 → servediff-0.4.2}/CONTRIBUTING.md +0 -0
  10. {servediff-0.4.0 → servediff-0.4.2}/LICENSE +0 -0
  11. {servediff-0.4.0 → servediff-0.4.2}/MANIFEST.in +0 -0
  12. {servediff-0.4.0 → servediff-0.4.2}/examples/issue-excerpts/vllm-47047-v0.23-default.log +0 -0
  13. {servediff-0.4.0 → servediff-0.4.2}/examples/issue-excerpts/vllm-47047-v0.23-marlin.log +0 -0
  14. {servediff-0.4.0 → servediff-0.4.2}/examples/issue-excerpts/vllm-53472-v0.23.log +0 -0
  15. {servediff-0.4.0 → servediff-0.4.2}/examples/issue-excerpts/vllm-53472-v0.26-flag.log +0 -0
  16. {servediff-0.4.0 → servediff-0.4.2}/examples/issue-excerpts/vllm-53472-v0.26.log +0 -0
  17. {servediff-0.4.0 → servediff-0.4.2}/setup.cfg +0 -0
  18. {servediff-0.4.0 → servediff-0.4.2}/src/servediff/__init__.py +0 -0
  19. {servediff-0.4.0 → servediff-0.4.2}/src/servediff/__main__.py +0 -0
  20. {servediff-0.4.0 → servediff-0.4.2}/src/servediff/env.py +0 -0
  21. {servediff-0.4.0 → servediff-0.4.2}/src/servediff.egg-info/SOURCES.txt +0 -0
  22. {servediff-0.4.0 → servediff-0.4.2}/src/servediff.egg-info/dependency_links.txt +0 -0
  23. {servediff-0.4.0 → servediff-0.4.2}/src/servediff.egg-info/entry_points.txt +0 -0
  24. {servediff-0.4.0 → servediff-0.4.2}/src/servediff.egg-info/requires.txt +0 -0
  25. {servediff-0.4.0 → servediff-0.4.2}/src/servediff.egg-info/top_level.txt +0 -0
  26. {servediff-0.4.0 → servediff-0.4.2}/tests/fixtures/README.md +0 -0
  27. {servediff-0.4.0 → servediff-0.4.2}/tests/fixtures/sglang-0.4.4-tp4.log +0 -0
  28. {servediff-0.4.0 → servediff-0.4.2}/tests/fixtures/vllm-0.23.1-tp8-allreduce.log +0 -0
  29. {servediff-0.4.0 → servediff-0.4.2}/tests/fixtures/vllm-0.29-tp4-ep-h200-allreduce.log +0 -0
  30. {servediff-0.4.0 → servediff-0.4.2}/tests/fixtures/vllm-47047-v0.23-default.log +0 -0
  31. {servediff-0.4.0 → servediff-0.4.2}/tests/fixtures/vllm-47047-v0.23-marlin.log +0 -0
  32. {servediff-0.4.0 → servediff-0.4.2}/tests/fixtures/vllm-53472-v0.23.log +0 -0
  33. {servediff-0.4.0 → servediff-0.4.2}/tests/fixtures/vllm-53472-v0.26-flag.log +0 -0
  34. {servediff-0.4.0 → servediff-0.4.2}/tests/fixtures/vllm-53472-v0.26.log +0 -0
  35. {servediff-0.4.0 → servediff-0.4.2}/tests/test_env.py +0 -0
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2 — 2026-11-07
4
+
5
+ - An unreadable path (`servediff show typo.log`, `diff` with a missing side) no longer
6
+ raises a traceback and exits 1. Exit 1 means "the two sides differ", so a mistyped
7
+ path used to read as a detected difference; it now prints one line and exits 2.
8
+ - `diff` on two `servediff env` snapshots marks truncated cells with `...`, like the
9
+ log diff already did.
10
+ - README gains a commands-and-exit-codes table, including which env vars `env` records
11
+ and the fact that `1` never means "something went wrong".
12
+
13
+ ## 0.4.1 — 2026-11-07
14
+
15
+ - Table cells mark truncated values with `...` instead of cutting them mid-word. A
16
+ cell that ended in `TP ran` read like the value itself rather than a clipped column.
17
+ - README examples regenerated from this build. The quickstart block now shows the two
18
+ `note:` lines the tool actually prints, and the 0.28-vs-0.30 blocks carry the real
19
+ `15 difference(s); 9 fact(s) identical` and `10 difference(s); 13 fact(s) identical`
20
+ — the old numbers predated several fact rules.
21
+
3
22
  ## 0.4.0 — 2026-11-06
4
23
 
5
24
  - `servediff series a.log b.log c.log` compares three or more runs in one table with
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: servediff
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: Diff what your vLLM / SGLang server actually ran with: auto-selected backends, CUDA graphs, startup failures, dependency versions.
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Homepage, https://github.com/apex-mochen/servediff
@@ -49,13 +49,37 @@ git clone https://github.com/apex-mochen/servediff && cd servediff
49
49
  servediff diff examples/issue-excerpts/vllm-47047-v0.23-default.log examples/issue-excerpts/vllm-47047-v0.23-marlin.log
50
50
  ```
51
51
 
52
+ Install from PyPI. A different, unrelated tool also uses the name `servediff` in a
53
+ third-party Homebrew tap; the `pip install servediff` package is this one.
54
+
52
55
  ```text
56
+ note: baseline: no all-reduce facts and no rank line: cannot tell whether this run had more than one rank, so an absent all-reduce path here is inconclusive
57
+ note: candidate: no all-reduce facts and no rank line: cannot tell whether this run had more than one rank, so an absent all-reduce path here is inconclusive
58
+
53
59
  fact baseline candidate status
54
60
  backend.moe VLLM_CUTLASS (NvFp4) MARLIN (NvFp4) changed
55
61
 
56
62
  1 difference(s); 0 fact(s) identical. Absent means the log did not print it, not that it was off.
57
63
  ```
58
64
 
65
+ The two `note:` lines are part of the answer, not noise: the excerpt posted in that
66
+ issue carries no rank line, so this run cannot say whether it was multi-GPU at all,
67
+ and the tool says so instead of leaving you to read silence as "unchanged".
68
+
69
+ ## Commands and exit codes
70
+
71
+ | Command | What it reads | Exit codes |
72
+ |---|---|---|
73
+ | `servediff show <log>` | one startup log (or `-` for stdin) → the facts it printed, each with its line number; `--json` | `0` read something; `2` unreadable path or no line recognised |
74
+ | `servediff diff <a> <b>` | two startup logs, or two `servediff env` snapshots; `--json`, `--markdown`, `--all`, `--raw-args` | `0` identical; `1` at least one difference; `2` usage error, unreadable path, or one log mixed with one snapshot |
75
+ | `servediff series <a> <b> <c> ...` | three or more startup logs, in the column order you give → one fact per row; `--json`, `--markdown`, `--all`, `--raw-args` | `0` same across every log; `1` at least one fact differs; `2` fewer than three inputs |
76
+ | `servediff env [--python P] [-o snap.json]` | that interpreter's packages, GPU info, and env vars whose names start with `VLLM_` / `SGLANG_` / `SGL_` / `CUDA_` / `NCCL_` / `TORCH_` / `PYTORCH_` / `FLASHINFER_` / `TRITON_` or are `HF_HUB_OFFLINE` / `TRANSFORMERS_OFFLINE`; secret-looking names become `<redacted>` | `0` written; `2` snapshot failed |
77
+ | `servediff capture [-o run.log] -- <server command>` | runs the server, tees its log, and writes `<out>.env.json` **before** launch | the server's own exit code |
78
+
79
+ `1` always means *the inputs differ* — never *something went wrong* — so
80
+ `servediff diff old.log new.log` works directly as a CI gate. At most one input may be
81
+ `-`, because stdin can only be read once.
82
+
59
83
  That is the difference the reporter of
60
84
  [vllm#47047](https://github.com/vllm-project/vllm/issues/47047) found by hand after a
61
85
  v0.21 → v0.23 throughput drop. The example files are the log lines posted in that
@@ -73,18 +97,27 @@ servediff diff vllm-0.28.0.log vllm-0.30.0.log
73
97
  ```text
74
98
  warning: baseline server failed to start: RuntimeError: UVA is not available; facts after the failure are absent because startup stopped, not because they were off
75
99
 
100
+ note: baseline: no all-reduce facts: world_size=1, so there is no all-reduce group and no backend is chosen; a TP>1 run is what makes this path observable
101
+ note: candidate: no all-reduce facts: world_size=1, so there is no all-reduce group and no backend is chosen; a TP>1 run is what makes this path observable
102
+
76
103
  fact baseline candidate status
77
104
  backend.attention <absent> FLASH_ATTN only_candidate
78
105
  backend.flash_attn_version <absent> 2 only_candidate
79
106
  backend.sampling_flashinfer <absent> disabled only_candidate
107
+ compile.artifacts <absent> 25 entries, 3 artifacts, 4996920 bytes only_candidate
108
+ compile.total_s <absent> 31.08 only_candidate
80
109
  cuda_graph.captures <absent> ["PIECEWISE x51", "FULL x2", "FULL x35"] only_candidate
81
110
  cuda_graph.pool_gib <absent> 0.17 only_candidate
82
111
  engine.version 0.28.0 0.30.0 changed
112
+ kv_cache.layout <absent> LBNHC only_candidate
113
+ model_loading.gib <absent> 0.93 only_candidate
114
+ model_loading.seconds <absent> 19.122619 only_candidate
115
+ parallel.roles DP rank 0, PP rank 0, PCP rank 0, TP ... DP rank 0, PP rank 0, PCP rank 0, TP ... changed
83
116
  startup failed ready changed
84
- startup.error ["RuntimeError: UVA is not available", " <absent> only_baseline
117
+ startup.error ["RuntimeError: UVA is not available"... <absent> only_baseline
85
118
  uva_buffers <absent> fallback: device memory only_candidate
86
119
 
87
- 9 difference(s); 8 fact(s) identical. Absent means the log did not print it, not that it was off.
120
+ 15 difference(s); 9 fact(s) identical. Absent means the log did not print it, not that it was off.
88
121
  ```
89
122
 
90
123
  0.28.0 does not start on WSL2 with default settings; 0.30.0 does, because it falls
@@ -94,14 +127,22 @@ v0.30.0. Forcing the V1 model runner on 0.28.0 (`VLLM_USE_V2_MODEL_RUNNER=0`) ma
94
127
  start, and the remaining server-side differences are:
95
128
 
96
129
  ```text
130
+ note: baseline: no all-reduce facts: world_size=1, so there is no all-reduce group and no backend is chosen; a TP>1 run is what makes this path observable
131
+ note: candidate: no all-reduce facts: world_size=1, so there is no all-reduce group and no backend is chosen; a TP>1 run is what makes this path observable
132
+
97
133
  fact baseline candidate status
98
- cuda_graph.captures ["mixed prefill-decode, PIECEWISE x51", ["PIECEWISE x51", "FULL x2", "FULL x35"] changed
134
+ compile.artifacts 25 entries, 3 artifacts, 4997798 bytes 25 entries, 3 artifacts, 4996920 bytes changed
135
+ compile.total_s 32.58 31.08 changed
136
+ cuda_graph.captures ["mixed prefill-decode, PIECEWISE x51... ["PIECEWISE x51", "FULL x2", "FULL x35"] changed
99
137
  cuda_graph.pool_gib 0.36 0.17 changed
100
138
  engine.version 0.28.0 0.30.0 changed
101
- model_runner <absent> V2 only_candidate
139
+ kv_cache.layout <absent> LBNHC only_candidate
140
+ model_loading.seconds 13.191946 19.122619 changed
141
+ model_runner V1 V2 changed
142
+ parallel.roles DP rank 0, PP rank 0, PCP rank 0, TP ... DP rank 0, PP rank 0, PCP rank 0, TP ... changed
102
143
  uva_buffers <absent> fallback: device memory only_candidate
103
144
 
104
- 5 difference(s); 11 fact(s) identical. Absent means the log did not print it, not that it was off.
145
+ 10 difference(s); 13 fact(s) identical. Absent means the log did not print it, not that it was off.
105
146
  ```
106
147
 
107
148
  ## Validated against real TP>1 logs
@@ -28,13 +28,37 @@ git clone https://github.com/apex-mochen/servediff && cd servediff
28
28
  servediff diff examples/issue-excerpts/vllm-47047-v0.23-default.log examples/issue-excerpts/vllm-47047-v0.23-marlin.log
29
29
  ```
30
30
 
31
+ Install from PyPI. A different, unrelated tool also uses the name `servediff` in a
32
+ third-party Homebrew tap; the `pip install servediff` package is this one.
33
+
31
34
  ```text
35
+ note: baseline: no all-reduce facts and no rank line: cannot tell whether this run had more than one rank, so an absent all-reduce path here is inconclusive
36
+ note: candidate: no all-reduce facts and no rank line: cannot tell whether this run had more than one rank, so an absent all-reduce path here is inconclusive
37
+
32
38
  fact baseline candidate status
33
39
  backend.moe VLLM_CUTLASS (NvFp4) MARLIN (NvFp4) changed
34
40
 
35
41
  1 difference(s); 0 fact(s) identical. Absent means the log did not print it, not that it was off.
36
42
  ```
37
43
 
44
+ The two `note:` lines are part of the answer, not noise: the excerpt posted in that
45
+ issue carries no rank line, so this run cannot say whether it was multi-GPU at all,
46
+ and the tool says so instead of leaving you to read silence as "unchanged".
47
+
48
+ ## Commands and exit codes
49
+
50
+ | Command | What it reads | Exit codes |
51
+ |---|---|---|
52
+ | `servediff show <log>` | one startup log (or `-` for stdin) → the facts it printed, each with its line number; `--json` | `0` read something; `2` unreadable path or no line recognised |
53
+ | `servediff diff <a> <b>` | two startup logs, or two `servediff env` snapshots; `--json`, `--markdown`, `--all`, `--raw-args` | `0` identical; `1` at least one difference; `2` usage error, unreadable path, or one log mixed with one snapshot |
54
+ | `servediff series <a> <b> <c> ...` | three or more startup logs, in the column order you give → one fact per row; `--json`, `--markdown`, `--all`, `--raw-args` | `0` same across every log; `1` at least one fact differs; `2` fewer than three inputs |
55
+ | `servediff env [--python P] [-o snap.json]` | that interpreter's packages, GPU info, and env vars whose names start with `VLLM_` / `SGLANG_` / `SGL_` / `CUDA_` / `NCCL_` / `TORCH_` / `PYTORCH_` / `FLASHINFER_` / `TRITON_` or are `HF_HUB_OFFLINE` / `TRANSFORMERS_OFFLINE`; secret-looking names become `<redacted>` | `0` written; `2` snapshot failed |
56
+ | `servediff capture [-o run.log] -- <server command>` | runs the server, tees its log, and writes `<out>.env.json` **before** launch | the server's own exit code |
57
+
58
+ `1` always means *the inputs differ* — never *something went wrong* — so
59
+ `servediff diff old.log new.log` works directly as a CI gate. At most one input may be
60
+ `-`, because stdin can only be read once.
61
+
38
62
  That is the difference the reporter of
39
63
  [vllm#47047](https://github.com/vllm-project/vllm/issues/47047) found by hand after a
40
64
  v0.21 → v0.23 throughput drop. The example files are the log lines posted in that
@@ -52,18 +76,27 @@ servediff diff vllm-0.28.0.log vllm-0.30.0.log
52
76
  ```text
53
77
  warning: baseline server failed to start: RuntimeError: UVA is not available; facts after the failure are absent because startup stopped, not because they were off
54
78
 
79
+ note: baseline: no all-reduce facts: world_size=1, so there is no all-reduce group and no backend is chosen; a TP>1 run is what makes this path observable
80
+ note: candidate: no all-reduce facts: world_size=1, so there is no all-reduce group and no backend is chosen; a TP>1 run is what makes this path observable
81
+
55
82
  fact baseline candidate status
56
83
  backend.attention <absent> FLASH_ATTN only_candidate
57
84
  backend.flash_attn_version <absent> 2 only_candidate
58
85
  backend.sampling_flashinfer <absent> disabled only_candidate
86
+ compile.artifacts <absent> 25 entries, 3 artifacts, 4996920 bytes only_candidate
87
+ compile.total_s <absent> 31.08 only_candidate
59
88
  cuda_graph.captures <absent> ["PIECEWISE x51", "FULL x2", "FULL x35"] only_candidate
60
89
  cuda_graph.pool_gib <absent> 0.17 only_candidate
61
90
  engine.version 0.28.0 0.30.0 changed
91
+ kv_cache.layout <absent> LBNHC only_candidate
92
+ model_loading.gib <absent> 0.93 only_candidate
93
+ model_loading.seconds <absent> 19.122619 only_candidate
94
+ parallel.roles DP rank 0, PP rank 0, PCP rank 0, TP ... DP rank 0, PP rank 0, PCP rank 0, TP ... changed
62
95
  startup failed ready changed
63
- startup.error ["RuntimeError: UVA is not available", " <absent> only_baseline
96
+ startup.error ["RuntimeError: UVA is not available"... <absent> only_baseline
64
97
  uva_buffers <absent> fallback: device memory only_candidate
65
98
 
66
- 9 difference(s); 8 fact(s) identical. Absent means the log did not print it, not that it was off.
99
+ 15 difference(s); 9 fact(s) identical. Absent means the log did not print it, not that it was off.
67
100
  ```
68
101
 
69
102
  0.28.0 does not start on WSL2 with default settings; 0.30.0 does, because it falls
@@ -73,14 +106,22 @@ v0.30.0. Forcing the V1 model runner on 0.28.0 (`VLLM_USE_V2_MODEL_RUNNER=0`) ma
73
106
  start, and the remaining server-side differences are:
74
107
 
75
108
  ```text
109
+ note: baseline: no all-reduce facts: world_size=1, so there is no all-reduce group and no backend is chosen; a TP>1 run is what makes this path observable
110
+ note: candidate: no all-reduce facts: world_size=1, so there is no all-reduce group and no backend is chosen; a TP>1 run is what makes this path observable
111
+
76
112
  fact baseline candidate status
77
- cuda_graph.captures ["mixed prefill-decode, PIECEWISE x51", ["PIECEWISE x51", "FULL x2", "FULL x35"] changed
113
+ compile.artifacts 25 entries, 3 artifacts, 4997798 bytes 25 entries, 3 artifacts, 4996920 bytes changed
114
+ compile.total_s 32.58 31.08 changed
115
+ cuda_graph.captures ["mixed prefill-decode, PIECEWISE x51... ["PIECEWISE x51", "FULL x2", "FULL x35"] changed
78
116
  cuda_graph.pool_gib 0.36 0.17 changed
79
117
  engine.version 0.28.0 0.30.0 changed
80
- model_runner <absent> V2 only_candidate
118
+ kv_cache.layout <absent> LBNHC only_candidate
119
+ model_loading.seconds 13.191946 19.122619 changed
120
+ model_runner V1 V2 changed
121
+ parallel.roles DP rank 0, PP rank 0, PCP rank 0, TP ... DP rank 0, PP rank 0, PCP rank 0, TP ... changed
81
122
  uva_buffers <absent> fallback: device memory only_candidate
82
123
 
83
- 5 difference(s); 11 fact(s) identical. Absent means the log did not print it, not that it was off.
124
+ 10 difference(s); 13 fact(s) identical. Absent means the log did not print it, not that it was off.
84
125
  ```
85
126
 
86
127
  ## Validated against real TP>1 logs
@@ -16,7 +16,23 @@ pip install .
16
16
  servediff diff examples/issue-excerpts/vllm-47047-v0.23-default.log examples/issue-excerpts/vllm-47047-v0.23-marlin.log
17
17
  ```
18
18
 
19
- 输出只有一行差异:MoE backend 从 `VLLM_CUTLASS (NvFp4)` 变为 `MARLIN (NvFp4)`。这正是 [vllm#47047](https://github.com/vllm-project/vllm/issues/47047) 的报告者在 v0.21 → v0.23 吞吐下降后,靠人工找出来的差异。
19
+ 输出是一条差异:MoE backend 从 `VLLM_CUTLASS (NvFp4)` 变为 `MARLIN (NvFp4)`。这正是 [vllm#47047](https://github.com/vllm-project/vllm/issues/47047) 的报告者在 v0.21 → v0.23 吞吐下降后,靠人工找出来的差异。
20
+
21
+ 前面还会打印两行 `note:`:这份摘录里没有 rank 行,工具无法判断它是不是多卡运行,所以它直接说明「此处无法判定」,而不是让你把沉默读成「没变」。这是输出的一部分,不是噪声。
22
+
23
+ 从 PyPI 安装(`pip install servediff`)。另有一个同名但无关的工具放在第三方 Homebrew tap 里,`pip` 装到的这个才是本项目。
24
+
25
+ ## 子命令与退出码
26
+
27
+ | 子命令 | 读什么 | 退出码 |
28
+ |---|---|---|
29
+ | `servediff show <log>` | 一份启动日志(`-` 表示读 stdin),输出它打印出来的每条 fact 及其行号;`--json` | `0` 读到了;`2` 路径读不了,或一行都认不出来 |
30
+ | `servediff diff <a> <b>` | 两份启动日志,或两份 `servediff env` 快照;`--json` / `--markdown` / `--all` / `--raw-args` | `0` 一致;`1` 至少有一处不同;`2` 用法错误、路径读不了,或一份日志配一份快照 |
31
+ | `servediff series <a> <b> <c> ...` | 三份及以上日志,按你给的顺序排列成列,每条 fact 一行;`--json` / `--markdown` / `--all` / `--raw-args` | `0` 各份全同;`1` 有 fact 不同;`2` 少于三份 |
32
+ | `servediff env [--python P] [-o snap.json]` | 该解释器的包、GPU 信息,以及名字以 `VLLM_` / `SGLANG_` / `SGL_` / `CUDA_` / `NCCL_` / `TORCH_` / `PYTORCH_` / `FLASHINFER_` / `TRITON_` 开头的环境变量和 `HF_HUB_OFFLINE` / `TRANSFORMERS_OFFLINE`;看起来像密钥的名字一律写成 `<redacted>` | `0` 已写出;`2` 快照失败 |
33
+ | `servediff capture [-o run.log] -- <启动命令>` | 跑起 server、把日志同时写文件,并在启动**之前**写出 `<out>.env.json` | server 自己的退出码 |
34
+
35
+ `1` 只表示「输入不同」,不表示「出错」,所以 `servediff diff old.log new.log` 可以直接当 CI 门禁。`-` 至多出现一次:stdin 只能读一遍。
20
36
 
21
37
  ## 真实案例:参数相同,vLLM 0.28.0 对 0.30.0
22
38
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "servediff"
7
- version = "0.4.0"
7
+ version = "0.4.2"
8
8
  description = "Diff what your vLLM / SGLang server actually ran with: auto-selected backends, CUDA graphs, startup failures, dependency versions."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -471,6 +471,10 @@ def _label(path) -> str:
471
471
  return "stdin" if str(path) == "-" else str(path)
472
472
 
473
473
 
474
+ class InputError(Exception):
475
+ """An input path could not be read. Callers map it to exit 2, never to 1."""
476
+
477
+
474
478
  def _read_log(path) -> str:
475
479
  """Read a log path, or stdin when the path is `-`.
476
480
 
@@ -479,7 +483,13 @@ def _read_log(path) -> str:
479
483
  """
480
484
  if str(path) == "-":
481
485
  return sys.stdin.buffer.read().decode("utf-8", errors="replace")
482
- return path.read_text(encoding="utf-8", errors="replace")
486
+ try:
487
+ return path.read_text(encoding="utf-8", errors="replace")
488
+ except OSError as exc:
489
+ # Exit 1 means "the two sides differ" to every caller and CI script, so an
490
+ # unreadable path must not borrow it: raise a traceback here and a typo looks
491
+ # like a regression.
492
+ raise InputError(f"{path}: {exc.strerror or exc}") from exc
483
493
 
484
494
 
485
495
  def main(argv=None) -> int:
@@ -569,7 +579,11 @@ def main(argv=None) -> int:
569
579
  if sum(1 for path in args.logs if str(path) == "-") > 1:
570
580
  print("series: stdin can be read once, so at most one entry may be '-'", file=sys.stderr)
571
581
  return 2
572
- parsed_list = [parse(_read_log(path)) for path in args.logs]
582
+ try:
583
+ parsed_list = [parse(_read_log(path)) for path in args.logs]
584
+ except InputError as exc:
585
+ print(f"series: {exc}", file=sys.stderr)
586
+ return 2
573
587
  for path, parsed in zip(args.logs, parsed_list):
574
588
  if not parsed["facts"]:
575
589
  print(f"{_label(path)}: no vLLM or SGLang configuration lines recognised", file=sys.stderr)
@@ -592,7 +606,11 @@ def main(argv=None) -> int:
592
606
  return 1 if differing else 0
593
607
 
594
608
  if args.command == "show":
595
- parsed = parse(_read_log(args.log))
609
+ try:
610
+ parsed = parse(_read_log(args.log))
611
+ except InputError as exc:
612
+ print(f"show: {exc}", file=sys.stderr)
613
+ return 2
596
614
  if not parsed["facts"]:
597
615
  print(f"{_label(args.log)}: no vLLM or SGLang configuration lines recognised", file=sys.stderr)
598
616
  return 2
@@ -608,8 +626,12 @@ def main(argv=None) -> int:
608
626
  if str(args.baseline) == "-" and str(args.candidate) == "-":
609
627
  print("diff: stdin can be read once, so only one side may be '-'", file=sys.stderr)
610
628
  return 2
611
- text_a = _read_log(args.baseline)
612
- text_b = _read_log(args.candidate)
629
+ try:
630
+ text_a = _read_log(args.baseline)
631
+ text_b = _read_log(args.candidate)
632
+ except InputError as exc:
633
+ print(f"diff: {exc}", file=sys.stderr)
634
+ return 2
613
635
  snaps = envsnap.is_snapshot(text_a), envsnap.is_snapshot(text_b)
614
636
  if any(snaps):
615
637
  if not all(snaps):
@@ -631,7 +653,8 @@ def main(argv=None) -> int:
631
653
  shown = rows if args.all else key
632
654
  print(f"{'fact':32s} {'baseline':40s} {'candidate':40s} status")
633
655
  for r in shown:
634
- print(f"{r['key']:32s} {_fmt(r['baseline'])[:40]:40s} {_fmt(r['candidate'])[:40]:40s} {r['status']}")
656
+ print(f"{r['key']:32s} {_short(_fmt(r['baseline']), 40):40s}"
657
+ f" {_short(_fmt(r['candidate']), 40):40s} {r['status']}")
635
658
  print(f"\n{len(key)} difference(s) in Python, GPU, inference packages and engine env vars;"
636
659
  f" {len(rows) - len(key)} in other packages{'' if args.all else ' (--all to list them)'}.")
637
660
  return 1 if rows else 0
@@ -684,7 +707,10 @@ def main(argv=None) -> int:
684
707
  print()
685
708
  print(f"{'fact':32s} {'baseline':40s} {'candidate':40s} status")
686
709
  for r in rows if args.all else differing:
687
- print(f"{r['key']:32s} {_fmt(r['baseline'])[:40]:40s} {_fmt(r['candidate'])[:40]:40s} {r['status']}")
710
+ # Mark truncation instead of cutting a value mid-word: a cell that ends
711
+ # in `TP ran` reads like the value itself, not like a clipped column.
712
+ print(f"{r['key']:32s} {_short(_fmt(r['baseline']), 40):40s}"
713
+ f" {_short(_fmt(r['candidate']), 40):40s} {r['status']}")
688
714
  print(f"\n{len(differing)} difference(s); {len(rows) - len(differing)} fact(s) identical."
689
715
  " Absent means the log did not print it, not that it was off.")
690
716
  return 1 if differing else 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: servediff
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: Diff what your vLLM / SGLang server actually ran with: auto-selected backends, CUDA graphs, startup failures, dependency versions.
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Homepage, https://github.com/apex-mochen/servediff
@@ -49,13 +49,37 @@ git clone https://github.com/apex-mochen/servediff && cd servediff
49
49
  servediff diff examples/issue-excerpts/vllm-47047-v0.23-default.log examples/issue-excerpts/vllm-47047-v0.23-marlin.log
50
50
  ```
51
51
 
52
+ Install from PyPI. A different, unrelated tool also uses the name `servediff` in a
53
+ third-party Homebrew tap; the `pip install servediff` package is this one.
54
+
52
55
  ```text
56
+ note: baseline: no all-reduce facts and no rank line: cannot tell whether this run had more than one rank, so an absent all-reduce path here is inconclusive
57
+ note: candidate: no all-reduce facts and no rank line: cannot tell whether this run had more than one rank, so an absent all-reduce path here is inconclusive
58
+
53
59
  fact baseline candidate status
54
60
  backend.moe VLLM_CUTLASS (NvFp4) MARLIN (NvFp4) changed
55
61
 
56
62
  1 difference(s); 0 fact(s) identical. Absent means the log did not print it, not that it was off.
57
63
  ```
58
64
 
65
+ The two `note:` lines are part of the answer, not noise: the excerpt posted in that
66
+ issue carries no rank line, so this run cannot say whether it was multi-GPU at all,
67
+ and the tool says so instead of leaving you to read silence as "unchanged".
68
+
69
+ ## Commands and exit codes
70
+
71
+ | Command | What it reads | Exit codes |
72
+ |---|---|---|
73
+ | `servediff show <log>` | one startup log (or `-` for stdin) → the facts it printed, each with its line number; `--json` | `0` read something; `2` unreadable path or no line recognised |
74
+ | `servediff diff <a> <b>` | two startup logs, or two `servediff env` snapshots; `--json`, `--markdown`, `--all`, `--raw-args` | `0` identical; `1` at least one difference; `2` usage error, unreadable path, or one log mixed with one snapshot |
75
+ | `servediff series <a> <b> <c> ...` | three or more startup logs, in the column order you give → one fact per row; `--json`, `--markdown`, `--all`, `--raw-args` | `0` same across every log; `1` at least one fact differs; `2` fewer than three inputs |
76
+ | `servediff env [--python P] [-o snap.json]` | that interpreter's packages, GPU info, and env vars whose names start with `VLLM_` / `SGLANG_` / `SGL_` / `CUDA_` / `NCCL_` / `TORCH_` / `PYTORCH_` / `FLASHINFER_` / `TRITON_` or are `HF_HUB_OFFLINE` / `TRANSFORMERS_OFFLINE`; secret-looking names become `<redacted>` | `0` written; `2` snapshot failed |
77
+ | `servediff capture [-o run.log] -- <server command>` | runs the server, tees its log, and writes `<out>.env.json` **before** launch | the server's own exit code |
78
+
79
+ `1` always means *the inputs differ* — never *something went wrong* — so
80
+ `servediff diff old.log new.log` works directly as a CI gate. At most one input may be
81
+ `-`, because stdin can only be read once.
82
+
59
83
  That is the difference the reporter of
60
84
  [vllm#47047](https://github.com/vllm-project/vllm/issues/47047) found by hand after a
61
85
  v0.21 → v0.23 throughput drop. The example files are the log lines posted in that
@@ -73,18 +97,27 @@ servediff diff vllm-0.28.0.log vllm-0.30.0.log
73
97
  ```text
74
98
  warning: baseline server failed to start: RuntimeError: UVA is not available; facts after the failure are absent because startup stopped, not because they were off
75
99
 
100
+ note: baseline: no all-reduce facts: world_size=1, so there is no all-reduce group and no backend is chosen; a TP>1 run is what makes this path observable
101
+ note: candidate: no all-reduce facts: world_size=1, so there is no all-reduce group and no backend is chosen; a TP>1 run is what makes this path observable
102
+
76
103
  fact baseline candidate status
77
104
  backend.attention <absent> FLASH_ATTN only_candidate
78
105
  backend.flash_attn_version <absent> 2 only_candidate
79
106
  backend.sampling_flashinfer <absent> disabled only_candidate
107
+ compile.artifacts <absent> 25 entries, 3 artifacts, 4996920 bytes only_candidate
108
+ compile.total_s <absent> 31.08 only_candidate
80
109
  cuda_graph.captures <absent> ["PIECEWISE x51", "FULL x2", "FULL x35"] only_candidate
81
110
  cuda_graph.pool_gib <absent> 0.17 only_candidate
82
111
  engine.version 0.28.0 0.30.0 changed
112
+ kv_cache.layout <absent> LBNHC only_candidate
113
+ model_loading.gib <absent> 0.93 only_candidate
114
+ model_loading.seconds <absent> 19.122619 only_candidate
115
+ parallel.roles DP rank 0, PP rank 0, PCP rank 0, TP ... DP rank 0, PP rank 0, PCP rank 0, TP ... changed
83
116
  startup failed ready changed
84
- startup.error ["RuntimeError: UVA is not available", " <absent> only_baseline
117
+ startup.error ["RuntimeError: UVA is not available"... <absent> only_baseline
85
118
  uva_buffers <absent> fallback: device memory only_candidate
86
119
 
87
- 9 difference(s); 8 fact(s) identical. Absent means the log did not print it, not that it was off.
120
+ 15 difference(s); 9 fact(s) identical. Absent means the log did not print it, not that it was off.
88
121
  ```
89
122
 
90
123
  0.28.0 does not start on WSL2 with default settings; 0.30.0 does, because it falls
@@ -94,14 +127,22 @@ v0.30.0. Forcing the V1 model runner on 0.28.0 (`VLLM_USE_V2_MODEL_RUNNER=0`) ma
94
127
  start, and the remaining server-side differences are:
95
128
 
96
129
  ```text
130
+ note: baseline: no all-reduce facts: world_size=1, so there is no all-reduce group and no backend is chosen; a TP>1 run is what makes this path observable
131
+ note: candidate: no all-reduce facts: world_size=1, so there is no all-reduce group and no backend is chosen; a TP>1 run is what makes this path observable
132
+
97
133
  fact baseline candidate status
98
- cuda_graph.captures ["mixed prefill-decode, PIECEWISE x51", ["PIECEWISE x51", "FULL x2", "FULL x35"] changed
134
+ compile.artifacts 25 entries, 3 artifacts, 4997798 bytes 25 entries, 3 artifacts, 4996920 bytes changed
135
+ compile.total_s 32.58 31.08 changed
136
+ cuda_graph.captures ["mixed prefill-decode, PIECEWISE x51... ["PIECEWISE x51", "FULL x2", "FULL x35"] changed
99
137
  cuda_graph.pool_gib 0.36 0.17 changed
100
138
  engine.version 0.28.0 0.30.0 changed
101
- model_runner <absent> V2 only_candidate
139
+ kv_cache.layout <absent> LBNHC only_candidate
140
+ model_loading.seconds 13.191946 19.122619 changed
141
+ model_runner V1 V2 changed
142
+ parallel.roles DP rank 0, PP rank 0, PCP rank 0, TP ... DP rank 0, PP rank 0, PCP rank 0, TP ... changed
102
143
  uva_buffers <absent> fallback: device memory only_candidate
103
144
 
104
- 5 difference(s); 11 fact(s) identical. Absent means the log did not print it, not that it was off.
145
+ 10 difference(s); 13 fact(s) identical. Absent means the log did not print it, not that it was off.
105
146
  ```
106
147
 
107
148
  ## Validated against real TP>1 logs
@@ -158,6 +158,15 @@ def test_unrecognised_log_exits_2(tmp_path):
158
158
  assert servediff.main(["show", str(log)]) == 2
159
159
 
160
160
 
161
+ def test_unreadable_path_is_exit_2_not_a_difference(tmp_path, capsys):
162
+ """A typo'd path must not borrow exit 1, which means "the two sides differ"."""
163
+ missing = str(tmp_path / "not-there.log")
164
+ assert servediff.main(["show", missing]) == 2
165
+ assert servediff.main(["diff", missing, str(tmp_path / "also-missing.log")]) == 2
166
+ err = capsys.readouterr().err
167
+ assert "not-there.log" in err
168
+
169
+
161
170
  def test_diff_exit_codes(tmp_path):
162
171
  a, b = tmp_path / "a.log", tmp_path / "b.log"
163
172
  a.write_text(VLLM)
File without changes
File without changes
File without changes
File without changes
File without changes