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
11 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"repo": "asas99/proje-talep-bulucu", "files": {"test/deep-analysis.test.js": {"33013c571f6a4352429756a931a8f4f90cf05850": {"t": 1786068269.323415, "n": 10623, "h": "13e0ad61057f8b78", "c": "const test = require(\"node:test\");\nconst assert = require(\"node:assert/strict\");\nconst {\n calculateDeepValidation,\n createDeepAnalysis,\n parseDeepSeekJsonPayload,\n sanitizeDeepAnalysisCandidates,\n startStreamHeartbeat,\n validateDeepAnalysisResult\n} = require(\"../server\");\n\ntest(\"tanıtım ve sinyalsiz içerikleri DeepSeek adaylarından önce eler\", () => {\n const candidates = sanitizeDeepAnalysisCandidates([\n { id: \"promo\", title: \"New Blog Post: launch\", signals: [\"feature\"] },\n { id: \"no-signal\", title: \"Generic language article\", signals: [] },\n { id: \"demand\", title: \"Looking for a better language app\", signals: [\"solution\"] }\n ]);\n\n assert.deepEqual(candidates.map((candidate) => candidate.id), [\"demand\"]);\n});\n\ntest(\"az kanıtı düşük talep diye değil yetersiz kanıt diye işaretler\", () => {\n const validation = calculateDeepValidation({\n items: [{\n id: \"one\",\n classification: \"feature_request\",\n demandStrength: 20\n }]\n }, [{ id: \"one\", sourceId: \"hackernews\" }], {\n demandScore: 30,\n opportunityScore: 20\n });\n\n assert.equal(validation.evidenceStatus, \"insufficient_evidence\");\n assert.equal(validation.sufficientEvidence, false);\n});\n\ntest(\"çok kaynaklı anlamlı kanıtta doğrulanmış puan üretir\", () => {\n const items = [\n { id: \"a\", classification: \"genuine_problem\", demandStrength: 80 },\n { id: \"b\", classification: \"solution_seeking\", demandStrength: 75 },\n { id: \"c\", classification: \"dissatisfaction\", demandStrength: 70 }\n ];\n const validation = calculateDeepValidation(items.length ? { items } : {}, [\n { id: \"a\", sourceId: \"hackernews\" },\n { id: \"b\", sourceId: \"bluesky\" },\n { id: \"c\", sourceId: \"bluesky\" }\n ], { demandScore: 40, opportunityScore: 30 });\n\n assert.equal(validation.evidenceStatus, \"validated_demand\");\n assert.ok(validation.demandScore > 40);\n});\n\ntest(\"uzun derin analiz bağlantısını heartbeat olaylarıyla açık tutar\", async () => {\n const writes = [];\n const response = {\n destroyed: false,\n writableEnded: false,\n write: (value) => writes.push(JSON.parse(value))\n };\n const stopHeartbeat = startStreamHeartbeat(response, 5);\n\n try {\n await new Promise((resolve) => setTimeout(resolve, 50));\n } finally {\n stopHeartbeat();\n }\n\n assert.ok(writes.length >= 1);\n assert.ok(writes.every((event) => event.type === \"heartbeat\"));\n});\n\ntest(\"derin analiz adaylarını 20 sonuç ve güvenli uzunluklarla sınırlar\", () => {\n const candidates = sanitizeDeepAnalysisCandidates(Array.from({ length: 25 }, (_, index) => ({\n id: `item-${index}`,\n sourceId: \"bluesky\",\n title: `Result ${index}`,\n excerpt: \"x\".repeat(800),\n signals: [\"problem\"]\n })));\n\n assert.equal(candidates.length, 20);\n assert.equal(candidates[0].excerpt.length, 500);\n});\n\ntest(\"DeepSeek sonucunda bilinmeyen id ve sınıfları eler\", () => {\n const candidates = sanitizeDeepAnalysisCandidates([{\n id: \"valid-1\",\n sourceId: \"bluesky\",\n title: \"Looking for a better tool\",\n signals: [\"solution\"]\n }]);\n const result = validateDeepAnalysisResult({\n overallSummary: \"Gerçek bir problem sinyali var.\",\n recurringProblems: [{\n problem: \"Mevcut araç zor kullanılıyor.\",\n evidenceIds: [\"valid-1\", \"invented-id\"]\n }],\n cautions: [\"Örneklem küçük.\"],\n items: [\n {\n id: \"valid-1\",\n classification: \"genuine_problem\",\n demandStrength: \"82/100\",\n summary: \"Kullanıcı daha iyi araç arıyor.\",\n reasoning: \"Açık problem ve çözüm arayışı var.\"\n },\n { id: \"invented-id\", classification: \"payment_intent\", demandStrength: 100 }\n ]\n }, candidates);\n\n assert.equal(result.items.length, 1);\n assert.equal(result.items[0].classification, \"genuine_problem\");\n assert.equal(result.items[0].demandStrength, 82);\n assert.deepEqual(result.recurringProblems[0].evidenceIds, [\"valid-1\"]);\n});\n\ntest(\"kanıtsız rakipleri eler ve kanıtlı alternatifleri korur\", () => {\n const candidates = [{\n id: \"evidence-1\",\n sourceId: \"bluesky\",\n title: \"Duolingo lacks community-created lessons\",\n signals: [\"dissatisfaction\"]\n }];\n const result = validateDeepAnalysisResult({\n marketCrowding: \"high\",\n competitorSummary: \"Bir alternatif açıkça anılıyor.\",\n unmetNeeds: [\"Topluluk tarafından hazırlanan dersler\"],\n mentionedAlternatives: [\n {\n name: \"Duolingo\",\n evidenceIds: [\"evidence-1\"],\n sentiment: \"negative\",\n painPoints: [\"Topluluk içeriği eksik\"]\n },\n {\n name: \"Uydurma Ürün\",\n evidenceIds: [\"olmayan-id\"],\n sentiment: \"positive\"\n }\n ],\n items: []\n }, candidates);\n\n assert.equal(result.marketCrowding, \"high\");\n assert.deepEqual(result.mentionedAlternatives.map((item) => item.name), [\"Duolingo\"]);\n assert.equal(result.unmetNeeds.length, 1);\n});\n\ntest(\"yüksek rakip yoğunluğu fırsat puanını kontrollü düşürür\", () => {\n const items = [\n { id: \"a\", classification: \"dissatisfaction\", demandStrength: 70 },\n { id: \"b\", classification: \"solution_seeking\", demandStrength: 70 },\n { id: \"c\", classification: \"genuine_problem\", demandStrength: 70 }\n ];\n const candidates = [\n { id: \"a\", sourceId: \"hackernews\" },\n { id: \"b\", sourceId: \"bluesky\" },\n { id: \"c\", sourceId: \"bluesky\" }\n ];\n const lowCrowding = calculateDeepValidation({\n items,\n marketCrowding: \"low\",\n unmetNeeds: [\"Eksik özellik\"]\n }, candidates, { demandScore: 40, opportunityScore: 40 });\n const highCrowding = calculateDeepValidation({\n items,\n marketCrowding: \"high\",\n unmetNeeds: [\"Eksik özellik\"]\n }, candidates, { demandScore: 40, opportunityScore: 40 });\n\n assert.ok(lowCrowding.opportunityScore > highCrowding.opportunityScore);\n});\n\ntest(\"derin analiz gerçek işlem aşamalarında ilerleme olayı üretir\", async () => {\n const originalFetch = global.fetch;\n const originalKey = process.env.DEEPSEEK_API_KEY;\n const progressEvents = [];\n process.env.DEEPSEEK_API_KEY = \"test-key\";\n global.fetch = async () => ({\n ok: true,\n status: 200,\n json: async () => ({\n choices: [{\n message: {\n content: JSON.stringify({\n overallSummary: \"Talep sinyali var.\",\n recurringProblems: [],\n cautions: [],\n items: [{\n id: \"progress-item\",\n classification: \"genuine_problem\",\n demandStrength: 75,\n summary: \"Kullanıcı problem yaşıyor.\",\n reasoning: \"Açık problem ifadesi var.\"\n }]\n })\n }\n }]\n })\n });\n\n try {\n await createDeepAnalysis(\"inventory tracking idea\", [{\n id: \"progress-item\",\n sourceId: \"bluesky\",\n title: \"Need a better inventory tracker\",\n signals: [\"solution\"]\n }], (progress) => progressEvents.push(progress));\n\n assert.deepEqual(progressEvents.map((event) => event.progress), [8, 20, 35, 82, 92, 100]);\n } finally {\n global.fetch = originalFetch;\n if (originalKey === undefined) delete process.env.DEEPSEEK_API_KEY;\n else process.env.DEEPSEEK_API_KEY = originalKey;\n }\n});\n\ntest(\"kesilen DeepSeek yanıtını daha geniş sınırla otomatik yeniden ister\", async () => {\n const originalFetch = global.fetch;\n const originalKey = process.env.DEEPSEEK_API_KEY;\n const progressEvents = [];\n let callCount = 0;\n process.env.DEEPSEEK_API_KEY = \"test-key\";\n global.fetch = async () => {\n callCount += 1;\n const content = callCount === 1\n ? '{\"overallSummary\":\"yarım'\n : JSON.stringify({\n overallSummary: \"İkinci denemede tamamlandı.\",\n recurringProblems: [],\n cautions: [],\n items: [{\n id: \"retry-item\",\n classification: \"solution_seeking\",\n demandStrength: 70,\n summary: \"Kullanıcı çözüm arıyor.\",\n reasoning: \"Açık çözüm arayışı var.\"\n }]\n });\n return {\n ok: true,\n status: 200,\n json: async () => ({\n choices: [{\n finish_reason: callCount === 1 ? \"length\" : \"stop\",\n message: { content }\n }]\n })\n };\n };\n\n try {\n const result = await createDeepAnalysis(\"retry inventory idea\", [{\n id: \"retry-item\",\n sourceId: \"bluesky\",\n title: \"Looking for inventory help\",\n signals: [\"solution\"]\n }], (progress) => progressEvents.push(progress));\n\n assert.equal(callCount, 2);\n assert.equal(result.items.length, 1);\n assert.ok(progressEvents.some((event) => event.progress === 85));\n } finally {\n global.fetch = originalFetch;\n if (originalKey === undefined) delete process.env.DEEPSEEK_API_KEY;\n else process.env.DEEPSEEK_API_KEY = originalKey;\n }\n});\n\ntest(\"JSON kod bloğu biçimindeki tamamlanmış yanıtı ayrıştırır\", () => {\n const parsed = parseDeepSeekJsonPayload({\n choices: [{\n finish_reason: \"stop\",\n message: { content: \"```json\\n{\\\"overallSummary\\\":\\\"tamam\\\"}\\n```\" }\n }]\n });\n\n assert.equal(parsed.overallSummary, \"tamam\");\n});\n\ntest(\"aynı derin analiz eşzamanlı istenirse tek DeepSeek çağrısını paylaşır\", async () => {\n const originalFetch = global.fetch;\n const originalKey = process.env.DEEPSEEK_API_KEY;\n let callCount = 0;\n process.env.DEEPSEEK_API_KEY = \"test-key\";\n global.fetch = async () => {\n callCount += 1;\n await new Promise((resolve) => setTimeout(resolve, 10));\n return {\n ok: true,\n status: 200,\n json: async () => ({\n choices: [{\n finish_reason: \"stop\",\n message: {\n content: JSON.stringify({\n overallSummary: \"Tek çağrı paylaşıldı.\",\n recurringProblems: [],\n cautions: [],\n items: [{\n id: \"shared-item\",\n classification: \"genuine_problem\",\n demandStrength: 75,\n summary: \"Problem var.\",\n reasoning: \"Açık problem.\"\n }]\n })\n }\n }]\n })\n };\n };\n const candidates = [{\n id: \"shared-item\",\n sourceId: \"bluesky\",\n title: \"A shared pending analysis request\",\n signals: [\"problem\"]\n }];\n\n try {\n const [first, second] = await Promise.all([\n createDeepAnalysis(\"shared analysis idea\", candidates),\n createDeepAnalysis(\"shared analysis idea\", candidates)\n ]);\n\n assert.equal(callCount, 1);\n assert.equal(first.items.length, 1);\n assert.equal(second.items.length, 1);\n assert.equal(second.shared, true);\n } finally {\n global.fetch = originalFetch;\n if (originalKey === undefined) delete process.env.DEEPSEEK_API_KEY;\n else process.env.DEEPSEEK_API_KEY = originalKey;\n }\n});\n"}}}}