1253 lines
83 KiB
TypeScript
1253 lines
83 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { mkdtempSync, rmSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { tmpdir } from "node:os";
|
|
import seed from "../../../content/research/ai-companies.seed.json";
|
|
import coverageAudit from "../../../content/research/ai-companies.coverage.json";
|
|
import incomeReference from "../../../content/research/ai-income-analysis.json";
|
|
import { readResearchSnapshot } from "../src/lib/ai-research-store";
|
|
import { openSiteDatabase } from "../src/lib/site-database";
|
|
import { businessModelReviewType, categorySummary, evidenceUrl, reviewCompanyIds, validateResearch, type ResearchSnapshot } from "../src/lib/ai-research";
|
|
import { consumeCode, initializeStore } from "../src/lib/auth-store";
|
|
import { newAuthConfig } from "../src/lib/auth";
|
|
import { arrDisclosureCoverage, arrDisclosures, arrFieldGaps, compareIncomeGroups, describeIncome, groupIncome, platformIncomeSample } from "../src/lib/research-statistics";
|
|
|
|
test("ARR field checks distinguish missing dates, other currencies, bounds and estimates", () => {
|
|
const observation = { ...seed.observations[0], metric: "arr", unit: "USD", value: 100,
|
|
bound: "=", selection: "signal", observedAt: "2026-10-30" } as ResearchSnapshot["observations"][number];
|
|
assert.deepEqual(arrFieldGaps(observation, "2026-10-31"), []);
|
|
for (const observedAt of [undefined, "2026-02-30", "2026-11-01"])
|
|
assert.deepEqual(arrFieldGaps({ ...observation, observedAt }, "2026-10-31"), ["date"]);
|
|
assert.deepEqual(arrFieldGaps({ ...observation, unit: "EUR" }, "2026-10-31"), ["currency"],
|
|
"known foreign currencies stay distinct without an invented USD conversion");
|
|
assert.deepEqual(arrFieldGaps({ ...observation, unit: "原文$,币种待核", bound: ">",
|
|
selection: "historical-estimate", observedAt: undefined }, "2026-10-31"), ["date", "currency", "amount", "estimate"]);
|
|
assert.deepEqual(arrFieldGaps({ ...observation, value: Number.NaN }, "2026-10-31"), ["amount"]);
|
|
assert.deepEqual(arrFieldGaps({ ...observation, value: -1 }, "2026-10-31"), ["amount"]);
|
|
assert.deepEqual(arrFieldGaps({ ...observation, value: 0 }, "2026-10-31"), [], "disclosed zero is a valid amount");
|
|
const rows = arrDisclosures(seed as ResearchSnapshot);
|
|
assert.ok(rows.length > 0);
|
|
assert.ok(rows.every(({ observation: claim }) => arrFieldGaps(claim, seed.asOf).length > 0),
|
|
"the current ledger cannot be described as a complete dated exact USD sample");
|
|
});
|
|
|
|
test("income interpretations compare sufficient samples within a provider and known billing model", () => {
|
|
const snapshot = structuredClone(seed) as ResearchSnapshot;
|
|
const makePoints = (cat: string, values: number[], provider = "Stripe", model = "软件订阅") => values.map((value, index) => ({
|
|
company: { ...snapshot.companies[0], id: `${cat}-${provider}-${model}-${index}`, cat, businessModel: model },
|
|
observation: { ...snapshot.observations[0], provider }, value,
|
|
}));
|
|
const points = [
|
|
...makePoints("C04", [100, 100, 100]),
|
|
...makePoints("C06", [10, 10, 1000]),
|
|
...makePoints("C08", [1, 10000]),
|
|
...makePoints("C09", [1, 10, 10000], "RevenueCat"),
|
|
...makePoints("C10", [1, 10, 10000], "Stripe", "硬件服务"),
|
|
...makePoints("C07", [0, 0, 0]),
|
|
...makePoints("C01", [1, 10, 100], "Stripe", "收费模式未核验"),
|
|
];
|
|
const comparisons = compareIncomeGroups(groupIncome(points));
|
|
assert.equal(comparisons.length, 1);
|
|
assert.equal(comparisons[0].leastDispersed.category, "C04");
|
|
assert.equal(comparisons[0].mostDispersed.category, "C06");
|
|
assert.equal(comparisons[0].leastSensitive.category, "C04");
|
|
assert.equal(comparisons[0].mostSensitive.category, "C06");
|
|
assert.deepEqual(compareIncomeGroups(groupIncome(points, false)), [], "merged billing models are not comparable here");
|
|
const annualized = compareIncomeGroups(groupIncome(points.map((point) => ({ ...point, value: point.value * 12 }))));
|
|
assert.equal(annualized[0].mostSensitive.category, comparisons[0].mostSensitive.category);
|
|
assert.ok(Math.abs(annualized[0].mostDispersed.stats.cv! - comparisons[0].mostDispersed.stats.cv!) < 1e-12);
|
|
});
|
|
|
|
test("ARR coverage counts companies once and separates missing disclosures from zero income", () => {
|
|
const snapshot = structuredClone(seed) as ResearchSnapshot;
|
|
snapshot.categories = [{ id: "C07", name: "行业应用", description: "" }];
|
|
const template = snapshot.companies[0];
|
|
snapshot.companies = [
|
|
{ ...template, id: "reported", cat: "C07", year: 2025 },
|
|
{ ...template, id: "estimated", cat: "C07", year: 2026 },
|
|
{ ...template, id: "missing", cat: "C07", year: 2025 },
|
|
{ ...template, id: "old", cat: "C07", year: 2024 },
|
|
{ ...template, id: "undated", cat: "C07", year: null },
|
|
];
|
|
const observation = snapshot.observations[0];
|
|
snapshot.observations = [
|
|
{ ...observation, id: "zero", company: "reported", metric: "arr", selection: "signal", value: 0 },
|
|
{ ...observation, id: "past", company: "reported", metric: "arr", selection: "historical", value: 10 },
|
|
{ ...observation, id: "estimate", company: "reported", metric: "arr", selection: "estimate", value: 20 },
|
|
{ ...observation, id: "only-estimate", company: "estimated", metric: "arr", selection: "historical-estimate", value: 30 },
|
|
{ ...observation, id: "goal", company: "missing", metric: "arr", selection: "excluded", value: 40 },
|
|
{ ...observation, id: "mrr", company: "missing", metric: "mrr", selection: "platform", value: 50 },
|
|
{ ...observation, id: "old-arr", company: "old", metric: "arr", selection: "signal", value: 60 },
|
|
];
|
|
assert.deepEqual(arrDisclosureCoverage(snapshot), [{ id: "C07", name: "行业应用",
|
|
companies: 3, disclosed: 2, reported: 1, estimatedOnly: 1, missing: 1, records: 4 }]);
|
|
assert.deepEqual(arrDisclosureCoverage(snapshot, 2025), [{ id: "C07", name: "行业应用",
|
|
companies: 2, disclosed: 1, reported: 1, estimatedOnly: 0, missing: 1, records: 3 }]);
|
|
});
|
|
|
|
test("ARR ledger preserves historical estimates without promoting targets, run rates or outside-cohort claims", () => {
|
|
const snapshot = structuredClone(seed) as ResearchSnapshot;
|
|
const rows = arrDisclosures(snapshot);
|
|
const ids = new Set(rows.map((row) => row.observation.id));
|
|
for (const id of ["O064", "O065", "O066", "O069", "O070", "O071", "O046"])
|
|
assert.ok(ids.has(id), `${id}: historical claims, estimates and unknown currencies remain visible`);
|
|
for (const id of ["O050", "O052", "O053", "O055", "SR-O-AI067-runrate", "ROCKET-O-arr", "AQ-O-RUNRATE",
|
|
"SRLEARN1-O-CLAIR-D2C", "SRLEARN1-O-CLAIR-B2B"])
|
|
assert.ok(!ids.has(id), `${id}: excluded or ambiguous records cannot enter the ARR ledger`);
|
|
assert.equal(rows.find((row) => row.observation.id === "O066")?.observation.selection, "historical-estimate");
|
|
assert.equal(rows.find((row) => row.observation.id === "O046")?.observation.unit, "原文$,币种待核");
|
|
for (const id of ["O045", "O047"])
|
|
assert.equal(rows.find((row) => row.observation.id === id)?.observation.unit, "原文$,币种待核",
|
|
"current subscription prices cannot establish the currency of a historical ARR claim");
|
|
const category = snapshot.companies.find((company) => company.id === "AI055")!.cat;
|
|
const filtered = arrDisclosures(snapshot, { category, foundedYear: 2025 });
|
|
assert.ok(filtered.length > 0);
|
|
assert.ok(filtered.every((row) => row.company.cat === category && row.company.year === 2025));
|
|
// A future mistakenly typed target still must not enter the ledger.
|
|
const target = snapshot.observations.find((item) => item.id === "O052")!;
|
|
target.metric = "arr";
|
|
target.company = "AI055";
|
|
assert.ok(!arrDisclosures(snapshot).some((row) => row.observation.id === target.id));
|
|
const claim = snapshot.observations.find((item) => item.id === "O065")!;
|
|
claim.value = Number.NaN;
|
|
assert.ok(!arrDisclosures(snapshot).some((row) => row.observation.id === claim.id));
|
|
});
|
|
|
|
test("research revisions share the authentication database and preserve replay limits", () => {
|
|
const dir = mkdtempSync(join(tmpdir(), "site-research-"));
|
|
const previous = process.env.AUTH_CONFIG_FILE;
|
|
process.env.AUTH_CONFIG_FILE = join(dir, "config.json");
|
|
try {
|
|
initializeStore();
|
|
const config = newAuthConfig();
|
|
for (let i = 0; i < 20; i++) consumeCode(config, "invalid");
|
|
assert.equal(consumeCode(config, "invalid"), "limited");
|
|
const initial = readResearchSnapshot();
|
|
assert.equal(initial.companies.length, 1312);
|
|
assert.equal(initial.evidence.length, 5354);
|
|
assert.equal(initial.observations.length, 495);
|
|
const businessReviews = initial.reviews.filter((review) => review.type === businessModelReviewType);
|
|
assert.equal(businessReviews.length, 26);
|
|
assert.deepEqual(businessReviews, seed.reviews.filter((review) => review.type === businessModelReviewType)
|
|
.sort((a, b) => a.id.localeCompare(b.id)),
|
|
"business model assessments and company/evidence links persist in the shared database");
|
|
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 }[];
|
|
assert.ok(tables.some((r) => r.name === "login_state"));
|
|
assert.ok(tables.some((r) => r.name === "research_companies"));
|
|
assert.equal(db.prepare("PRAGMA foreign_keys").get()?.foreign_keys, 1);
|
|
db.close();
|
|
const next = structuredClone(seed) as ResearchSnapshot;
|
|
next.version += "-revision-test";
|
|
next.companies[0].name = "Revised company";
|
|
assert.equal(readResearchSnapshot(next).companies[0].name, "Revised company");
|
|
assert.deepEqual(readResearchSnapshot(), initial, "old release still reads its original revision");
|
|
assert.equal(consumeCode(config, "invalid"), "limited", "research import must not reset auth limits");
|
|
const collision = structuredClone(seed) as ResearchSnapshot;
|
|
collision.companies[0].name = "Changed without revision";
|
|
assert.throws(() => readResearchSnapshot(collision), /new revision/);
|
|
assert.deepEqual(readResearchSnapshot(), initial, "failed import leaves valid revision intact");
|
|
} finally {
|
|
if (previous === undefined) delete process.env.AUTH_CONFIG_FILE;
|
|
else process.env.AUTH_CONFIG_FILE = previous;
|
|
rmSync(dir, { recursive: true, force: true });
|
|
}
|
|
});
|
|
|
|
test("research validation rejects broken evidence and unsafe source links", () => {
|
|
validateResearch(seed as ResearchSnapshot);
|
|
const invalid = structuredClone(seed) as ResearchSnapshot;
|
|
invalid.observations[0].evidence = "missing";
|
|
assert.throws(() => validateResearch(invalid), /observation/);
|
|
assert.equal(evidenceUrl("javascript:alert(1)"), undefined);
|
|
assert.equal(evidenceUrl("/local-link"), undefined);
|
|
assert.equal(evidenceUrl("https://example.com/evidence"), "https://example.com/evidence");
|
|
});
|
|
|
|
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, 299);
|
|
assert.equal(snapshot.reviews.filter((r) => r.scope === "dataset").length, 159);
|
|
assert.equal(snapshot.reviews.filter((r) => r.scope === "excluded-candidate").length, 65);
|
|
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")!), []);
|
|
const oldReview = structuredClone(snapshot.reviews.find((r) => r.id === "TECH-GRAD-R-SCOPE")!);
|
|
delete oldReview.scope;
|
|
delete oldReview.companyIds;
|
|
assert.deepEqual(reviewCompanyIds(snapshot, oldReview), ["AI051"], "old revisions retain evidence-owner fallback");
|
|
review.companyIds = ["unknown-company"];
|
|
assert.throws(() => validateResearch(snapshot), /research review/);
|
|
review.companyIds = ["AI007", "AI007"];
|
|
assert.throws(() => validateResearch(snapshot), /research review/);
|
|
review.companyIds = [];
|
|
assert.throws(() => validateResearch(snapshot), /research review/);
|
|
});
|
|
|
|
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), 1312);
|
|
assert.equal(summary.reduce((n, c) => n + c.self, 0), 63);
|
|
assert.equal(summary.reduce((n, c) => n + c.estimate, 0), 2);
|
|
assert.equal(summary.reduce((n, c) => n + c.platform, 0), 19);
|
|
assert.equal(summary.reduce((n, c) => n + c.unknown, 0), 1228);
|
|
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 === "公司整体"));
|
|
const arena = snapshot.observations.find((o) => o.id === "COARENA-O-CUMULATIVE")!;
|
|
assert.equal(arena.selection, "historical", "cumulative launch revenue is not a recurring company-wide signal");
|
|
assert.equal(arena.comparisonGroup, null);
|
|
assert.ok(arena.metric !== "mrr" && arena.metric !== "arr", "a two-week cumulative figure cannot become MRR or ARR");
|
|
});
|
|
|
|
test("service run rates, legacy freight revenue and paid adoption do not become platform ARR", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const runRate = snapshot.observations.find((o) => o.id === "INDUSTRY11-O-LOCKE-RUNRATE")!;
|
|
assert.equal(runRate.metric, "annualized-revenue");
|
|
assert.equal(runRate.selection, "historical");
|
|
assert.equal(runRate.observedAt, undefined);
|
|
assert.equal(runRate.comparisonGroup, null);
|
|
assert.equal(snapshot.companies.find((c) => c.id === "YC33283")?.revenueStatus, "self");
|
|
for (const id of ["TRUEMILE-OLD-REV", "VELTHA-DEMO", "LANTERN-OLD-REV"]) {
|
|
const observation = snapshot.observations.find((o) => o.id === `INDUSTRY11-O-${id}`)!;
|
|
assert.equal(observation.selection, "excluded");
|
|
assert.equal(observation.metric, undefined);
|
|
assert.equal(observation.comparisonGroup, null);
|
|
}
|
|
for (const [id, company] of [["VERDANT-DEPLOY", "YC32189"], ["SUTRIX-PAID", "YC36576"]]) {
|
|
const observation = snapshot.observations.find((o) => o.id === `INDUSTRY11-O-${id}`)!;
|
|
assert.equal(observation.selection, "adoption");
|
|
assert.equal(observation.metric, undefined);
|
|
assert.equal(snapshot.companies.find((c) => c.id === company)?.revenueStatus, "unknown");
|
|
}
|
|
assert.ok(platformIncomeSample(snapshot, { windowDays: 90 }).points.every((point) => !point.observation.id.startsWith("INDUSTRY11-")));
|
|
});
|
|
|
|
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, 303);
|
|
assert.equal(snapshot.companies.filter((c) => c.technicalReview?.level === "public-artifact").length, 29);
|
|
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/);
|
|
assert.ok(snapshot.observations.filter((o) => o.id.startsWith("TECH-GRAD-O-")).every((o) => o.selection === "technical" && o.comparisonGroup === null));
|
|
const company = snapshot.companies.find((c) => c.id === "AI061")!;
|
|
const review = company.technicalReview!;
|
|
review.evidenceIds = ["missing-technical-evidence"];
|
|
assert.throws(() => validateResearch(snapshot), /technical review/);
|
|
review.evidenceIds = ["TECH-NAIVE-HF"];
|
|
review.reviewedAt = "2026-02-30";
|
|
assert.throws(() => validateResearch(snapshot), /technical review/);
|
|
review.reviewedAt = "2099-01-01";
|
|
assert.throws(() => validateResearch(snapshot), /technical review/);
|
|
review.reviewedAt = snapshot.asOf;
|
|
review.level = "independent-test";
|
|
assert.throws(() => validateResearch(snapshot), /technical review/,
|
|
"an accessible artifact cannot become a test record without a stated test scope");
|
|
});
|
|
|
|
test("ambiguous ARR claims retain currency, precision and attribution limits", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const variant = snapshot.observations.filter((o) => o.company === "AI066");
|
|
assert.deepEqual(variant.filter((o) => o.selection === "crosscheck").map((o) => o.value).sort(), [500000, 600000]);
|
|
assert.equal(variant.filter((o) => o.selection === "signal").length, 0);
|
|
assert.ok(variant.filter((o) => [2500000, 40000000].includes(o.value)).every((o) => o.selection === "excluded"));
|
|
const codos = snapshot.observations.find((o) => o.id === "SR-O-AI065-arr")!;
|
|
assert.equal(codos.bound, "≥");
|
|
assert.equal(codos.unit, "币种未注明");
|
|
assert.equal(codos.comparisonGroup, null);
|
|
assert.ok(snapshot.observations.filter((o) => o.id.startsWith("SR-O-")).every((o) => o.comparisonGroup === null && o.unit !== "USD"));
|
|
assert.equal(snapshot.companies.find((c) => c.id === "AI071")?.year, 2021);
|
|
const rocket = snapshot.observations.find((o) => o.id === "ROCKET-O-arr")!;
|
|
assert.equal(rocket.selection, "historical");
|
|
assert.equal(rocket.comparisonGroup, null);
|
|
assert.notEqual(rocket.scope, "公司整体");
|
|
assert.equal(snapshot.companies.find((c) => c.id === "AI070")?.revenueStatus, "unknown");
|
|
assert.equal(snapshot.observations.filter((o) => o.company === "AI070").length, 0,
|
|
"unreadable announcement summaries do not become numeric ARR");
|
|
const waitlist = snapshot.observations.find((o) => o.id === "SR25-O-OMI-WAITLIST")!;
|
|
assert.equal(waitlist.selection, "excluded", "waitlist conversions are not paid recurring revenue");
|
|
assert.equal(snapshot.companies.find((c) => c.id === waitlist.company)?.revenueStatus, "unknown");
|
|
const bluma = snapshot.observations.find((o) => o.id === "BLUMA-O-HISTORICAL-MRR")!;
|
|
assert.equal(bluma.selection, "historical");
|
|
assert.ok(bluma.unit !== "USD" && !bluma.observedAt && bluma.comparisonGroup === null);
|
|
const native = snapshot.observations.find((o) => o.id === "NATIVE-O-ARR-CLAIM")!;
|
|
assert.equal(native.selection, "crosscheck");
|
|
assert.ok(!native.metric && !native.observedAt && native.comparisonGroup === null);
|
|
const marketVolume = snapshot.observations.find((o) => o.id === "PALISADE-O-GMV")!;
|
|
assert.equal(marketVolume.selection, "excluded", "customer GMV must not establish company revenue or ARR");
|
|
assert.equal(snapshot.companies.find((c) => c.id === marketVolume.company)?.revenueStatus, "unknown");
|
|
const pingo = snapshot.observations.find((o) => o.id === "PINGO-O-MRR-JUL25")!;
|
|
assert.equal(pingo.selection, "historical", "a July 2025 self-report is not a current payment-platform sample");
|
|
assert.ok(pingo.unit !== "USD" && !pingo.observedAt && pingo.comparisonGroup === null);
|
|
const designService = snapshot.observations.find((o) => o.id === "SEMIOTIC-O-LAUNCH-REVENUE")!;
|
|
assert.equal(designService.selection, "historical");
|
|
assert.ok(!designService.metric && designService.comparisonGroup === null, "four-week service revenue is not MRR or ARR");
|
|
const restaurantAdoption = snapshot.observations.filter((o) => o.company === "YC32815");
|
|
assert.ok(restaurantAdoption.length > 0 && restaurantAdoption.every((o) => o.selection === "adoption" && !o.metric),
|
|
"restaurant count and list price must not produce an invented MRR observation");
|
|
const fishPilot = snapshot.observations.find((o) => o.id === "OCTAPULSE-O-CONTRACT")!;
|
|
assert.equal(fishPilot.selection, "excluded", "a paid pilot or annual contract does not establish recognized recurring revenue");
|
|
assert.equal(snapshot.companies.find((c) => c.id === fishPilot.company)?.revenueStatus, "unknown");
|
|
assert.equal(fishPilot.comparisonGroup, null);
|
|
assert.notEqual(fishPilot.unit, "USD", "six-figure wording does not establish the currency");
|
|
assert.ok(!fishPilot.metric && !fishPilot.observedAt, "the publication date is not the financial reporting date");
|
|
const cedar = snapshot.observations.filter((o) => o.company === "AI102");
|
|
assert.ok(cedar.every((o) => o.selection !== "signal" && o.comparisonGroup === null),
|
|
"closed and contracted amounts without recognition or period do not establish ARR");
|
|
assert.equal(snapshot.observations.find((o) => o.id === "SR25-O-LOOPS-CUSTOMER-SALES")?.selection, "excluded");
|
|
const portfolio = snapshot.observations.filter((o) => o.company === "AI100");
|
|
assert.deepEqual(portfolio.filter((o) => o.selection === "signal").map((o) => o.id), ["SR25-O-DRS-PORTFOLIO"],
|
|
"a product milestone must not be added to its company portfolio as another company");
|
|
const speedrun2025 = snapshot.observations.filter((o) => o.id.startsWith("SR25-O-"));
|
|
assert.ok(speedrun2025.every((o) =>
|
|
o.unit !== "USD" && !o.observedAt && o.comparisonGroup === null),
|
|
"access dates and dollar symbols must not invent dated USD income samples");
|
|
assert.deepEqual(speedrun2025.filter((o) => o.metric).map((o) => [o.id, o.metric]).sort(),
|
|
[["SR25-O-DRS-PORTFOLIO", "arr"], ["SR25-O-LOOPS-ARR", "arr"]],
|
|
"explicit company ARR claims retain their metric without inferring currency or reporting dates");
|
|
assert.ok(platformIncomeSample(snapshot, { windowDays: null }).points.every((point) =>
|
|
!point.observation.id.startsWith("SR25-O-")), "undated ARR claims never enter platform MRR comparisons");
|
|
});
|
|
|
|
// Retractions and forecasts must stay visible for review without becoming revenue signals.
|
|
test("retracted ARR and projected margins remain excluded", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const cluely = snapshot.companies.find((c) => c.name === "Cluely")!;
|
|
assert.equal(cluely.revenueStatus, "unknown");
|
|
assert.ok(snapshot.reviews.some((r) => r.company === "Cluely" && r.evidenceIds.includes("E100")));
|
|
const retracted = snapshot.observations.filter((o) => o.company === cluely.id);
|
|
assert.ok(retracted.length > 0);
|
|
assert.ok(retracted.every((o) => o.selection === "excluded"));
|
|
const forecast = snapshot.observations.find((o) => o.kind === "非GAAP毛利率预期")!;
|
|
assert.equal(forecast.selection, "excluded");
|
|
const peec = snapshot.companies.find((c) => c.name === "Peec AI")!;
|
|
assert.equal(peec.team, 100);
|
|
assert.equal(peec.teamBound, "≥");
|
|
const currentTeam = snapshot.observations.find((o) => o.id === "PEEC-JOB-TEAM")!;
|
|
assert.equal(currentTeam.value, peec.team);
|
|
assert.equal(currentTeam.bound, peec.teamBound);
|
|
const historicalTeam = snapshot.observations.find((o) => o.id === "O067")!;
|
|
assert.equal(historicalTeam.value, 70);
|
|
assert.equal(historicalTeam.bound, ">");
|
|
assert.equal(snapshot.observations.filter((o) => o.company === peec.id && o.selection === "signal").length, 1);
|
|
assert.ok(snapshot.observations.some((o) => o.company === peec.id && o.selection === "historical-estimate"));
|
|
});
|
|
|
|
test("directory coverage reconciles every candidate and keeps profile-only income unknown", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const coverage = snapshot.coverage!;
|
|
assert.equal(coverageAudit.records.length, coverage.candidateRecords);
|
|
assert.equal(new Set(coverageAudit.records.map((r) => r.ycId)).size, coverage.candidateRecords);
|
|
const count = (status: string) => coverageAudit.records.filter((r) => r.status === status).length;
|
|
assert.equal(count("imported"), coverage.newProfiles);
|
|
assert.equal(count("existing"), coverage.existingProfiles);
|
|
assert.equal(count("date-conflict"), coverage.dateConflicts);
|
|
assert.equal(count("year-outside-or-missing"), coverage.otherOrMissingYear);
|
|
assert.equal(count("ai-unclear"), coverage.unclearAI);
|
|
for (const row of coverageAudit.records.filter((r) => r.status === "imported")) {
|
|
const company = snapshot.companies.find((c) => c.id === `YC${row.ycId}`)!;
|
|
assert.ok(company.profileOnly || company.directoryOrigin === "yc-2025-2026");
|
|
assert.equal(company.url, row.source);
|
|
if (company.profileOnly) assert.equal(company.revenueStatus, "unknown");
|
|
if (company.id === "YC31370") {
|
|
assert.equal(row.foundedYear, 2025, "original discovery remains unchanged");
|
|
assert.equal(company.year, null, "a pivot year cannot settle the company founding year");
|
|
assert.ok(snapshot.reviews.some((review) => review.id === "DAYJOB-R-COHORT" && review.companyIds?.includes(company.id)));
|
|
} else if (company.id === "YC36279") {
|
|
assert.equal(row.foundedYear, 2026, "original Native discovery remains unchanged");
|
|
assert.equal(company.year, null, "a model launch and YC date cannot settle the older business founding year");
|
|
assert.ok(snapshot.reviews.some((review) => review.id === "NATIVE-R-COHORT" && review.companyIds?.includes(company.id)));
|
|
} else if (company.id === "YC31470") {
|
|
assert.equal(row.foundedYear, 2025, "original Tasklet discovery remains unchanged");
|
|
assert.equal(company.year, null, "a new product cannot establish a new company founding year");
|
|
assert.ok(snapshot.reviews.some((review) => review.id === "ENTERPRISE3-R-TASKLET" && review.companyIds?.includes(company.id)));
|
|
} else {
|
|
assert.equal(company.year, row.foundedYear);
|
|
assert.ok([2025, 2026].includes(company.year!));
|
|
}
|
|
}
|
|
const invalid = structuredClone(snapshot);
|
|
invalid.coverage!.newProfiles += 1;
|
|
assert.throws(() => validateResearch(invalid), /coverage accounting/);
|
|
const promoted = snapshot.companies.find((c) => c.id === "YC30215")!;
|
|
assert.equal(promoted.profileOnly, false);
|
|
assert.equal(promoted.directoryOrigin, "yc-2025-2026");
|
|
assert.equal(promoted.revenueStatus, "self");
|
|
const lostOrigin = structuredClone(snapshot);
|
|
delete lostOrigin.companies.find((c) => c.id === promoted.id)!.directoryOrigin;
|
|
assert.throws(() => validateResearch(lostOrigin), /coverage accounting/);
|
|
});
|
|
|
|
test("business pivots and procurement volume do not become comparable startup ARR", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const dayjob = snapshot.companies.find((company) => company.id === "YC31370")!;
|
|
assert.equal(dayjob.year, null);
|
|
assert.equal(dayjob.directoryOrigin, "yc-2025-2026");
|
|
const milestones = snapshot.observations.filter((observation) => observation.company === dayjob.id);
|
|
assert.deepEqual(milestones.filter((observation) => observation.selection === "crosscheck").map((observation) => observation.value).sort(), [496000, 653000]);
|
|
assert.ok(milestones.every((observation) => observation.comparisonGroup === null && !observation.metric && !observation.observedAt));
|
|
assert.ok(milestones.filter((observation) => [150000, 800000].includes(observation.value)).every((observation) => observation.selection === "excluded"));
|
|
const procurement = snapshot.observations.find((observation) => observation.id === "SAUDARA-O-SOURCING")!;
|
|
assert.equal(procurement.selection, "excluded");
|
|
assert.equal(procurement.comparisonGroup, null);
|
|
});
|
|
|
|
test("income descriptions report sample dispersion and maximum-value sensitivity", () => {
|
|
const stats = describeIncome([100, 200, 300])!;
|
|
assert.equal(stats.mean, 200);
|
|
assert.equal(stats.median, 200);
|
|
assert.equal(stats.sampleDeviation, 100);
|
|
assert.equal(stats.cv, .5);
|
|
assert.equal(stats.largestShare, .5);
|
|
assert.equal(stats.meanWithoutLargest, 150);
|
|
assert.equal(stats.largestRemovalDrop, .25);
|
|
assert.equal(describeIncome([5])!.cv, null);
|
|
assert.equal(describeIncome([0, 0])!.mean, 0, "observed zero is distinct from missing");
|
|
assert.equal(describeIncome([0, 0])!.cv, null);
|
|
assert.equal(describeIncome([]), null);
|
|
assert.equal(describeIncome([100, NaN]), null);
|
|
assert.equal(describeIncome([-1]), null);
|
|
assert.ok(describeIncome([1, 2, 100])!.largestRemovalDrop! > .95);
|
|
});
|
|
|
|
test("platform samples exclude stale data and keep ARR, estimates and collections separate", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const recent = platformIncomeSample(snapshot, { windowDays: 7 });
|
|
assert.equal(recent.points.length, 16);
|
|
assert.equal(recent.excluded.length, 4);
|
|
assert.ok(recent.points.every((p) => p.observation.metric === "mrr" && p.observation.selection === "platform"));
|
|
assert.deepEqual(new Set(recent.excluded.map((p) => p.observation.company)), new Set(["AI016", "MR013", "MR014", "MR017"]));
|
|
assert.ok(recent.points.some((p) => p.company.name === "TrackAI" && p.observation.connectionExpired), "dated recent value is not a claim of active connection");
|
|
const older = platformIncomeSample(snapshot, { windowDays: 90 });
|
|
assert.equal(older.points.length, 18);
|
|
assert.ok(older.points.some((p) => p.company.id === "AI016"));
|
|
assert.ok(!recent.points.some((p) => p.company.id === "MR017"));
|
|
assert.ok(older.points.some((p) => p.company.id === "MR017" && p.observation.connectionExpired),
|
|
"an expired connection retains its historical observation date in the wider window");
|
|
assert.equal(recent.points.find((p) => p.company.id === "MR018")?.value, 67864,
|
|
"an older Markdown cache must not replace or duplicate the later web snapshot");
|
|
assert.equal(recent.points.find((p) => p.company.id === "MR019")?.value, 65431,
|
|
"period-table revenue and revenue snapshots must not replace MRR");
|
|
const scaled = platformIncomeSample(snapshot, { windowDays: 7, annualize: true });
|
|
const monthlyGroups = groupIncome(recent.points);
|
|
const annualGroups = groupIncome(scaled.points);
|
|
for (const group of monthlyGroups) {
|
|
const annual = annualGroups.find((g) => g.key === group.key)!;
|
|
assert.ok(Math.abs(annual.stats.mean - group.stats.mean * 12) < 1e-6);
|
|
if (group.stats.cv !== null) assert.ok(Math.abs(annual.stats.cv! - group.stats.cv) < 1e-10);
|
|
}
|
|
const invalid = structuredClone(snapshot);
|
|
invalid.observations = invalid.observations.filter((o) => o.company === "MR001" && o.metric === "mrr");
|
|
const first = invalid.observations[0];
|
|
invalid.observations.push({ ...first, id: "future", observedAt: "2026-11-02", value: 999999 });
|
|
invalid.observations.push({ ...first, id: "bad-date", observedAt: "2026-02-30", value: 999999 });
|
|
invalid.observations.push({ ...first, id: "currency", unit: "EUR", value: 999999 });
|
|
invalid.observations.push({ ...first, id: "older", observedAt: "2026-10-28", value: 1 });
|
|
const selected = platformIncomeSample(invalid, { windowDays: 7 });
|
|
assert.equal(selected.points.length, 1);
|
|
assert.equal(selected.points[0].observation.id, first.id, "bad newer data and older duplicate must not replace latest valid point");
|
|
assert.equal(selected.excluded.length, 4);
|
|
assert.throws(() => platformIncomeSample(snapshot, { windowDays: -1 }), /window/);
|
|
});
|
|
|
|
test("distribution statistics match independently calculated snapshot references", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
assert.equal(incomeReference.sourceVersion, snapshot.version);
|
|
for (const reference of incomeReference.windows) {
|
|
const sample = platformIncomeSample(snapshot, { windowDays: reference.days });
|
|
assert.deepEqual(new Set(sample.points.map((p) => p.company.id)), new Set(reference.products));
|
|
const groups = groupIncome(sample.points);
|
|
assert.equal(groups.length, reference.groups.length);
|
|
for (const expected of reference.groups) {
|
|
const actual = groups.find((g) => g.category === expected.category && g.provider === expected.provider && g.model === expected.model)!;
|
|
assert.equal(actual.stats.n, expected.n);
|
|
for (const metric of ["mean", "median", "sampleDeviation", "cv", "meanWithoutLargest", "largestRemovalDrop"] as const) {
|
|
const value = expected[metric];
|
|
if (value === null) assert.equal(actual.stats[metric], null);
|
|
else assert.ok(Math.abs(actual.stats[metric]! - value) < 1e-6, metric);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
test("product launch candidates preserve unresolved years and many launches per company", () => {
|
|
const snapshot = structuredClone(seed) as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches![0];
|
|
assert.equal(batch.complete, false);
|
|
assert.equal(batch.records.length, 19);
|
|
const kilo = batch.records.filter((r) => r.companyId === "AI072");
|
|
assert.equal(kilo.length, 2, "IDE and hosted products resolve to one company");
|
|
assert.equal(snapshot.companies.filter((c) => c.id === "AI072").length, 1);
|
|
assert.ok(batch.records.some((r) => r.status === "pending-year" && !r.companyId));
|
|
assert.ok(batch.records.some((r) => r.status === "existing-outside-cohort" && r.companyId === "AI054"));
|
|
kilo[0].companyId = "missing-company";
|
|
assert.throws(() => validateResearch(snapshot), /research candidate/);
|
|
});
|
|
|
|
test("the public SR007 roster preserves unique entries and Alven's older operator conflict", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches!.find((item) => item.id === "SR007-public-roster-2026-1")!;
|
|
assert.equal(batch.complete, false, "one public default cohort is not all source coverage");
|
|
assert.equal(batch.records.length, 79);
|
|
assert.equal(new Set(batch.records.map((row) => row.url)).size, 79);
|
|
const alven = batch.records.find((row) => row.name === "Alven")!;
|
|
assert.equal(alven.status, "pending-year");
|
|
assert.equal(alven.companyId, undefined);
|
|
assert.ok(alven.evidenceIds?.includes("SR007R-ALVEN-REG"));
|
|
assert.ok(!snapshot.observations.some((item) => item.evidence.startsWith("SR007R-")),
|
|
"roster claims, deployment plans and per-unit prices are not new financial observations");
|
|
const coherence = batch.records.find((row) => row.name === "Coherence Health")!;
|
|
assert.equal(coherence.status, "pending-ai", "a new coaching business still needs current AI delivery evidence");
|
|
assert.equal(coherence.companyId, undefined);
|
|
const followup = snapshot.observations.filter((item) => item.id.startsWith("SR007F2-"));
|
|
assert.equal(followup.length, 4);
|
|
assert.ok(followup.every((item) => ["excluded", "adoption"].includes(item.selection) && !item.metric && !item.observedAt));
|
|
assert.ok(!arrDisclosures(snapshot).some(({ observation }) => observation.id.startsWith("SR007F2-")),
|
|
"contracted ARR and pipeline are not live ARR disclosures");
|
|
const thirdFollowup = snapshot.observations.filter((item) => item.id.startsWith("SR007F3-"));
|
|
assert.equal(thirdFollowup.length, 6);
|
|
assert.equal(thirdFollowup.filter((item) => item.selection === "excluded").length, 3);
|
|
assert.equal(thirdFollowup.filter((item) => item.selection === "adoption").length, 3);
|
|
assert.ok(thirdFollowup.every((item) => !item.metric && !item.observedAt));
|
|
assert.ok(!arrDisclosures(snapshot).some(({ observation }) => observation.id.startsWith("SR007F3-")),
|
|
"projected ARR, connected customer assets and prospective contracts are not realized ARR");
|
|
assert.equal(snapshot.companies.find((item) => item.id === "AI121")!.cat, "C02",
|
|
"training data and environments are infrastructure rather than demonstrated foundation models");
|
|
const embrasure = snapshot.companies.find((item) => item.id === "AI122")!;
|
|
assert.equal(embrasure.technicalReview!.level, "public-artifact");
|
|
assert.ok(embrasure.technicalReview!.evidenceIds.includes("SR007F3-EMBRASURE-FLOW"),
|
|
"the public connector supports artifact availability, not independently reproduced warehouse performance");
|
|
for (const name of ["KIRA", "Leonidas", "Mecone", "PhotonSpear"]) {
|
|
const candidate = batch.records.find((row) => row.name === name)!;
|
|
assert.equal(candidate.status, "pending-ai",
|
|
"serving AI customers or using software controls is not evidence of an AI business");
|
|
assert.equal(candidate.companyId, undefined);
|
|
}
|
|
const maestroClaims = arrDisclosures(snapshot).filter(({ company }) => company.id === "AI130");
|
|
assert.equal(maestroClaims.length, 2, "keep the two original ARR milestones in the evidence ledger");
|
|
assert.ok(maestroClaims.every(({ observation }) => observation.selection === "historical" &&
|
|
arrFieldGaps(observation, snapshot.asOf).includes("date") &&
|
|
arrFieldGaps(observation, snapshot.asOf).includes("currency")));
|
|
const cumulative = snapshot.observations.find((item) => item.id === "SR007F4-O-MAESTRO-CUMULATIVE")!;
|
|
assert.equal(cumulative.selection, "historical");
|
|
assert.equal(cumulative.metric, undefined, "nine-month cumulative revenue cannot become ARR");
|
|
const contracted = snapshot.observations.find((item) => item.id === "SR007F4-O-HOID-CONTRACT")!;
|
|
assert.equal(contracted.selection, "excluded");
|
|
assert.equal(contracted.metric, undefined, "contracted run rate is not realized ARR");
|
|
const openwhispr = snapshot.companies.find((item) => item.id === "AI135")!;
|
|
assert.equal(openwhispr.technicalReview!.level, "public-artifact");
|
|
assert.ok(openwhispr.technicalReview!.evidenceIds.includes("SR007F5-OPENWHISPR-REPO"));
|
|
const voiceArr = arrDisclosures(snapshot).find(({ company }) => company.id === openwhispr.id)!.observation;
|
|
assert.equal(voiceArr.value, 120000);
|
|
assert.equal(voiceArr.bound, "≥");
|
|
assert.ok(arrFieldGaps(voiceArr, snapshot.asOf).includes("date"));
|
|
assert.ok(arrFieldGaps(voiceArr, snapshot.asOf).includes("currency"),
|
|
"current plan prices cannot supply the currency of an undated investor ARR claim");
|
|
const voiceUsers = snapshot.observations.find((item) => item.id === "SR007F5-O-OPENWHISPR-DAU")!;
|
|
assert.equal(voiceUsers.selection, "adoption", "daily active users are not paying subscribers");
|
|
assert.equal(voiceUsers.metric, undefined);
|
|
const salesLive = snapshot.observations.find((item) => item.id === "SR007F6-O-OTHELLO-LIVE")!;
|
|
assert.equal(salesLive.metric, "arr");
|
|
assert.equal(salesLive.value, 600000, "live ARR must not include contracted ARR or pipeline");
|
|
for (const suffix of ["CONTRACT", "PIPELINE"]) {
|
|
const prospective = snapshot.observations.find((item) => item.id === `SR007F6-O-OTHELLO-${suffix}`)!;
|
|
assert.equal(prospective.selection, "excluded");
|
|
assert.equal(prospective.metric, undefined);
|
|
}
|
|
const professionalService = snapshot.observations.find((item) => item.id === "SR007F6-O-PARCA-RUNRATE")!;
|
|
assert.equal(professionalService.metric, "annualized-revenue");
|
|
assert.equal(professionalService.selection, "historical");
|
|
assert.ok(!arrDisclosures(snapshot).some(({ observation }) => observation.id === professionalService.id),
|
|
"annualized professional-service revenue is not recurring subscription ARR");
|
|
assert.equal(snapshot.companies.find((item) => item.id === "AI137")!.technicalReview!.level, "description",
|
|
"a preliminary external ranking with unresolved methodology is not complete independent verification");
|
|
const contractFollowup = snapshot.observations.filter((item) => item.id.startsWith("SR007F7-"));
|
|
assert.equal(contractFollowup.filter((item) => item.selection === "excluded").length, 4);
|
|
assert.equal(contractFollowup.filter((item) => item.selection === "adoption").length, 1);
|
|
assert.ok(contractFollowup.every((item) => !item.metric && !item.observedAt));
|
|
assert.ok(!arrDisclosures(snapshot).some(({ observation }) => observation.id.startsWith("SR007F7-")),
|
|
"contracted revenue and potential customers' active users cannot become realized ARR");
|
|
assert.equal(snapshot.companies.find((item) => item.id === "AI144")!.revenueStatus, "unknown",
|
|
"free current SDK terms and a contracted ARR claim need reconciliation before labeling realized revenue");
|
|
const scaledrive = batch.records.find((row) => row.name === "scaledrive.ai")!;
|
|
assert.equal(scaledrive.status, "outside-cohort", "SR007 membership cannot replace a stated 2024 founding year");
|
|
assert.equal(scaledrive.companyId, undefined);
|
|
assert.ok(scaledrive.evidenceIds?.includes("SR007F8-SCALEDRIVE-SR"));
|
|
for (const id of ["AI147", "AI150"]) {
|
|
assert.equal(snapshot.companies.find((item) => item.id === id)!.technicalReview!.level, "description",
|
|
"self-hosting and SDK documentation do not establish correctly attributed public source code");
|
|
assert.equal(snapshot.companies.find((item) => item.id === id)!.revenueStatus, "unknown");
|
|
}
|
|
assert.ok(!arrDisclosures(snapshot).some(({ observation }) => observation.id.startsWith("SR007F8-")),
|
|
"previous-company ARR and financial amounts in document demonstrations are not current revenue");
|
|
assert.equal(batch.records.filter((row) => row.status === "linked").length, 71);
|
|
assert.equal(batch.records.filter((row) => row.profileStatus === "archive-only").length, 0,
|
|
"all reused independent profiles have now been explicitly reread");
|
|
assert.equal(batch.records.filter((row) => row.profileStatus === "readable").length, 79);
|
|
const ninthFollowup = snapshot.observations.filter((item) => item.id.startsWith("SR007F9-"));
|
|
assert.equal(ninthFollowup.length, 10);
|
|
assert.equal(ninthFollowup.filter((item) => item.selection === "excluded").length, 6);
|
|
assert.equal(ninthFollowup.filter((item) => item.selection === "adoption").length, 3);
|
|
const industrialRunRate = ninthFollowup.find((item) => item.id === "SR007F9-O-VALENT-ANNUALIZED")!;
|
|
assert.equal(industrialRunRate.metric, "annualized-revenue");
|
|
assert.equal(industrialRunRate.selection, "historical");
|
|
assert.ok(ninthFollowup.every((item) => !item.observedAt),
|
|
"access dates and weeks since launch cannot supply precise financial dates");
|
|
assert.ok(ninthFollowup.filter((item) => item !== industrialRunRate).every((item) => !item.metric));
|
|
assert.ok(!arrDisclosures(snapshot).some(({ observation }) => observation.id.startsWith("SR007F9-")),
|
|
"annual contracts without fulfillment evidence, funding, annualized revenue and pipeline remain outside live ARR");
|
|
for (const id of ["AI152", "AI158"]) {
|
|
assert.equal(snapshot.companies.find((item) => item.id === id)!.revenueStatus, "unknown",
|
|
"contracted labels alone cannot establish realized revenue");
|
|
}
|
|
assert.equal(snapshot.companies.find((item) => item.id === "AI161")!.cat, "C02",
|
|
"enterprise workload model specialization is classified by delivery rather than frontier-model slogans");
|
|
const rereadProfiles = snapshot.evidence.filter((item) => item.id.startsWith("SR007F10-P-"));
|
|
assert.equal(rereadProfiles.length, 17);
|
|
assert.equal(new Set(rereadProfiles.map((item) => item.companyId)).size, 17);
|
|
for (const evidence of rereadProfiles) {
|
|
const candidate = batch.records.find((row) => row.companyId === evidence.companyId)!;
|
|
assert.equal(candidate.url, evidence.url);
|
|
assert.ok(candidate.evidenceIds?.includes(evidence.id), "each reread has an exact profile link");
|
|
}
|
|
assert.ok(!snapshot.observations.some((item) => item.id.startsWith("SR007F10-")),
|
|
"rereading existing financial milestones must not introduce duplicate observations");
|
|
for (const id of ["AI067", "AI069"]) {
|
|
assert.equal(snapshot.companies.find((item) => item.id === id)!.cat, "C02",
|
|
"current hosted-model and training-data delivery are infrastructure");
|
|
}
|
|
const oldWorkflowArr = snapshot.observations.find((item) => item.id === "SR-O-AI069-arr")!;
|
|
assert.equal(oldWorkflowArr.evidence, "SR-E-infragrid", "retain the original workflow revenue evidence");
|
|
assert.equal(oldWorkflowArr.value, 302000);
|
|
assert.equal(oldWorkflowArr.observedAt, undefined);
|
|
assert.ok(snapshot.companies.find((item) => item.id === "AI069")!.notes.includes("历史ARR归属不清"),
|
|
"a current category change must retain the unresolved historical product attribution");
|
|
});
|
|
|
|
test("public Speedrun cohort rosters preserve the finite boundary without inventing founding years", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const rosters = snapshot.candidateBatches!.filter((batch) => /^SR00[1-7]-public-roster-2026-1$/.test(batch.id));
|
|
assert.equal(rosters.length, 7);
|
|
for (const [index, count] of [25, 25, 32, 42, 59, 59, 79].entries()) {
|
|
const batch = rosters.find((item) => item.id.startsWith(`SR${String(index + 1).padStart(3, "0")}-`))!;
|
|
assert.equal(batch.records.length, count);
|
|
assert.equal(batch.complete, false, "a complete directory page is not completed company-level research");
|
|
}
|
|
const rows = rosters.flatMap((batch) => batch.records);
|
|
assert.equal(rows.length, 321);
|
|
assert.equal(new Set(rows.map((row) => row.url)).size, 321);
|
|
const newlyRegistered = rosters.filter((batch) => !batch.id.startsWith("SR007-")).flatMap((batch) => batch.records);
|
|
assert.equal(newlyRegistered.length, 242);
|
|
assert.equal(newlyRegistered.filter((row) => row.status === "pending-year").length, 5);
|
|
assert.equal(newlyRegistered.filter((row) => row.status === "linked").length, 68);
|
|
assert.equal(newlyRegistered.filter((row) => row.status === "existing-outside-cohort").length, 1);
|
|
assert.equal(newlyRegistered.filter((row) => row.status === "outside-cohort").length, 144);
|
|
assert.equal(newlyRegistered.filter((row) => row.status === "pending-ai").length, 24,
|
|
"a known self-reported founding year does not by itself establish the current AI business");
|
|
assert.equal(newlyRegistered.filter((row) => row.profileStatus === "readable").length, 232);
|
|
assert.ok(newlyRegistered.filter((row) => row.status === "outside-cohort").every((row) =>
|
|
row.profileStatus === "readable" && row.evidenceIds?.some((id) => (id.startsWith("SRALL1-P-") || id.startsWith("SRPRO1-P-")))),
|
|
"old founding years require independent profile evidence, not cohort age");
|
|
const variants = newlyRegistered.filter((row) => row.name === "Variant");
|
|
assert.equal(variants.length, 2);
|
|
assert.equal(new Set(variants.map((row) => row.url)).size, 2, "same-name profiles must not be merged by name");
|
|
assert.equal(variants.filter((row) => row.companyId === "AI066").length, 1);
|
|
assert.ok(!snapshot.observations.some((row) => row.evidence.startsWith("SRALL1-")),
|
|
"roster discovery and outside-cohort claims do not create financial observations");
|
|
const profiles = snapshot.evidence.filter((row) => row.id.startsWith("SRPRO1-P-"));
|
|
assert.equal(profiles.length, 226);
|
|
for (const proof of profiles) {
|
|
const candidate = newlyRegistered.find((row) => row.id === proof.id.slice("SRPRO1-P-".length))!;
|
|
assert.equal(candidate.url, proof.url);
|
|
assert.ok(candidate.evidenceIds?.includes(proof.id));
|
|
}
|
|
for (const id of ["AI162", "AI163", "AI164", "AI165", "AI166", "AI167"]) {
|
|
const company = snapshot.companies.find((row) => row.id === id)!;
|
|
assert.equal(company.year, 2025);
|
|
assert.equal(company.revenueStatus, "unknown");
|
|
assert.equal(company.technicalReview!.level, "description");
|
|
}
|
|
assert.ok(!snapshot.observations.some((row) => row.evidence.startsWith("SRPRO1-")),
|
|
"future GPU capacity, free trials, customer savings and unread financial claims are not realized revenue");
|
|
});
|
|
|
|
test("Speedrun brand dates and survey benchmark scores do not create new-company revenue", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const rows = snapshot.candidateBatches!.flatMap((batch) => batch.records);
|
|
for (const id of ["SR004R-C11", "SR004R-C20"]) {
|
|
const row = rows.find((item) => item.id === id)!;
|
|
assert.equal(row.status, "pending-year", "a known brand year must retain unresolved underlying entity dates");
|
|
assert.equal(row.companyId, undefined);
|
|
assert.ok(row.evidenceIds!.some((proof) => proof.startsWith("SR004F2-")));
|
|
}
|
|
for (const id of ["SR004R-C08", "SR004R-C15"]) {
|
|
assert.equal(rows.find((item) => item.id === id)!.status, "pending-ai");
|
|
}
|
|
for (const [id, category] of [["AI168", "C06"], ["AI169", "C05"]]) {
|
|
const company = snapshot.companies.find((item) => item.id === id)!;
|
|
assert.equal(company.cat, category);
|
|
assert.equal(company.revenueStatus, "unknown");
|
|
assert.equal(company.technicalReview!.level, "description");
|
|
}
|
|
assert.ok(!snapshot.observations.some((row) => row.evidence.startsWith("SR004F2-")),
|
|
"brand-deal opportunities, listed fees and survey agreement are not financial observations");
|
|
const model = snapshot.reviews.find((row) => row.id === "MODEL1-SIMULATION-PANEL")!;
|
|
assert.deepEqual(reviewCompanyIds(snapshot, model), ["AI169"]);
|
|
assert.ok(model.evidenceIds.includes("SR004F2-REHEARSALS-PRICE"));
|
|
});
|
|
|
|
test("recruiting service adoption and official balance sheets do not become ARR", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
for (const id of ["AI170", "AI171", "AI172", "AI173", "AI174", "AI175"]) {
|
|
const company = snapshot.companies.find((row) => row.id === id)!;
|
|
assert.equal(company.year, 2025);
|
|
assert.equal(company.revenueStatus, "unknown");
|
|
assert.equal(company.technicalReview!.level, "description");
|
|
}
|
|
const accounts = snapshot.evidence.find((row) => row.id === "SR005F3-DEX-ACCOUNTS")!;
|
|
assert.equal(accounts.companyId, "AI171");
|
|
assert.equal(new URL(accounts.url).hostname, "find-and-update.company-information.service.gov.uk");
|
|
assert.equal(accounts.publishedAt, "2026-09-08", "filing date is preserved without becoming a revenue measurement date");
|
|
assert.ok(!snapshot.observations.some((row) => row.evidence.startsWith("SR005F3-")),
|
|
"balance-sheet cash, client quotes, salaries and recruiting outcomes do not disclose revenue");
|
|
const model = snapshot.reviews.find((row) => row.id === "MODEL1-RECRUITING-SERVICE")!;
|
|
assert.deepEqual(reviewCompanyIds(snapshot, model), ["AI175", "AI171"]);
|
|
assert.ok(model.evidenceIds.includes("SR005F3-JOOBA-TERMS"));
|
|
});
|
|
|
|
test("current products preserve unresolved identity and separate trading from software revenue", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const presia = snapshot.candidateBatches!.flatMap((batch) => batch.records)
|
|
.find((row) => row.id === "SR005R-C44")!;
|
|
assert.equal(presia.status, "pending-ai");
|
|
assert.equal(presia.companyId, undefined, "a reused domain does not resolve a changed business entity");
|
|
assert.ok(presia.evidenceIds!.includes("SR005F4-PRESIA-ASSET"));
|
|
for (const id of ["AI176", "AI177", "AI178", "AI179", "AI180"]) {
|
|
const company = snapshot.companies.find((row) => row.id === id)!;
|
|
assert.equal(company.revenueStatus, "unknown");
|
|
}
|
|
const syzygy = snapshot.companies.find((row) => row.id === "AI180")!;
|
|
assert.equal(syzygy.technicalReview!.level, "public-artifact");
|
|
assert.ok(syzygy.technicalReview!.evidenceIds.includes("SR005F4-SYZYGY-FILES"));
|
|
assert.ok(!snapshot.observations.some((row) => row.evidence.startsWith("SR005F4-")),
|
|
"landed prices, customer savings, model scores and listed subscriptions are not reported ARR");
|
|
const supply = snapshot.reviews.find((row) => row.id === "MODEL1-PHYSICAL-SUPPLY")!;
|
|
assert.deepEqual(reviewCompanyIds(snapshot, supply), ["AI179"]);
|
|
assert.ok(snapshot.reviews.find((row) => row.id === "MODEL1-LOCAL-CLOUD")!.companyIds!.includes("AI180"));
|
|
});
|
|
|
|
test("new founding-year reports retain beta, academic and self-reported enforcement boundaries", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
for (const id of ["AI181", "AI182", "AI184", "AI185", "AI186"]) {
|
|
const company = snapshot.companies.find((row) => row.id === id)!;
|
|
assert.equal(company.year, 2026);
|
|
assert.equal(company.revenueStatus, "unknown");
|
|
assert.equal(company.technicalReview!.level, "description");
|
|
}
|
|
assert.equal(snapshot.companies.find((row) => row.id === "AI183")!.year, 2025);
|
|
assert.ok(!snapshot.observations.some((row) => row.evidence.startsWith("SR006F5-")),
|
|
"trial credits, customer revenue impact, demonstration fundraises and normalized research scores are not ARR");
|
|
const research = snapshot.reviews.find((row) => row.id === "SR006F5-R-RESEARCH")!;
|
|
assert.deepEqual(reviewCompanyIds(snapshot, research), ["AI185", "AI169"]);
|
|
assert.ok(research.evidenceIds.includes("SR004F2-REHEARSALS-BENCH"));
|
|
const pricing = snapshot.reviews.find((row) => row.id === "MODEL1-MESSAGE-ENFORCEMENT")!;
|
|
assert.deepEqual(reviewCompanyIds(snapshot, pricing), ["AI186"]);
|
|
assert.ok(pricing.evidenceIds.includes("SR006F5-ZERODRIFT-TERMS"));
|
|
});
|
|
|
|
test("rebrands and ambiguous monthly receipts stay outside comparable ARR", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const rows = snapshot.candidateBatches!.flatMap((batch) => batch.records);
|
|
for (const id of ["SR006R-C37", "SR006R-C54"]) {
|
|
const row = rows.find((item) => item.id === id)!;
|
|
assert.equal(row.status, "pending-year");
|
|
assert.equal(row.companyId, undefined, "brand dates must not overwrite existing legal-entity dates");
|
|
}
|
|
const idilio = rows.find((item) => item.id === "SR006R-C22")!;
|
|
assert.equal(idilio.status, "pending-ai");
|
|
assert.ok(idilio.evidenceIds!.includes("SR006F6-IDILIO-SR"));
|
|
assert.ok(!snapshot.observations.some((row) => row.evidence.startsWith("SR006F6-")),
|
|
"pipeline, retained client revenue, illustrative tax values and undated monthly receipts are not comparable ARR");
|
|
for (const id of ["AI187", "AI188", "AI189"]) {
|
|
assert.equal(snapshot.companies.find((row) => row.id === id)!.revenueStatus, "unknown");
|
|
}
|
|
const tax = snapshot.reviews.find((row) => row.id === "MODEL1-TAX-PREP")!;
|
|
assert.deepEqual(reviewCompanyIds(snapshot, tax), ["AI188"]);
|
|
assert.ok(tax.evidenceIds.includes("SR006F6-GROVE-PRICE"));
|
|
});
|
|
|
|
test("care and legal delivery preserve financial exclusions and linked cost reviews", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
for (const id of ["AI190", "AI191", "AI192", "AI193", "AI194", "AI195"]) {
|
|
const company = snapshot.companies.find((row) => row.id === id)!;
|
|
assert.equal(company.revenueStatus, "unknown");
|
|
assert.equal(company.technicalReview!.level, "description");
|
|
const candidate = snapshot.candidateBatches!.flatMap((batch) => batch.records)
|
|
.find((row) => row.companyId === id)!;
|
|
assert.equal(candidate.status, "linked");
|
|
assert.equal(candidate.categoryId, company.cat);
|
|
assert.ok(company.evidenceIds.every((proof) => snapshot.evidence.some((row) => row.id === proof && row.companyId === id)));
|
|
}
|
|
assert.ok(!snapshot.observations.some((row) => row.evidence.startsWith("SRCARE1-")),
|
|
"undefined annual run rate, customer savings, list prices and usage are not comparable ARR");
|
|
const hardware = snapshot.reviews.find((row) => row.id === "MODEL1-HARDWARE-LIFETIME")!;
|
|
assert.deepEqual(reviewCompanyIds(snapshot, hardware), ["AI195"]);
|
|
const clinical = snapshot.reviews.find((row) => row.id === "MODEL1-CARE-OPERATIONS")!;
|
|
assert.deepEqual(reviewCompanyIds(snapshot, clinical), ["AI191", "AI194"]);
|
|
});
|
|
|
|
test("enterprise contracts and launch-year conflicts retain their exclusions", () => {
|
|
const snapshot = structuredClone(seed) as ResearchSnapshot;
|
|
const accelerator = snapshot.candidateBatches!.flatMap((batch) => batch.records)
|
|
.find((row) => row.id === "SR006R-C01")!;
|
|
assert.equal(accelerator.status, "pending-year");
|
|
assert.equal(accelerator.companyId, undefined);
|
|
assert.ok(accelerator.evidenceIds!.includes("SRENTER1-ACCELER8-DEALROOM"));
|
|
for (const [id, value, bound] of [["HEAVI", 100000, "="], ["VERRA", 700000, "≈"]] as const) {
|
|
const contract = snapshot.observations.find((row) => row.id === `SRENTER1-O-${id}-CONTRACT`)!;
|
|
assert.equal(contract.value, value);
|
|
assert.equal(contract.bound, bound);
|
|
assert.equal(contract.selection, "excluded");
|
|
assert.equal(contract.observedAt, undefined);
|
|
assert.equal(contract.comparisonGroup, null);
|
|
assert.equal(snapshot.companies.find((row) => row.id === contract.company)!.revenueStatus, "unknown");
|
|
contract.metric = "arr";
|
|
assert.ok(!arrDisclosures(snapshot).some((row) => row.observation.id === contract.id),
|
|
"even a wrongly added ARR label must not promote an excluded contract");
|
|
assert.ok(!platformIncomeSample(snapshot, { windowDays: 90 }).points
|
|
.some((row) => row.observation.id === contract.id));
|
|
}
|
|
});
|
|
|
|
test("financial candidates need current AI evidence before they acquire company and income links", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const candidates = snapshot.candidateBatches!.flatMap((batch) => batch.records);
|
|
for (const id of ["SR006R-C06", "SR006R-C16", "SR005R-C35", "SR006R-C08"]) {
|
|
const candidate = candidates.find((row) => row.id === id)!;
|
|
assert.equal(candidate.status, "pending-ai");
|
|
assert.equal(candidate.companyId, undefined);
|
|
assert.ok(candidate.evidenceIds!.some((proof) => proof.startsWith("SRFIN1-")));
|
|
}
|
|
const financial = snapshot.reviews.find((row) => row.id === "MODEL1-FINANCIAL-OPERATIONS")!;
|
|
assert.deepEqual(reviewCompanyIds(snapshot, financial), ["AI202", "AI203", "AI204"]);
|
|
assert.ok(!snapshot.observations.some((row) => row.evidence.startsWith("SRFIN1-")),
|
|
"bank size, FX processing, artist revenue, demo portfolios and benchmark scores are not vendor income");
|
|
});
|
|
|
|
test("annual launch archives exclude older companies only with evidence and reuse existing records", () => {
|
|
const snapshot = structuredClone(seed) as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches!.find((b) => b.id === "PH-2025-visible-1")!;
|
|
assert.equal(batch.complete, false);
|
|
assert.equal(batch.records.length, 19);
|
|
const older = batch.records.filter((r) => r.status === "outside-cohort");
|
|
assert.equal(older.length, 16);
|
|
assert.ok(older.every((r) => !r.companyId && r.evidenceIds?.length));
|
|
assert.equal(batch.records.find((r) => r.name === "Trace")?.companyId, "YC30687");
|
|
const trace = snapshot.companies.find((c) => c.id === "YC30687")!;
|
|
assert.equal(trace.profileOnly, false);
|
|
assert.equal(trace.directoryOrigin, "yc-2025-2026");
|
|
assert.equal(trace.revenueStatus, "unknown");
|
|
assert.ok(!snapshot.observations.some((o) => o.evidence === "TRACE-HOME"), "demo metrics must not become reported results");
|
|
older[0].evidenceIds = [];
|
|
assert.throws(() => validateResearch(snapshot), /research candidate/);
|
|
older[0].evidenceIds = ["missing-proof"];
|
|
assert.throws(() => validateResearch(snapshot), /research candidate/);
|
|
});
|
|
|
|
test("unreconciled directory financials remain source reviews instead of income observations", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const review = snapshot.reviews.find((r) => r.id === "PH-R-SOURCE-QUALITY")!;
|
|
assert.equal(review.scope, "dataset");
|
|
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, 136);
|
|
});
|
|
|
|
test("product pivots and founder histories do not become new company years or current revenue", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const pivot = snapshot.companies.find((c) => c.id === "AI073")!;
|
|
assert.equal(pivot.year, null, "CRM launch is not a verified company founding year");
|
|
assert.equal(pivot.revenueStatus, "unknown");
|
|
const candidate = snapshot.candidateBatches!.flatMap((b) => b.records).find((r) => r.id === "PH26-11")!;
|
|
assert.equal(candidate.status, "existing-outside-cohort");
|
|
assert.equal(candidate.companyId, pivot.id);
|
|
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");
|
|
const candidates = snapshot.candidateBatches!.flatMap((b) => b.records);
|
|
assert.equal(candidates.find((r) => r.id === "PH26-12")?.status, "outside-cohort",
|
|
"a brand iteration with an earlier business chain is not a new company");
|
|
const happycapy = candidates.find((r) => r.id === "PH26-04")!;
|
|
assert.ok(happycapy.evidenceIds?.includes("FOLLOWUP-CAPY-ACRA"));
|
|
assert.equal(happycapy.status, "pending-year", "a seller's registration does not establish a new global business");
|
|
assert.equal(happycapy.companyId, undefined);
|
|
assert.ok(!snapshot.observations.some((o) => o.evidence.startsWith("FOLLOWUP-")),
|
|
"registration, funding, app-store prices and client amounts are not company income");
|
|
});
|
|
|
|
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/);
|
|
});
|
|
|
|
test("AI relevance follow-ups retain unresolved businesses and reuse existing company identities", () => {
|
|
const snapshot = structuredClone(seed) as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches!.find((b) => b.id === "YC-AI-UNCLEAR-1")!;
|
|
assert.equal(batch.complete, false);
|
|
assert.equal(batch.records.length, 24);
|
|
const original = coverageAudit.records.filter((r) => r.status === "ai-unclear").slice(0, 24);
|
|
assert.deepEqual(batch.records.map((r) => r.url), original.map((r) => r.source));
|
|
const linked = batch.records.filter((r) => r.status === "linked");
|
|
assert.equal(linked.length, 17);
|
|
assert.equal(linked.filter((r) => r.companyId!.startsWith("YC")).length, 14);
|
|
for (const [name, id] of [["Bud", "AI070"], ["Prism", "AI030"], ["Parametric", "AI014"]]) {
|
|
assert.equal(linked.find((r) => r.name === name)?.companyId, id);
|
|
}
|
|
assert.equal(snapshot.companies.filter((c) => c.profileOnly || c.directoryOrigin === "yc-2025-2026").length, 928);
|
|
for (const row of linked) {
|
|
const ycId = Number(row.id.replace("YC-AI1-", ""));
|
|
assert.equal(snapshot.directoryRechecks!.find((r) => r.ycId === ycId)?.companyId, row.companyId);
|
|
}
|
|
const pending = batch.records.filter((r) => r.status === "pending-ai");
|
|
assert.equal(pending.length, 7);
|
|
assert.ok(pending.every((r) => !r.companyId && r.evidenceIds!.length && /2025/.test(r.note)));
|
|
assert.match(pending.find((r) => r.name === "Better Auth")!.note, /AI.*模块/);
|
|
validateResearch(snapshot);
|
|
pending[0].companyId = "AI014";
|
|
assert.throws(() => validateResearch(snapshot), /research candidate/);
|
|
delete pending[0].companyId;
|
|
pending[0].evidenceIds = [];
|
|
assert.throws(() => validateResearch(snapshot), /research candidate/);
|
|
});
|
|
|
|
test("historical monthly revenue and customer examples do not enter recurring platform comparisons", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const monthly = snapshot.observations.find((o) => o.id === "UNCLEAR1-O-SCALAR-MONTHLY")!;
|
|
assert.equal(monthly.value, 74000);
|
|
assert.equal(monthly.selection, "historical");
|
|
assert.equal(monthly.metric, undefined, "monthly revenue alone does not establish MRR or ARR");
|
|
assert.equal(monthly.comparisonGroup, null);
|
|
assert.equal(snapshot.companies.find((c) => c.id === "YC30514")!.revenueStatus, "self");
|
|
for (const id of ["AMBY-CLIENT", "NIXO-EXAMPLE", "AUTOSTEP-WASTE"]) {
|
|
assert.equal(snapshot.observations.find((o) => o.id === `UNCLEAR1-O-${id}`)!.selection, "excluded");
|
|
}
|
|
assert.ok(!platformIncomeSample(snapshot, { windowDays: null }).points.some((p) => p.observation.id.startsWith("UNCLEAR1-")));
|
|
const cua = snapshot.companies.find((c) => c.id === "YC30420")!;
|
|
assert.equal(cua.cat, "C03");
|
|
assert.equal(cua.revenueStatus, "unknown");
|
|
assert.match(cua.businessModel!, /自备计算机/);
|
|
assert.equal(cua.technicalReview!.level, "public-artifact");
|
|
});
|
|
|
|
test("a second uncertain cohort admits evidenced AI tasks while preserving autonomy and finance gaps", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches!.find((b) => b.id === "YC-AI-UNCLEAR-2")!;
|
|
const original = coverageAudit.records.filter((r) => r.status === "ai-unclear").slice(24, 48);
|
|
assert.equal(batch.complete, false);
|
|
assert.deepEqual(batch.records.map((r) => r.url), original.map((r) => r.source));
|
|
assert.equal(batch.records.filter((r) => r.status === "linked").length, 14);
|
|
assert.equal(batch.records.filter((r) => r.status === "pending-ai").length, 10);
|
|
for (const name of ["Albacore Inc.", "Perseus Defense", "Munify", "Ruvo"]) {
|
|
const row = batch.records.find((r) => r.name === name)!;
|
|
assert.equal(row.status, "pending-ai");
|
|
assert.equal(row.companyId, undefined, "autonomy, a domain or finance automation alone is insufficient");
|
|
assert.ok(row.evidenceIds!.length);
|
|
}
|
|
const signals = snapshot.companies.find((c) => c.id === "YC30639")!;
|
|
assert.equal(signals.year, 2026, "retain the company year instead of assigning the batch's majority year");
|
|
assert.equal(signals.cat, "C06");
|
|
assert.equal(snapshot.companies.find((c) => c.id === "YC30846")!.cat, "C03");
|
|
assert.match(snapshot.companies.find((c) => c.id === "YC30821")!.business, /远端推理/);
|
|
assert.equal(snapshot.companies.find((c) => c.id === "YC30933")!.technicalReview!.level, "description",
|
|
"vendor clinical agreement is not an independent validation");
|
|
const amounts = snapshot.observations.filter((o) => o.id.startsWith("UNCLEAR2-"));
|
|
assert.equal(amounts.length, 8);
|
|
assert.ok(amounts.every((o) => ["excluded", "adoption"].includes(o.selection) && !o.metric && o.comparisonGroup === null));
|
|
assert.equal(amounts.find((o) => o.id.endsWith("WARDSTONE-GRANT"))!.selection, "excluded");
|
|
assert.equal(amounts.find((o) => o.id.endsWith("SOLVA-OLD-PREMIUM"))!.selection, "excluded");
|
|
assert.ok(batch.records.filter((r) => r.companyId).every((r) => snapshot.companies.find((c) => c.id === r.companyId)!.revenueStatus === "unknown"));
|
|
assert.ok(!platformIncomeSample(snapshot, { windowDays: null }).points.some((p) => p.observation.id.startsWith("UNCLEAR2-")));
|
|
});
|
|
|
|
test("the third uncertain cohort retains shutdowns, unknown scale and mixed data-service economics", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches!.find((b) => b.id === "YC-AI-UNCLEAR-3")!;
|
|
const original = coverageAudit.records.filter((r) => r.status === "ai-unclear").slice(48, 72);
|
|
assert.equal(batch.complete, false);
|
|
assert.deepEqual(batch.records.map((r) => r.url), original.map((r) => r.source));
|
|
assert.equal(batch.records.filter((r) => r.status === "linked").length, 15);
|
|
assert.equal(batch.records.filter((r) => r.status === "pending-ai").length, 9);
|
|
for (const name of ["Mirabelle", "Kyten Technologies"]) {
|
|
assert.equal(batch.records.find((r) => r.name === name)!.companyId, undefined);
|
|
}
|
|
const klaus = snapshot.companies.find((c) => c.id === "YC31084")!;
|
|
assert.equal(klaus.revenueStatus, "unknown", "a shutdown must not manufacture a zero revenue report");
|
|
assert.match(klaus.stage, /2026-09-01停服/);
|
|
assert.ok(!snapshot.observations.some((o) => o.company === klaus.id));
|
|
const openspec = snapshot.companies.find((c) => c.id === "YC31116")!;
|
|
assert.equal(openspec.team, null, "missing staff count stays unknown");
|
|
assert.equal(openspec.year, 2025, "a license copyright line alone is not a company founding date");
|
|
assert.equal(openspec.technicalReview!.level, "public-artifact");
|
|
assert.match(snapshot.companies.find((c) => c.id === "YC31095")!.businessModel!, /清洁/);
|
|
const figures = snapshot.observations.filter((o) => o.id.startsWith("UNCLEAR3-"));
|
|
assert.equal(figures.length, 8);
|
|
assert.ok(figures.every((o) => ["excluded", "adoption"].includes(o.selection) && !o.metric && o.comparisonGroup === null));
|
|
assert.equal(figures.find((o) => o.id.endsWith("SHORTKIT-OLD-ARR"))!.selection, "excluded");
|
|
assert.equal(figures.find((o) => o.id.endsWith("KALPA-TRAIN-COST"))!.selection, "excluded");
|
|
assert.ok(!platformIncomeSample(snapshot, { windowDays: null }).points.some((p) => p.observation.id.startsWith("UNCLEAR3-")));
|
|
});
|
|
|
|
test("the fourth uncertain cohort distinguishes product pivots, managed labor and pass-through money", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches!.find((b) => b.id === "YC-AI-UNCLEAR-4")!;
|
|
const original = coverageAudit.records.filter((r) => r.status === "ai-unclear").slice(72, 96);
|
|
assert.equal(batch.complete, false);
|
|
assert.deepEqual(batch.records.map((r) => r.url), original.map((r) => r.source));
|
|
assert.equal(batch.records.filter((r) => r.status === "linked").length, 15);
|
|
assert.equal(batch.records.filter((r) => r.status === "pending-ai").length, 9);
|
|
assert.equal(batch.records.find((r) => r.name === "Orthogonal")!.companyId, "AI036");
|
|
assert.equal(snapshot.companies.filter((c) => c.url.endsWith("/companies/orthogonal")).length, 1);
|
|
const fern = snapshot.companies.find((c) => c.id === "YC31152")!;
|
|
assert.equal(fern.cat, "C02");
|
|
assert.match(fern.notes, /会议/);
|
|
const mocha = snapshot.companies.find((c) => c.id === "YC31269")!;
|
|
assert.equal(mocha.year, 2026);
|
|
assert.match(mocha.businessModel!, /人工/);
|
|
assert.match(mocha.price, /Platform.*Managed/);
|
|
assert.match(mocha.notes, /Coming soon/);
|
|
const figures = snapshot.observations.filter((o) => o.id.startsWith("UNCLEAR4-"));
|
|
assert.equal(figures.length, 7);
|
|
assert.ok(figures.every((o) => ["excluded", "adoption"].includes(o.selection) && !o.metric && o.comparisonGroup === null));
|
|
for (const suffix of ["LAURENCE-ADSPEND", "EKPA-CONNECTED-ASSETS", "REGBASE-CLIENT-GRANTS", "MOCHA-FUNDING"]) {
|
|
assert.equal(figures.find((o) => o.id.endsWith(suffix))!.selection, "excluded");
|
|
}
|
|
assert.equal(snapshot.companies.find((c) => c.id === "YC31199")!.technicalReview!.level, "public-artifact");
|
|
assert.ok(!platformIncomeSample(snapshot, { windowDays: null }).points.some((p) => p.observation.id.startsWith("UNCLEAR4-")));
|
|
});
|
|
|
|
test("the fifth uncertain cohort separates dated ARR, service run rates, bookings and previous ventures", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches!.find((b) => b.id === "YC-AI-UNCLEAR-5")!;
|
|
const original = coverageAudit.records.filter((r) => r.status === "ai-unclear").slice(96, 120);
|
|
assert.equal(batch.complete, false);
|
|
assert.deepEqual(batch.records.map((r) => r.url), original.map((r) => r.source));
|
|
assert.equal(batch.records.filter((r) => r.status === "linked").length, 17);
|
|
assert.equal(batch.records.filter((r) => r.status === "pending-ai").length, 7);
|
|
assert.equal(batch.records.find((r) => r.name === "primitive")!.companyId, "AI002");
|
|
assert.equal(batch.records.find((r) => r.name === "Result")!.companyId, "AI001");
|
|
const result = snapshot.companies.find((c) => c.id === "AI001")!;
|
|
assert.equal(result.cat, "C09");
|
|
assert.equal(result.revenueStatus, "unknown");
|
|
assert.match(result.notes, /280万美元ARR属于用户/);
|
|
assert.ok(result.evidenceIds.includes("UNCLEAR5-31438-TERMS"));
|
|
const andco = snapshot.companies.find((c) => c.id === "YC31411")!;
|
|
assert.equal(andco.year, 2026, "a founder's previous venture must not replace the new company's stated year");
|
|
assert.match(andco.notes, /Layup/);
|
|
assert.equal(snapshot.evidence.find((e) => e.id === "UNCLEAR5-31411-LAUNCH6")!.companyId, null);
|
|
const figures = snapshot.observations.filter((o) => o.id.startsWith("UNCLEAR5-"));
|
|
assert.equal(figures.length, 18);
|
|
const dated = figures.find((o) => o.id.endsWith("TRELLIS-ARR-AUG"))!;
|
|
assert.equal(dated.metric, "arr");
|
|
assert.equal(dated.observedAt, undefined, "a page maintenance date is not a financial cutoff");
|
|
assert.ok(arrFieldGaps(dated, snapshot.asOf).includes("date"));
|
|
assert.equal(dated.bound, "≥");
|
|
assert.equal(figures.find((o) => o.id.endsWith("INSTA-RUNRATE"))!.metric, "annualized-revenue");
|
|
assert.equal(figures.find((o) => o.id.endsWith("INSTA-LAUNCH-ARR"))!.metric, "arr");
|
|
for (const suffix of ["PARROT-CONTRACT", "KINRO-OLD-CONTRACT", "BENTO-OLD-EMPLOYER", "TRELLIS-OLD-MGMT"]) {
|
|
assert.equal(figures.find((o) => o.id.endsWith(suffix))!.selection, "excluded");
|
|
}
|
|
assert.equal(snapshot.companies.find((c) => c.id === "YC31423")!.technicalReview!.level, "description",
|
|
"an internal benchmark subset is not an independent leaderboard result");
|
|
assert.ok(figures.every((o) => o.comparisonGroup === null));
|
|
assert.ok(!platformIncomeSample(snapshot, { windowDays: null }).points.some((p) => p.observation.id.startsWith("UNCLEAR5-")));
|
|
});
|
|
|
|
test("the sixth uncertain cohort preserves namesakes, churn and historical robotics MRR", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches!.find((b) => b.id === "YC-AI-UNCLEAR-6")!;
|
|
const original = coverageAudit.records.filter((r) => r.status === "ai-unclear").slice(120, 144);
|
|
assert.equal(batch.complete, false);
|
|
assert.deepEqual(batch.records.map((r) => r.url), original.map((r) => r.source));
|
|
assert.equal(batch.records.filter((r) => r.status === "linked").length, 13);
|
|
assert.equal(batch.records.filter((r) => r.status === "pending-ai").length, 11);
|
|
const hera = snapshot.companies.find((c) => c.id === "YC32123")!;
|
|
const videoHera = snapshot.companies.find((c) => c.id === "AI025")!;
|
|
assert.equal(hera.cat, "C07");
|
|
assert.equal(hera.year, 2026);
|
|
assert.equal(videoHera.cat, "C08");
|
|
assert.equal(videoHera.year, 2025);
|
|
assert.notEqual(hera.url, videoHera.url, "same-name products with different YC pages must not be merged");
|
|
for (const name of ["Aernata", "Maquoketa Research", "Fire Wallet", "Eden Robotics", "Edgerun"]) {
|
|
const row = batch.records.find((r) => r.name === name)!;
|
|
assert.equal(row.status, "pending-ai");
|
|
assert.equal(row.companyId, undefined, "historical AI products, agent features and autonomous hardware need current-core evidence");
|
|
}
|
|
const figures = snapshot.observations.filter((o) => o.id.startsWith("UNCLEAR6-"));
|
|
assert.equal(figures.length, 13);
|
|
const churn = figures.find((o) => o.id.endsWith("ARDENT-CHURN"))!;
|
|
assert.equal(churn.selection, "excluded");
|
|
assert.equal(churn.metric, undefined, "lost ARR is not a positive current ARR observation");
|
|
assert.equal(snapshot.companies.find((c) => c.id === "YC31475")!.revenueStatus, "unknown");
|
|
const mrr = figures.find((o) => o.id.endsWith("AVEA-MRR"))!;
|
|
assert.equal(mrr.value, 18000);
|
|
assert.equal(mrr.metric, "mrr");
|
|
assert.equal(mrr.selection, "historical");
|
|
assert.match(mrr.unit, /无币种/);
|
|
assert.match(snapshot.companies.find((c) => c.id === "YC31530")!.notes, /Acquired/);
|
|
for (const suffix of ["PLAN0-PROJECTS-YC", "PLAN0-PROJECTS-LAUNCH", "SILMARIL-DAMAGE-YC", "SILMARIL-DAMAGE-CASE1", "SILMARIL-DAMAGE-CASE2", "EXPANSE-WASTE"]) {
|
|
assert.equal(figures.find((o) => o.id.endsWith(suffix))!.selection, "excluded");
|
|
}
|
|
const openwork = snapshot.companies.find((c) => c.id === "YC31505")!;
|
|
assert.equal(openwork.technicalReview!.level, "public-artifact");
|
|
assert.ok(openwork.technicalReview!.evidenceIds.includes("UNCLEAR6-31505-EE-LICENSE"));
|
|
assert.match(openwork.notes, /桌面MIT与ee目录/);
|
|
assert.ok(figures.every((o) => o.comparisonGroup === null));
|
|
assert.ok(!platformIncomeSample(snapshot, { windowDays: null }).points.some((p) => p.observation.id.startsWith("UNCLEAR6-")));
|
|
});
|
|
|
|
test("the seventh uncertain cohort separates hardware sales, prepayments and bounded verification", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches!.find((b) => b.id === "YC-AI-UNCLEAR-7")!;
|
|
const original = coverageAudit.records.filter((r) => r.status === "ai-unclear").slice(144, 168);
|
|
assert.equal(batch.complete, false);
|
|
assert.deepEqual(batch.records.map((r) => r.url), original.map((r) => r.source));
|
|
assert.equal(batch.records.filter((r) => r.status === "linked").length, 16);
|
|
assert.equal(batch.records.filter((r) => r.status === "pending-ai").length, 8);
|
|
const robotNori = snapshot.companies.find((c) => c.id === "YC32553")!;
|
|
const healthNori = snapshot.companies.find((c) => c.id === "YC30657")!;
|
|
assert.equal(robotNori.cat, "C10");
|
|
assert.equal(healthNori.cat, "C09");
|
|
assert.notEqual(robotNori.url, healthNori.url, "same-name hardware and health companies retain distinct identities");
|
|
assert.equal(batch.records.find((r) => r.name === "Nori")!.companyId, robotNori.id);
|
|
const figures = snapshot.observations.filter((o) => o.id.startsWith("UNCLEAR7-"));
|
|
assert.equal(figures.length, 18);
|
|
const sales = figures.find((o) => o.id.endsWith("NORI-SALES"))!;
|
|
assert.equal(sales.value, 440000);
|
|
assert.equal(sales.selection, "historical");
|
|
assert.equal(sales.metric, undefined, "hardware sales with unverified preorder/delivery mix must not become ARR");
|
|
assert.match(snapshot.companies.find((c) => c.id === "YC32164")!.price!, /额度/);
|
|
for (const suffix of ["GUT-PHARMACY", "MANIFOLD-PICKS", "ATC-CLIENT-FLEET", "OPERON-CLIENT-SAVE", "ANYALPHA-OLD-APPS", "LETTER-DEMO"]) {
|
|
assert.equal(figures.find((o) => o.id.endsWith(suffix))!.selection, "excluded");
|
|
}
|
|
assert.match(figures.find((o) => o.id.endsWith("LETTER-DEMO"))!.scope, /fictional/);
|
|
assert.equal(snapshot.companies.find((c) => c.id === "YC34899")!.cat, "C06");
|
|
const kailash = snapshot.companies.find((c) => c.id === "YC34828")!;
|
|
assert.equal(kailash.cat, "C10");
|
|
assert.equal(kailash.technicalReview!.level, "description", "an open-weights claim without readable weights or a model card is not a reviewed public artifact");
|
|
const graphify = snapshot.companies.find((c) => c.id === "YC32583")!;
|
|
assert.equal(graphify.technicalReview!.level, "public-artifact");
|
|
const proof = snapshot.evidence.find((e) => e.id === "UNCLEAR7-32583-PROOF")!;
|
|
assert.match(proof.summary, /unknown/);
|
|
assert.match(proof.summary, /函数/);
|
|
assert.match(proof.limitation, /整库正确/);
|
|
assert.match(snapshot.companies.find((c) => c.id === "YC32518")!.notes, /Build标Coming soon/);
|
|
for (const name of ["Kara", "Molagri", "TareBio", "Atomarine", "Vernius Systems, Inc."]) {
|
|
const row = batch.records.find((r) => r.name === name)!;
|
|
assert.equal(row.status, "pending-ai");
|
|
assert.equal(row.companyId, undefined);
|
|
}
|
|
assert.ok(figures.every((o) => o.comparisonGroup === null));
|
|
assert.ok(!platformIncomeSample(snapshot, { windowDays: null }).points.some((p) => p.observation.id.startsWith("UNCLEAR7-")));
|
|
});
|
|
|
|
test("all original AI-unclear candidates retain a unique follow-up without counting EveryApp twice", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const rows = snapshot.candidateBatches!.filter((b) => b.id.startsWith("YC-AI-UNCLEAR-")).flatMap((b) => b.records);
|
|
const original = coverageAudit.records.filter((r) => r.status === "ai-unclear");
|
|
assert.equal(rows.length, 192);
|
|
assert.equal(new Set(rows.map((r) => r.url)).size, 192);
|
|
assert.deepEqual(rows.map((r) => r.url), original.map((r) => r.source));
|
|
assert.equal(rows.filter((r) => r.status === "linked").length, 118);
|
|
assert.equal(rows.filter((r) => r.status === "pending-ai").length, 74);
|
|
assert.equal(snapshot.directoryRechecks!.filter((r) => r.ycId === 36088).length, 1);
|
|
const everyapp = rows.find((r) => r.name === "EveryApp")!;
|
|
assert.equal(everyapp.companyId, "AI074");
|
|
assert.equal(snapshot.companies.filter((c) => c.id === "AI074").length, 1);
|
|
for (const row of rows.filter((r) => r.status === "pending-ai")) {
|
|
assert.equal(row.companyId, undefined);
|
|
assert.ok(row.evidenceIds!.length > 0, "unresolved AI relevance has explicit evidence and gaps");
|
|
}
|
|
assert.equal(snapshot.coverage!.newProfiles, 928, "later evidence does not rewrite the original discovery accounting");
|
|
});
|
|
|
|
test("the final uncertain cohort separates delivery-start rentals, reservations and upstream costs", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches!.find((b) => b.id === "YC-AI-UNCLEAR-8")!;
|
|
assert.equal(batch.complete, false, "reading the full pool does not resolve all AI, year or financial gaps");
|
|
assert.equal(batch.records.filter((r) => r.status === "linked").length, 11);
|
|
assert.equal(batch.records.filter((r) => r.status === "pending-ai").length, 13);
|
|
const rhem = snapshot.companies.find((c) => c.id === "YC35127")!;
|
|
assert.match(rhem.price!, /确认交付后/);
|
|
assert.match(rhem.price!, /99 USD/);
|
|
assert.equal(rhem.revenueStatus, "unknown");
|
|
assert.match(snapshot.companies.find((c) => c.id === "YC37272")!.price!, /预约/);
|
|
assert.match(snapshot.companies.find((c) => c.id === "AI074")!.price!, /有效订阅/);
|
|
assert.match(snapshot.companies.find((c) => c.id === "YC35396")!.notes, /Coming next/);
|
|
assert.match(snapshot.companies.find((c) => c.id === "YC36774")!.notes, /Early access/);
|
|
const figures = snapshot.observations.filter((o) => o.id.startsWith("UNCLEAR8-"));
|
|
assert.equal(figures.length, 9);
|
|
assert.ok(figures.every((o) => ["excluded", "adoption"].includes(o.selection) && !o.metric && o.comparisonGroup === null));
|
|
for (const suffix of ["OASIVE-OLD-WELLS", "OASIVE-OLD-GOOGLE", "OBSESSION-CALCULATOR", "EVERYAPP-UPSTREAM"]) {
|
|
assert.equal(figures.find((o) => o.id.endsWith(suffix))!.selection, "excluded");
|
|
}
|
|
for (const name of ["Clean", "STASIS", "RATLOG", "Inflection Space Systems", "twentyfour26"]) {
|
|
assert.equal(batch.records.find((r) => r.name === name)!.status, "pending-ai");
|
|
}
|
|
assert.ok(!platformIncomeSample(snapshot, { windowDays: null }).points.some((p) => p.observation.id.startsWith("UNCLEAR8-")));
|
|
});
|
|
|
|
test("founding conflicts preserve old product history without creating new companies or revenue", () => {
|
|
const snapshot = seed as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches!.find((b) => b.id === "YC-DATE-CONFLICT-1")!;
|
|
const original = coverageAudit.records.filter((r) => r.status === "date-conflict");
|
|
assert.equal(batch.complete, false);
|
|
assert.equal(batch.records.length, 6);
|
|
assert.deepEqual(batch.records.map((r) => r.url), original.map((r) => r.source));
|
|
assert.equal(new Set(batch.records.map((r) => r.url)).size, original.length);
|
|
for (const row of batch.records) {
|
|
assert.equal(row.status, "pending-year");
|
|
assert.equal(row.companyId, undefined);
|
|
const evidence = snapshot.evidence.filter((e) => row.evidenceIds!.includes(e.id));
|
|
assert.equal(evidence.length, row.evidenceIds!.length);
|
|
assert.ok(evidence.every((e) => e.companyId === null));
|
|
assert.ok(evidence.some((e) => e.publishedAt?.startsWith("2025-")), "old product launch remains explicit");
|
|
assert.ok(!snapshot.companies.some((c) => c.evidenceIds.some((eid) => row.evidenceIds!.includes(eid))));
|
|
}
|
|
assert.match(batch.records.find((r) => r.name === "Layers")!.note, /未确认当前AI核心/);
|
|
assert.ok(!snapshot.observations.some((o) => o.evidence.startsWith("YEARCONFLICT1-")));
|
|
const excluded = coverageAudit.records.filter((r) => r.status === "year-outside-or-missing");
|
|
assert.equal(excluded.filter((r) => r.foundedYear === null).length, 54);
|
|
assert.equal(excluded.filter((r) => r.foundedYear !== null).length, 214);
|
|
assert.ok(excluded.filter((r) => r.foundedYear !== null).every((r) => ![2025, 2026].includes(r.foundedYear!)));
|
|
});
|
|
|
|
test("Chinese discovery entries preserve unread articles and use separate primary evidence", () => {
|
|
const snapshot = structuredClone(seed) as ResearchSnapshot;
|
|
const batch = snapshot.candidateBatches!.find((b) => b.id === "JQ-2026-targeted-1")!;
|
|
assert.equal(batch.complete, false);
|
|
assert.equal(batch.records.length, 4);
|
|
assert.ok(batch.records.every((row) => row.kind === "company" && row.profileStatus === "unavailable"));
|
|
assert.equal(batch.records.filter((row) => row.status === "linked").length, 2);
|
|
assert.equal(batch.records.find((row) => row.name === "Utopai")?.status, "outside-cohort");
|
|
assert.ok(!snapshot.observations.some((o) => ["PS-CODE", "SG-START", "SG-APR", "SSI-HISTORY"].includes(o.evidence)), "task costs, investment, capacity and financing are not revenue");
|
|
const prism = snapshot.companies.find((c) => c.id === "AI075")!;
|
|
assert.equal(prism.team, null, "a team range or linked employees must not become exact headcount");
|
|
batch.records[0].url = null;
|
|
assert.throws(() => validateResearch(snapshot), /research candidate/);
|
|
});
|