复核EveryApp入表并保留原候选初筛审计

This commit is contained in:
2026-10-30 16:09:43 +08:00
parent 62c015fa9b
commit 62d3d498bb
11 changed files with 430 additions and 45 deletions
+23 -9
View File
@@ -23,10 +23,11 @@ test("research revisions share the authentication database and preserve replay l
for (let i = 0; i < 20; i++) consumeCode(config, "invalid");
assert.equal(consumeCode(config, "invalid"), "limited");
const initial = readResearchSnapshot();
assert.equal(initial.companies.length, 1017);
assert.equal(initial.evidence.length, 1154);
assert.equal(initial.companies.length, 1018);
assert.equal(initial.evidence.length, 1172);
assert.equal(initial.observations.length, 187);
assert.deepEqual(initial.candidateBatches, seed.candidateBatches, "candidate gaps persist in the same database metadata");
assert.deepEqual(initial.directoryRechecks, seed.directoryRechecks, "follow-up classifications persist without rewriting the discovery audit");
assert.deepEqual(readResearchSnapshot(), initial, "reopening does not duplicate records");
const db = openSiteDatabase();
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table'").all() as { name: string }[];
@@ -63,9 +64,9 @@ test("research validation rejects broken evidence and unsafe source links", () =
test("reviews link explicit companies without turning global or excluded cases into companies", () => {
const snapshot = structuredClone(seed) as ResearchSnapshot;
assert.equal(snapshot.reviews.filter((r) => r.scope === "companies").length, 48);
assert.equal(snapshot.reviews.filter((r) => r.scope === "companies").length, 49);
assert.equal(snapshot.reviews.filter((r) => r.scope === "dataset").length, 4);
assert.equal(snapshot.reviews.filter((r) => r.scope === "excluded-candidate").length, 9);
assert.equal(snapshot.reviews.filter((r) => r.scope === "excluded-candidate").length, 11);
const review = snapshot.reviews.find((r) => r.id === "R4")!;
assert.deepEqual(reviewCompanyIds(snapshot, review), ["AI007", "AI013", "AI021", "AI034"]);
assert.deepEqual(reviewCompanyIds(snapshot, snapshot.reviews.find((r) => r.id === "CN-R-PSI")!), []);
@@ -84,11 +85,11 @@ test("reviews link explicit companies without turning global or excluded cases i
test("disclosure counts exclude client income, biographies, targets and duplicate milestones", () => {
const snapshot = seed as ResearchSnapshot;
const summary = categorySummary(snapshot);
assert.equal(summary.reduce((n, c) => n + c.count, 0), 1017);
assert.equal(summary.reduce((n, c) => n + c.count, 0), 1018);
assert.equal(summary.reduce((n, c) => n + c.self, 0), 26);
assert.equal(summary.reduce((n, c) => n + c.estimate, 0), 1);
assert.equal(summary.reduce((n, c) => n + c.platform, 0), 16);
assert.equal(summary.reduce((n, c) => n + c.unknown, 0), 974);
assert.equal(summary.reduce((n, c) => n + c.unknown, 0), 975);
assert.equal(snapshot.companies.find((c) => c.name === "Rork")?.revenueStatus, "unknown");
assert.equal(snapshot.companies.find((c) => c.name === "Result")?.revenueStatus, "unknown");
assert.ok(snapshot.observations.filter((o) => o.selection === "signal").every((o) => o.scope === "公司整体"));
@@ -96,8 +97,8 @@ test("disclosure counts exclude client income, biographies, targets and duplicat
test("technical reviews keep accessible materials separate from tested capabilities", () => {
const snapshot = structuredClone(seed) as ResearchSnapshot;
assert.equal(snapshot.companies.filter((c) => c.technicalReview).length, 10);
assert.equal(snapshot.companies.filter((c) => c.technicalReview?.level === "public-artifact").length, 4);
assert.equal(snapshot.companies.filter((c) => c.technicalReview).length, 11);
assert.equal(snapshot.companies.filter((c) => c.technicalReview?.level === "public-artifact").length, 5);
assert.equal(snapshot.companies.filter((c) => c.technicalReview?.level === "independent-test").length, 1);
assert.equal(snapshot.companies.find((c) => c.id === "AI051")?.revenueStatus, "unknown");
assert.match(snapshot.companies.find((c) => c.id === "AI051")!.technicalReview!.testScope!, /Sep 2026/);
@@ -299,7 +300,7 @@ test("unreconciled directory financials remain source reviews instead of income
assert.ok(review.evidenceIds.includes("PH-TANA-DR"));
assert.equal(reviewCompanyIds(snapshot, review).length, 0);
assert.ok(!snapshot.observations.some((o) => o.evidence === "PH-TANA-DR"));
assert.equal(snapshot.candidateBatches!.flatMap((b) => b.records).filter((r) => r.status === "pending-year").length, 20);
assert.equal(snapshot.candidateBatches!.flatMap((b) => b.records).filter((r) => r.status === "pending-year").length, 18);
});
test("product pivots and founder histories do not become new company years or current revenue", () => {
@@ -313,3 +314,16 @@ test("product pivots and founder histories do not become new company years or cu
assert.ok(!platformIncomeSample(snapshot, { windowDays: null }).points.some((point) => point.company.id === pivot.id));
assert.ok(!snapshot.observations.some((o) => ["PH-FUNDRAISLY-ABOUT", "LF-PIVOT", "LF-HISTORY"].includes(o.evidence)), "other ventures' ARR, users and funding must not transfer");
});
test("follow-up evidence can admit an uncertain directory candidate without rewriting its original status", () => {
const snapshot = structuredClone(seed) as ResearchSnapshot;
const followup = snapshot.directoryRechecks!.find((row) => row.ycId === 36088)!;
const original = coverageAudit.records.find((row) => row.ycId === followup.ycId)!;
assert.equal(original.status, "ai-unclear");
assert.equal(followup.originalStatus, original.status);
assert.equal(snapshot.companies.find((c) => c.id === followup.companyId)?.year, 2026);
assert.equal(snapshot.candidateBatches!.flatMap((b) => b.records).find((r) => r.name === "OpenSEO")?.companyId, followup.companyId);
assert.ok(!snapshot.observations.some((o) => ["SEO-PRICE", "UP-YC", "PAZI-PRICE"].includes(o.evidence)), "pricing, other ventures' ARR and prepaid balances stay outside income observations");
followup.companyId = "missing-company";
assert.throws(() => validateResearch(snapshot), /directory recheck/);
});