Files
OpenCode 68a9071cf1 feat: reconcile local master with origin (exa/hot-platform hunters, leaks ledger, latest results)
Local branch had diverged from origin/master (sibling commits on the same base). Rewrote local history linearly on top of origin/master, folding in all local content: exa/hot-platform discovery hunters, leaks ledger, nightly sweep orchestrator, updated .gitignore and skill docs, plus the latest hunt output and vault state. Remote-only files (vault keys, channel scripts) were restored rather than dropped, so the resulting tree is a full union of both sides.
2026-08-07 12:53:47 +08:00

1 line
3.8 KiB
JSON

{"repo": "aqlong/code2wiki", "files": {"src/core/llm/client.deepseek-live.test.ts": {"0b0f1d05ed53c5e2811b74042f8190a1e82e8614": {"t": 1786068276.4033892, "n": 3488, "h": "1ad08dc4fa0cf1b0", "c": "import { afterEach, beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { extractWithLLM, countTokens } from \"./client.js\";\nimport type { Candidate, Config } from \"../types.js\";\n\n// LIVE DeepSeek integration test (env-gated; skipped without creds).\n//\n// What this does when gated on:\n// 1. Routes a tiny inline Java fixture through extractWithLLM against\n// the real DeepSeek API (no module mock; per-file vi.mock from\n// client.test.ts does not leak here).\n// 2. Asserts the response parses as JSON and carries the load-bearing\n// schema fields (title + at least one populated section).\n// 3. Verifies countTokens throws the documented unsupported error.\n//\n// Skipped by default in CI (no creds). Opt-in for a developer with\n// DeepSeek creds before shipping changes to client.ts.\n//\n// Run:\n// DEEPSEEK_API_KEY=... npm test -- src/core/llm/client.deepseek-live.test.ts\n\nconst HAS_DEEPSEEK_CREDS = !!process.env[\"DEEPSEEK_API_KEY\"];\n\nconst D = HAS_DEEPSEEK_CREDS ? describe : describe.skip;\n\nconst JAVA_SOURCE = `@RestController\n@RequestMapping(\"/api/orders\")\npublic class OrderController {\n @PostMapping\n public ResponseEntity<Order> placeOrder(@RequestBody Order order) {\n Order saved = orderService.save(order);\n notificationService.sendConfirmation(saved.getCustomerEmail());\n return ResponseEntity.ok(saved);\n }\n}`;\n\nconst CANDIDATE: Candidate = {\n language: \"java\",\n filePath: \"/fake/OrderController.java\",\n relativePath: \"src/OrderController.java\",\n name: \"placeOrder\",\n kind: \"controller-method\",\n lineStart: 4,\n lineEnd: 8,\n source: JAVA_SOURCE,\n hints: {\n annotations: [\"@PostMapping\", \"@RestController\"],\n httpRoute: { method: \"POST\", path: \"/api/orders\" },\n callees: [\"save\", \"sendConfirmation\"],\n notes: [\"Sends email\"],\n },\n};\n\n// Force DeepSeek routing even if other API keys are set.\nconst CONFIG: Config = {\n include: [],\n exclude: [],\n output: \"./docs/use-cases\",\n model: \"deepseek-chat\",\n mock: false,\n llmBackend: \"deepseek\",\n maxCandidates: 50,\n publish: {},\n};\n\nD(\"extractWithLLM: live DeepSeek round-trip\", () => {\n beforeEach(() => {\n vi.stubEnv(\"CODE2WIKI_LLM_BACKEND\", \"\");\n vi.stubEnv(\"CODE2WIKI_MOCK\", \"\");\n });\n\n afterEach(() => {\n vi.unstubAllEnvs();\n });\n\n it(\"returns a structurally complete use case from a tiny Java fixture\", async () => {\n const result = await extractWithLLM({\n candidate: CANDIDATE,\n projectName: \"deepseek-live-smoke\",\n config: CONFIG,\n });\n\n expect(typeof result).toBe(\"object\");\n expect(result).not.toBeNull();\n\n const r = result as Record<string, unknown>;\n\n expect(typeof r[\"title\"]).toBe(\"string\");\n expect((r[\"title\"] as string).trim().length).toBeGreaterThan(0);\n\n const hasSummary =\n typeof r[\"summary\"] === \"string\" && (r[\"summary\"] as string).length > 0;\n const hasMainFlow =\n Array.isArray(r[\"main_flow\"]) && (r[\"main_flow\"] as unknown[]).length > 0;\n const hasBusinessRules =\n Array.isArray(r[\"business_rules\"]) &&\n (r[\"business_rules\"] as unknown[]).length > 0;\n\n expect(hasSummary || hasMainFlow || hasBusinessRules).toBe(true);\n }, 120000);\n\n it(\"countTokens throws the Anthropic-only diagnostic on the DeepSeek backend\", async () => {\n await expect(\n countTokens({\n candidate: CANDIDATE,\n projectName: \"deepseek-live-smoke\",\n config: CONFIG,\n }),\n ).rejects.toThrow(/estimate-cost.*not supported.*DeepSeek/i);\n });\n});\n"}}}}