fix: apply pending correctness fixes

Cherry-pick the still-relevant fixes from recent draft PRs without pulling in stale release/docs changes:

- serialize dashboard data loads to avoid concurrent config self-heal writes
- preserve valid per-model default blocks during dashboard model self-heal
- pass structured humanizeError results directly to toast for model import scan failures
- align frontend kernel isLatest with suffix-aware recommended version ordering

Verification:
- node --test tests/*.test.js
- npm run build
This commit is contained in:
晴天
2026-05-21 19:06:38 +08:00
parent dbdf239430
commit 9d2dc8438e
5 changed files with 86 additions and 16 deletions

View File

@@ -0,0 +1,17 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { humanizeError, humanizeErrorText } from '../src/lib/humanize-error.js'
test('humanizeError must not be coerced with String() or template literals', () => {
const h = humanizeError(new Error('ECONNREFUSED 127.0.0.1:443'), 'Import scan failed')
assert.equal(typeof h, 'object')
assert.equal(String(h), '[object Object]')
assert.ok(h.message)
})
test('humanizeErrorText is safe for plain-string contexts', () => {
const line = humanizeErrorText(new Error('ENOENT no such file'), 'Import scan failed')
assert.match(line, /Import scan failed/)
assert.doesNotMatch(line, /\[object Object\]/)
})