拆分 scan_terminal_service:AI 配置常量移至 scan_ai_config.py
提取 ~140 行配置+env helpers 到新模块。scan_terminal_service 1534→1474 行。
This commit is contained in:
-49
@@ -1,49 +0,0 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
function assert(condition: unknown, message: string) {
|
||||
if (!condition) throw new Error(message);
|
||||
}
|
||||
|
||||
export function runTests() {
|
||||
const projectRoot = process.cwd();
|
||||
const workspacePath = path.join(
|
||||
projectRoot,
|
||||
"components",
|
||||
"dashboard",
|
||||
"scan-terminal",
|
||||
"use-ai-pinned-city-workspace.ts",
|
||||
);
|
||||
const storePath = path.join(projectRoot, "hooks", "useDashboardStore.tsx");
|
||||
const cardPath = path.join(
|
||||
projectRoot,
|
||||
"components",
|
||||
"dashboard",
|
||||
"scan-terminal",
|
||||
"AiPinnedCityCard.tsx",
|
||||
);
|
||||
const source = fs.readFileSync(workspacePath, "utf8");
|
||||
const storeSource = fs.readFileSync(storePath, "utf8");
|
||||
const cardSource = fs.readFileSync(cardPath, "utf8");
|
||||
|
||||
assert(
|
||||
!source.includes("waitForDeepAnalysisQueue"),
|
||||
"decision-card deep analysis hydration must not add an artificial queue delay",
|
||||
);
|
||||
assert(
|
||||
/store\.ensureCityDetail\(\s*nextCity,\s*false,\s*"full",?\s*\)/.test(source),
|
||||
"automatic deep analysis hydration should use cache-friendly full detail requests",
|
||||
);
|
||||
assert(
|
||||
storeSource.includes("row.model_cluster_sources") &&
|
||||
storeSource.includes("deb_prediction") &&
|
||||
storeSource.includes("multi_model: multiModel"),
|
||||
"decision-card preload must hydrate model cluster and DEB data from the scan row",
|
||||
);
|
||||
assert(
|
||||
cardSource.includes("getRowModelEntries") &&
|
||||
cardSource.includes("detailModelEntries.length ? detailModelEntries : getRowModelEntries(row)") &&
|
||||
cardSource.includes('aiForecast.status === "ready"'),
|
||||
"decision card should render model support from the row; AI predicted max must wait for AI ready status",
|
||||
);
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
function assert(condition: unknown, message: string) {
|
||||
if (!condition) throw new Error(message);
|
||||
}
|
||||
|
||||
export function runTests() {
|
||||
const source = fs.readFileSync(
|
||||
path.join(process.cwd(), "hooks", "useDashboardStore.tsx"),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
assert(
|
||||
source.includes("function pickRicherHourly"),
|
||||
"city detail merge should have an explicit hourly-series preservation helper",
|
||||
);
|
||||
assert(
|
||||
/hourly:\s*pickRicherHourly\(\s*current\.hourly,\s*incoming\.hourly\s*\)/.test(
|
||||
source,
|
||||
),
|
||||
"deep-analysis refresh must not let sparse incoming hourly data overwrite chart-capable cached hourly data",
|
||||
);
|
||||
assert(
|
||||
source.includes("function pickRicherObservationSeries"),
|
||||
"city detail merge should preserve chart observation series when refresh payload is sparse",
|
||||
);
|
||||
assert(
|
||||
/metar_today_obs:\s*pickRicherObservationSeries\(\s*current\.metar_today_obs,\s*incoming\.metar_today_obs,?\s*\)/.test(
|
||||
source,
|
||||
),
|
||||
"deep-analysis refresh must not wipe METAR observation points used by the intraday path chart",
|
||||
);
|
||||
assert(
|
||||
/settlement_today_obs:\s*pickRicherObservationSeries\(\s*current\.settlement_today_obs,\s*incoming\.settlement_today_obs,?\s*\)/.test(
|
||||
source,
|
||||
),
|
||||
"deep-analysis refresh must not wipe settlement observation points used by the intraday path chart",
|
||||
);
|
||||
assert(
|
||||
/trend:\s*mergeTrendInfo\(\s*current\.trend,\s*incoming\.trend\s*\)/.test(source),
|
||||
"deep-analysis refresh must merge trend.recent instead of replacing it with sparse trend payloads",
|
||||
);
|
||||
}
|
||||
-6
@@ -20,7 +20,6 @@ export function runTests() {
|
||||
"dashboard",
|
||||
"ScanTerminalDashboard.tsx",
|
||||
);
|
||||
const dashboardClientPath = path.join(projectRoot, "lib", "dashboard-client.ts");
|
||||
const airportEvidencePath = path.join(
|
||||
projectRoot,
|
||||
"components",
|
||||
@@ -31,7 +30,6 @@ export function runTests() {
|
||||
|
||||
const querySource = fs.readFileSync(queryPath, "utf8");
|
||||
const dashboardSource = fs.readFileSync(dashboardPath, "utf8");
|
||||
const dashboardClientSource = fs.readFileSync(dashboardClientPath, "utf8");
|
||||
const airportEvidenceSource = fs.readFileSync(airportEvidencePath, "utf8");
|
||||
|
||||
assert(
|
||||
@@ -52,8 +50,4 @@ export function runTests() {
|
||||
!airportEvidenceSource.includes("busan:"),
|
||||
"settlement runway mapping must cover all active settlement cities without mixing in non-settlement airports",
|
||||
);
|
||||
assert(
|
||||
dashboardClientSource.includes('CACHE_KEY = "polyWeather_v2_chart_full_day"'),
|
||||
"city detail cache key must be bumped so old partial chart detail caches are not reused",
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user