mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-15 12:53:31 +08:00
Desktop startup can fail before React mounts on older WebViews, so an HTML-level watchdog now renders startup diagnostics even when the module bundle never reaches the app code. Persistent provider migration now imports legacy root provider config into cc-haha-owned storage without deleting the old source file, and plugin marketplace cleanup refuses obvious corrupted cache roots or outside paths. Constraint: User explicitly accepted the current reviewed state for landing despite remaining review concerns. Constraint: Global ~/.claude state is user-owned and protected; automatic repair must avoid deleting shared config, transcripts, skills, MCP, plugins, OAuth, adapters, and teams. Rejected: Tell users to delete ~/.claude or ~/.claude/cc-haha | unsafe because it can destroy user-owned Claude state and still may not fix WebView compatibility failures. Confidence: medium Scope-risk: moderate Directive: Do not weaken protected-path checks; future deletion paths should validate real paths and symlink behavior before recursive rm. Tested: bun test src/utils/plugins/installedPluginsManager.test.ts src/utils/plugins/marketplaceManager.test.ts Tested: bun run check:server Tested: cd desktop && bun run test -- --run src/main.test.tsx index-html.test.ts vite-config.test.ts src/theme/globals.test.ts Tested: cd desktop && bun run build Tested: bun run check:coverage Not-tested: live macOS 12/Safari 15 WKWebView startup on an affected machine. Not-tested: H5 diagnostic URL redaction and symlink-escape hardening are known follow-up risks from review.
23 lines
897 B
TypeScript
23 lines
897 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { readFileSync } from 'node:fs'
|
|
import { join } from 'node:path'
|
|
|
|
const html = readFileSync(join(__dirname, 'index.html'), 'utf-8')
|
|
|
|
describe('desktop index startup diagnostics', () => {
|
|
it('installs a non-module startup watchdog before the app module loads', () => {
|
|
const watchdogIndex = html.indexOf('__CC_HAHA_SHOW_STARTUP_ERROR__')
|
|
const moduleIndex = html.indexOf('type="module"')
|
|
|
|
expect(watchdogIndex).toBeGreaterThan(0)
|
|
expect(moduleIndex).toBeGreaterThan(watchdogIndex)
|
|
expect(html).toContain('__CC_HAHA_BOOTSTRAPPED__')
|
|
expect(html).toContain('Desktop startup failed')
|
|
})
|
|
|
|
it('diagnoses module resource failures and boot timeouts outside React', () => {
|
|
expect(html).toContain('Startup resource failed to load:')
|
|
expect(html).toContain('Desktop app did not finish bootstrapping within')
|
|
})
|
|
})
|