|
1 | | -// edd/engine — HAYALET pending uzlaşması (YZLLM 2026-07-19, canlı cave: silinen kopya dosyaları 13.07'den |
2 | | -// beri pending → EDD hiç "0 pending"e ulaşamıyor, her açılış boşa re-run + yanlış "N kaldı" vaadi). |
| 1 | +// edd/engine — HAYALET pending sınıflaması (YZLLM 2026-07-19, canlı cave: silinen kopya dosyaları 13.07'den |
| 2 | +// beri pending → EDD hiç "0 pending"e ulaşamıyor). MAHKEME CRITICAL: enum'da yokluk ≠ silinmiş (geçici I/O |
| 3 | +// eksikliği gerçek pending'i kaybettirmesin) → notEnumerated AYRI kategori; runEdd safeSourceHash ile teyit eder. |
3 | 4 | import { describe, expect, it } from "vitest"; |
4 | | -import { ghostPendingUnits } from "../src/edd/engine.js"; |
| 5 | +import { classifyGhostPending } from "../src/edd/engine.js"; |
5 | 6 | import type { EddUnitRecord } from "../src/edd/progress.js"; |
6 | 7 | import type { SourceUnit } from "../src/edd/enumerate.js"; |
7 | 8 |
|
8 | 9 | const rec = (status: EddUnitRecord["status"]): EddUnitRecord => ({ unit: "x", status, ts: 1 }); |
9 | 10 | const su = (unit: string, analyzable: boolean, reason?: string): SourceUnit => ({ |
10 | | - unit, |
11 | | - abs: `/p/${unit}`, |
12 | | - bytes: 10, |
13 | | - analyzable, |
14 | | - reason, |
| 11 | + unit, abs: `/p/${unit}`, bytes: 10, analyzable, reason, |
15 | 12 | }); |
16 | 13 |
|
17 | | -describe("ghostPendingUnits", () => { |
18 | | - it("pending + enumeration'da YOK (silinmiş) → deleted-before-analysis", () => { |
19 | | - const cur = new Map<string, EddUnitRecord>([["routes/wellcome - Copy.js", rec("pending")]]); |
20 | | - const g = ghostPendingUnits(cur, [su("app.js", true)]); // silinen enum'da yok |
21 | | - expect(g).toEqual([{ unit: "routes/wellcome - Copy.js", reason: "deleted-before-analysis" }]); |
| 14 | +describe("classifyGhostPending", () => { |
| 15 | + it("pending + enumeration'da analyzable:false → nonAnalyzable (güvenli, doğrudan)", () => { |
| 16 | + const cur = new Map<string, EddUnitRecord>([["big.min.js", rec("pending")]]); |
| 17 | + const r = classifyGhostPending(cur, [su("big.min.js", false, "too-large (900KB)")]); |
| 18 | + expect(r.nonAnalyzable).toEqual([{ unit: "big.min.js", reason: "too-large (900KB)" }]); |
| 19 | + expect(r.notEnumerated).toEqual([]); |
22 | 20 | }); |
23 | 21 |
|
24 | | - it("pending + enumeration'da analyzable:false → o sebeple unanalyzable", () => { |
25 | | - const cur = new Map<string, EddUnitRecord>([["big.min.js", rec("pending")]]); |
26 | | - const g = ghostPendingUnits(cur, [su("big.min.js", false, "too-large (900KB)")]); |
27 | | - expect(g).toEqual([{ unit: "big.min.js", reason: "too-large (900KB)" }]); |
| 22 | + it("MAHKEME CRITICAL: pending + enum'da YOK → notEnumerated (doğrudan 'silinmiş' SAYILMAZ; caller fs ile teyit)", () => { |
| 23 | + const cur = new Map<string, EddUnitRecord>([["routes/wellcome - Copy.js", rec("pending")]]); |
| 24 | + const r = classifyGhostPending(cur, [su("app.js", true)]); |
| 25 | + expect(r.notEnumerated).toEqual(["routes/wellcome - Copy.js"]); |
| 26 | + expect(r.nonAnalyzable).toEqual([]); // ENOENT teyidi olmadan unanalyzable'a yazılmaz |
28 | 27 | }); |
29 | 28 |
|
30 | | - it("GENUINE pending (dosya var + analyzable) → DOKUNULMAZ", () => { |
| 29 | + it("GENUINE pending (dosya var + analyzable) → hiçbir kategoriye girmez (DOKUNULMAZ)", () => { |
31 | 30 | const cur = new Map<string, EddUnitRecord>([["app.js", rec("pending")]]); |
32 | | - expect(ghostPendingUnits(cur, [su("app.js", true)])).toEqual([]); |
| 31 | + const r = classifyGhostPending(cur, [su("app.js", true)]); |
| 32 | + expect(r.nonAnalyzable).toEqual([]); |
| 33 | + expect(r.notEnumerated).toEqual([]); |
33 | 34 | }); |
34 | 35 |
|
35 | | - it("done / unanalyzable kayıtlar → dokunulmaz (yalnız pending uzlaşılır)", () => { |
36 | | - const cur = new Map<string, EddUnitRecord>([ |
37 | | - ["a.js", rec("done")], |
38 | | - ["b.js", rec("unanalyzable")], |
39 | | - ]); |
40 | | - expect(ghostPendingUnits(cur, [])).toEqual([]); |
| 36 | + it("done / unanalyzable kayıtlar → dokunulmaz (yalnız pending sınıflanır)", () => { |
| 37 | + const cur = new Map<string, EddUnitRecord>([["a.js", rec("done")], ["b.js", rec("unanalyzable")]]); |
| 38 | + const r = classifyGhostPending(cur, []); |
| 39 | + expect(r.nonAnalyzable).toEqual([]); |
| 40 | + expect(r.notEnumerated).toEqual([]); |
41 | 41 | }); |
42 | 42 |
|
43 | | - it("cave senaryosu: 3 silinen kopya → 3 hayalet, gerçek pending korunur", () => { |
| 43 | + it("cave senaryosu: 3 kopya enum'da yok → notEnumerated; gerçek pending korunur", () => { |
44 | 44 | const cur = new Map<string, EddUnitRecord>([ |
45 | 45 | ["routes/store - Copy.js", rec("pending")], |
46 | 46 | ["routes/wellcome - Copy.js", rec("pending")], |
47 | 47 | ["routes/wellcome - Copy (2).js", rec("pending")], |
48 | 48 | ["routes/wellcome.js", rec("pending")], // gerçek, hâlâ var |
49 | 49 | ]); |
50 | | - const g = ghostPendingUnits(cur, [su("routes/wellcome.js", true)]); |
51 | | - expect(g.map((x) => x.unit).sort()).toEqual([ |
| 50 | + const r = classifyGhostPending(cur, [su("routes/wellcome.js", true)]); |
| 51 | + expect(r.notEnumerated.sort()).toEqual([ |
52 | 52 | "routes/store - Copy.js", |
53 | 53 | "routes/wellcome - Copy (2).js", |
54 | 54 | "routes/wellcome - Copy.js", |
55 | 55 | ]); |
| 56 | + expect(r.nonAnalyzable).toEqual([]); |
56 | 57 | }); |
57 | 58 | }); |
0 commit comments