mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-19 13:33:35 +08:00
The diagnostics panel filled with red ERROR/WARN entries during normal use because the capture layer treated "wrote to console" as "something failed", with no severity gatekeeping. Much of the noise was also test runs leaking into the user's real ~/.claude/cc-haha/diagnostics. - diagnosticsService: default unclassified events to info (not error); drop writes under NODE_ENV=test when no CLAUDE_CONFIG_DIR is set; document the console-capture contract (expected states use console.debug/info). - index: don't install console/process capture under bun test. - api/diagnostics: an ingested event with missing severity defaults to info. - oauthRefreshLog (new): token refresh failure is gracefully handled and is never an error — expected expiry (401/403/revoked) logs at debug, anything else at warn. Wired into both Haha OAuth services. - conversationService: classify cli_runtime_exit severity by exit code, so clean/SIGTERM/SIGKILL exits are info and only abnormal codes stay error (real "chat died" crashes remain perceivable). - ws/handler: streaming partial tool-input JSON is normal — debug, not warn. Tests: oauth-refresh-log + cli-exit-severity unit tests; diagnostics-service covers the info default and the test-isolation guard. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
22 lines
660 B
TypeScript
22 lines
660 B
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
import { cliExitSeverity } from '../services/conversationService.js'
|
|
|
|
describe('cliExitSeverity', () => {
|
|
test.each([
|
|
[0, 'info'],
|
|
[null, 'info'],
|
|
[143, 'info'], // SIGTERM — shutdown / user stop
|
|
[137, 'info'], // SIGKILL — OS reclaim
|
|
] as const)('benign exit code %p → %s', (code, expected) => {
|
|
expect(cliExitSeverity(code)).toBe(expected)
|
|
})
|
|
|
|
test.each([
|
|
[1, 'error'],
|
|
[2, 'error'],
|
|
[127, 'error'],
|
|
] as const)('abnormal exit code %p → error (real crash, must be perceivable)', (code, expected) => {
|
|
expect(cliExitSeverity(code)).toBe(expected)
|
|
})
|
|
})
|