Skip to content

Commit a167341

Browse files
committed
chore: windows CI matrix, dependabot, eslint, coverage, random test ports, HERMES refresh
- CI: matrix [ubuntu, windows] — windows is this project's primary deployment shape (start.cmd / scheduled task / pkg exe / registry toasts), so platform regressions must be caught on it; coverage step runs once on ubuntu - .github/dependabot.yml: weekly npm + github-actions updates (dev deps grouped) - ESLint (flat config) + 'npm run lint' in CI: catch real issues (unused vars, useless escapes/assignments, missing error cause); style-only rules kept off; all 24 findings fixed — several were genuine dead code (server-side esc(), hasModelsChanged, TOAST_ENABLED_REG, empty UpstreamModel interface) - Integration tests use random free ports instead of fixed 9091/9911, so parallel runs or occupied ports no longer cause false failures - 'npm run test:coverage' + CI coverage summary (v8 provider; child-process integration traffic is not counted, so numbers are a conservative trend) - HERMES_TEST_PROMPT.md: add count_tokens endpoint + stream_options.include_usage scenario (T2), new T13 for documented-unsupported fields, fix the stale T10 expectation (unknown models pass through since 4.9, no silent substitution) and the HTML-stripped <think> reference
1 parent 77fb652 commit a167341

19 files changed

Lines changed: 1853 additions & 64 deletions

‎.github/dependabot.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
groups:
8+
dev-deps:
9+
dependency-type: development
10+
- package-ecosystem: github-actions
11+
directory: /
12+
schedule:
13+
interval: weekly

‎.github/workflows/ci.yml‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ on:
77

88
jobs:
99
test:
10-
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
# ubuntu 是基线;windows 是本项目的主要部署形态(start.cmd / 计划任务 /
14+
# pkg exe / 注册表通知),必须同缸回归路径分隔符与 spawn 行为差异
15+
os: [ubuntu-latest, windows-latest]
16+
runs-on: ${{ matrix.os }}
1117
steps:
1218
- uses: actions/checkout@v4
1319

@@ -19,6 +25,9 @@ jobs:
1925
- name: Install dependencies
2026
run: npm ci
2127

28+
- name: Lint
29+
run: npm run lint
30+
2231
- name: Typecheck
2332
run: npm run typecheck
2433

@@ -28,3 +37,8 @@ jobs:
2837

2938
- name: Test
3039
run: npx vitest run
40+
41+
# 覆盖率只在基线系统跑一份,避免矩阵重复
42+
- name: Coverage
43+
if: matrix.os == 'ubuntu-latest'
44+
run: npx vitest run --coverage --coverage.reporter=text-summary

‎HERMES_TEST_PROMPT.md‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ as a client. Everything you need is at `http://127.0.0.1:9090`.
3131

3232
- `POST /v1/chat/completions` — main target
3333
- `POST /v1/messages` — Anthropic-style (secondary; test if time permits)
34+
- `POST /v1/messages/count_tokens` — local token estimate (CJK-aware; never calls upstream, safe to call anytime)
3435
- `GET /v1/models` — list available model ids first; pick 2-3 for your tests (one claude, one gpt, one other)
3536
- `GET /health` — confirm proxy is up before starting
3637

@@ -51,7 +52,8 @@ Verify against OpenAI spec:
5152
- Last data chunk: `delta: {}` with `finish_reason: "stop"`
5253
- Very last line: `data: [DONE]`
5354
- All chunks share the same `id`/`created`/`model`
54-
Report: chunk count, any chunk missing fields, any ` thinking` text leaking into `content`.
55+
Report: chunk count, any chunk missing fields, any raw `<think>` tag text leaking into `content`.
56+
Extra: repeat with `stream_options: {include_usage: true}` — the final chunk should carry a `usage` object. Without that flag, no chunk should contain a `usage` field.
5557

5658
### T3 — Reasoning / thinking visibility
5759
Send with `reasoning_effort: "high"` (and separately omit it).
@@ -103,8 +105,10 @@ Verify: no 400/500 error, model responds about the image (even vaguely). Report
103105
### T10 — Model resolution
104106
Request a model with a vendor prefix (e.g. `"openai/gpt-5.6-sol"` if `gpt-5.6-sol` exists) and
105107
an unknown model (`"definitely-not-a-real-model"`).
106-
Verify: prefix version works (proxy strips/aliases); unknown falls back to a valid model rather
107-
than erroring — and the RESPONSE `model` field tells you which was actually used.
108+
Verify: prefix version works (proxy strips/aliases), and the RESPONSE `model` field tells you which
109+
was actually used. An unknown model id is passed through **as-is** to upstream (since 4.9 — the proxy
110+
must NOT silently substitute a default model), so expect a structured upstream error with a stable
111+
`code` (e.g. `MODEL_NOT_FOUND`) rather than a fabricated response.
108112

109113
### T11 — Edge inputs
110114
- Very long message (~20k chars): should not error.
@@ -119,6 +123,11 @@ than erroring — and the RESPONSE `model` field tells you which was actually us
119123
- If any upstream error surfaces mid-stream, verify it arrives as a content chunk containing
120124
`[Upstream Error: ...]` followed by a proper finish + [DONE] (stream must always terminate cleanly).
121125

126+
### T13 — Unsupported fields are accepted silently
127+
Send a request containing `stop: ["x"]`, `response_format: {type: "json_object"}`, `top_k`, and `logprobs`.
128+
Verify: no 4xx/5xx and a normal response comes back. These fields are **accepted but ignored** by design
129+
(documented in README) — report only if the proxy errors or the response envelope is malformed.
130+
122131
---
123132

124133
## Report format (final deliverable)

‎eslint.config.js‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// ESLint flat config。目标:拦真问题(未用变量、未定义引用、误用),不搞风格洁癖
2+
// —— 格式交给编辑器/个人习惯,避免无意义的全量 churn。
3+
import js from '@eslint/js';
4+
import tseslint from 'typescript-eslint';
5+
6+
export default tseslint.config(
7+
{
8+
// 构建产物、前端 SPA(经 tests/dashboard-spa.test.ts 单独守卫)、依赖
9+
ignores: ['dist/**', 'node_modules/**', 'public/**', '*.mjs'],
10+
},
11+
js.configs.recommended,
12+
...tseslint.configs.recommended,
13+
{
14+
rules: {
15+
// 本项目大量使用 any 承接上游无契约的 wire 事件 —— 有意为之
16+
'@typescript-eslint/no-explicit-any': 'off',
17+
// 以 _ 开头的参数/变量视为有意忽略
18+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
19+
// 防御式编程里 "catch {}" 是常态
20+
'no-empty': ['error', { allowEmptyCatch: true }],
21+
},
22+
},
23+
);

0 commit comments

Comments
 (0)