release: bump version to 0.84.0
ci / backend (push) Canceled after 0s
ci / frontend (push) Canceled after 0s
ci / delivery (push) Canceled after 0s

This commit is contained in:
linkong committed 2026-12-04 07:07:19 +08:00
1 parent 3b1b9ef68c
commit e1cc27f13d
241 files changed
+42779 -6027

No files matched your search

+69
View File
@@ -12,6 +12,11 @@ main() {
harness_run "$uv_bin" run --frozen --project "$ROOT_DIR" python - <<'PY'
import ast
import importlib
import inspect
import os
import pkgutil
import sys
from pathlib import Path
root = Path.cwd()
@@ -48,6 +53,70 @@ for path in sorted((root / "backend/app").rglob("*.py")):
continue
BackendDebugCallVisitor(rel).visit(tree)
if not failures:
# Verify ASGI app and every collector can be imported and instantiated offline.
os.environ["DATABASE_URL"] = "postgresql+asyncpg://check:check@127.0.0.1:1/check"
os.environ["REDIS_URL"] = "redis://127.0.0.1:1/0"
backend_dir = str(root / "backend")
if backend_dir not in sys.path:
sys.path.insert(0, backend_dir)
try:
import app.main # noqa: F401
import app.services.collectors as collectors_pkg
from app.services.collectors import (
BaseCollector,
HTTPCollector,
IntervalCollector,
collector_registry,
)
from app.services.collectors.compute_base import ComputeCollector
except Exception as exc:
fail(f"backend/app/main.py: failed offline ASGI import: {type(exc).__name__}: {exc}")
else:
abstract_bases = (BaseCollector, HTTPCollector, IntervalCollector, ComputeCollector)
for mod in pkgutil.iter_modules(collectors_pkg.__path__, collectors_pkg.__name__ + "."):
try:
module = importlib.import_module(mod.name)
except Exception as exc:
fail(f"{mod.name}: failed to import collector module: {type(exc).__name__}: {exc}")
continue
for attr_name, obj in inspect.getmembers(module, inspect.isclass):
if obj.__module__ != mod.name or not issubclass(obj, BaseCollector):
continue
if obj in abstract_bases or attr_name.startswith("_"):
continue
if inspect.isabstract(obj):
fail(
f"{mod.name}.{attr_name}: abstract methods unimplemented: "
f"{sorted(obj.__abstractmethods__)}"
)
continue
try:
inst = obj()
except Exception as exc:
fail(f"{mod.name}.{attr_name}: zero-arg init failed: {type(exc).__name__}: {exc}")
continue
if not str(getattr(inst, "name", "") or "").strip():
fail(f"{mod.name}.{attr_name}: collector name must be non-empty")
if not callable(getattr(inst, "fetch", None)):
fail(f"{mod.name}.{attr_name}: collector missing callable fetch()")
run_fn = getattr(inst, "run", None)
if not callable(run_fn) or "db" not in inspect.signature(run_fn).parameters:
fail(f"{mod.name}.{attr_name}: collector run() must accept 'db'")
for key, col in sorted(collector_registry.all().items()):
if not isinstance(col, BaseCollector):
fail(f"collector_registry[{key!r}]: not a BaseCollector instance")
continue
if col.name != key:
fail(f"collector_registry[{key!r}]: registered key != collector.name ({col.name!r})")
if not callable(getattr(col, "fetch", None)):
fail(f"collector_registry[{key!r}]: missing callable fetch()")
run_fn = getattr(col, "run", None)
if not callable(run_fn) or "db" not in inspect.signature(run_fn).parameters:
fail(f"collector_registry[{key!r}]: run() must accept 'db'")
if failures:
for message in failures:
print(f"fail: {message}")
+12 -6
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bun
import { spawnSync } from 'node:child_process'
import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs'
import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { dirname, join, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
@@ -86,7 +86,14 @@ function checkAdminBuildSeparation() {
assert(existsSync(join(adminOutDir, 'favicon.ico')), 'admin build output missing favicon.ico')
assert(existsSync(join(adminOutDir, 'favicon.png')), 'admin build output missing favicon.png')
assert(!existsSync(join(adminOutDir, 'earth')), 'admin build output must exclude public/earth assets')
console.log('ok: frontend admin target excludes public/earth assets and includes favicons')
const assetFiles = readdirSync(join(adminOutDir, 'assets'))
for (const prefix of ['earth-logo-', 'title-zh-', 'title-en-', 'lim-logo-', 'earth_clouds_2048-']) {
assert(
assetFiles.some((file) => file.startsWith(prefix) && file.endsWith('.png')),
`admin build output missing bundled preview asset ${prefix}*.png in assets/`,
)
}
console.log('ok: frontend admin target excludes public/earth assets and bundles admin preview assets')
} finally {
rmSync(adminOutDir, { recursive: true, force: true })
}
@@ -159,10 +166,9 @@ function checkElectronHeadlessSmoke() {
)
assert(report.splashCheck?.mounted === true, 'expected desktop splash Shadow DOM host to mount on replay')
assert(
report.splashCheck?.hasPresenterZh === true &&
report.splashCheck?.hasPresenterEn === true &&
report.splashCheck?.hasPresentedBy === true,
`expected presenter lockup texts on splash, got ${JSON.stringify(report.splashCheck)}`,
report.splashCheck?.hasPresentedBy === true &&
(report.splashCheck?.hasPresenterZh === true || report.splashCheck?.hasPresenterEn === true),
`expected localized presenter lockup texts on splash, got ${JSON.stringify(report.splashCheck)}`,
)
assert(
report.splashCheck?.emblemLoaded === true && report.splashCheck?.emblemWidth === 283,
+2
View File
@@ -96,6 +96,8 @@ main() {
check_optional_cmd docker "needed for local stack and optional image smoke builds"
check_optional_cmd helm "needed for optional Helm delivery smoke checks"
check_optional_cmd tippecanoe "needed for local Earth boundary PMTiles rebuilds (run scripts/harness/install-earth-boundary-tools.sh)"
check_optional_cmd pmtiles "optional PMTiles CLI for inspecting built boundary archives"
check_absent frontend/package-lock.json "frontend package management is Bun-only"
check_absent frontend/pnpm-lock.yaml "frontend package management is Bun-only"
+15
View File
@@ -764,6 +764,21 @@ def check_admin_control_design_contract() -> None:
"for column-level alignment rules"
)
table_action_block = css_block_for_selector(
admin_css,
".an-table-actions .tui-button--icon.tui-button--tactile",
)
if (
table_action_block is None
or not css_has_declaration(table_action_block[1], "width", r"(?:var\(--an-control-xs\)|28px)")
or not css_has_declaration(table_action_block[1], "height", r"(?:var\(--an-control-xs\)|28px)")
or not css_has_declaration(table_action_block[1], "box-shadow", r"none")
):
fail(
"frontend/src/admin/styles.css: .an-table-actions .tui-button--icon.tui-button--tactile must lock "
"width/height to var(--an-control-xs) and box-shadow: none so table row actions stay uniform"
)
def check_uiux_static_warnings() -> None:
viewport_font_pattern = re.compile(r"\b(?:font-size|fontSize)\s*[:=]\s*[^;\n}]*(?:vw|vmin|vmax|cqw|cqi)")
+491 -8
View File
@@ -69,6 +69,7 @@ const interactionChecks = [
'logs raw tab',
'users add dialog',
'data distribution toggle',
'data ledger compute',
'earth i18n settings',
'earth card limit controls independent',
'earth manual news refresh lifecycle',
@@ -1014,10 +1015,102 @@ function apiPayloadFor(requestUrl, method) {
}
if (path === '/collected') return jsonResponse({ data: [], total: 0 })
if (path === '/collected/summary') return jsonResponse({ total: 0, source_totals: [], type_totals: [], country_totals: [] })
if (path === '/collected/summary') return jsonResponse({ total: 0, overall_total_records: 0, by_source: {}, source_totals: [{ source: 'open_bgp', source_name: 'Open BGP', count: 12 }], type_totals: [{ data_type: 'bgp_event', count: 12 }] })
if (path === '/collected/sources') return jsonResponse({ sources: [{ source: 'open_bgp', source_name: 'Open BGP' }] })
if (path === '/collected/types') return jsonResponse({ data_types: ['bgp_event'] })
if (path === '/collected/countries') return jsonResponse({ countries: ['CN'] })
if (path === '/data-ledger/layers') {
return jsonResponse({
layers: [
{ id: 'compute', name: '算力', count: 2, kinds: [] },
{ id: 'satellites', name: '卫星', count: 1, kinds: [] },
{ id: 'cables', name: '海底光缆', count: 1, kinds: [{ id: 'submarine_cable', label: '海缆系统' }] },
{ id: 'vessels', name: '船只', count: 1, kinds: [] },
{ id: 'bgp', name: 'BGP', count: 1, kinds: [{ id: 'collectors', label: '观测站' }, { id: 'incidents', label: 'BGP 事件' }] },
{ id: 'news', name: '新闻与直播', count: 1, kinds: [{ id: 'items', label: '新闻条目' }, { id: 'live_streams', label: 'Live 直播源' }] },
{ id: 'weather', name: '气象', count: 1, kinds: [] },
{ id: 'geo', name: '地理/底图', count: 1, kinds: [] },
{ id: 'raw', name: '原始采集记录', count: 12, kinds: [] },
],
})
}
if (path === '/data-ledger/compute-centers') {
const requestedType = url.searchParams.get('site_type') || ''
const allItems = [
{
id: 101,
source: 'top500',
source_id: 'top500_frontier',
name: 'Frontier',
site_type: 'supercomputer',
operator: 'ORNL',
country: '美国',
city: 'Oak Ridge',
latitude: 35.93,
longitude: -84.31,
precision: 'site',
confidence: 0.95,
verification_status: 'verified',
status_bucket: 'located',
terminal_status: null,
location_source: 'official_facility_registry',
source_url: 'https://ornl.gov',
source_note: '橡树岭国家实验室官方地址确认。',
workflow_run_id: null,
updated_at: '2026-12-03T12:00:00Z',
},
{
id: 102,
source: 'epoch_ai_gpu',
source_id: 'epoch_ibm_dyeus',
name: 'IBM DYEUS',
site_type: 'gpu_cluster',
operator: 'IBM',
country: '美国',
city: null,
latitude: null,
longitude: null,
precision: 'unknown',
confidence: 0.0,
verification_status: 'undisclosed',
status_bucket: 'terminal',
terminal_status: 'undisclosed',
location_source: 'agent_terminal_undisclosed',
source_url: null,
source_note: '官方材料未披露物理 部署城市。',
workflow_run_id: 'run_smoke_dyeus',
updated_at: '2026-12-03T12:00:00Z',
},
]
const items = requestedType ? allItems.filter((item) => item.site_type === requestedType) : allItems
return jsonResponse({
items,
total: items.length,
page: 1,
page_size: 20,
counts: {
total: allItems.length,
by_site_type: { supercomputer: 1, gpu_cluster: 1, data_center: 0, cloud_center: 0, edge_node: 0 },
by_status: { located: 1, needs_confirmation: 0, terminal: 1, pending: 0 },
},
countries: ['美国'],
})
}
if (/^\/data-ledger\/[^/]+\/items$/.test(path)) {
return jsonResponse({
layer: 'vessels',
kind: 'all',
kinds: [],
columns: [
{ key: 'name', label: '船名' },
{ key: 'mmsi', label: 'MMSI' },
],
rows: [{ id: '1', name: 'Smoke Vessel', mmsi: '413000001' }],
total: 1,
page: 1,
page_size: 20,
})
}
const datasourceToggle = method === 'POST' ? path.match(/^\/datasources\/(\d+)\/(enable|disable)$/) : null
if (datasourceToggle) {
@@ -1034,9 +1127,84 @@ function apiPayloadFor(requestUrl, method) {
if (method === 'POST' && path === '/datasources/batch-status') {
return jsonResponse({ is_active: true, updated: [], unchanged: [], not_found: [], sync_failed: [], counts: datasourceCounts })
}
if (path === '/datasources') return jsonResponse({ total: 2, data: [datasource, disabledDatasource], counts: datasourceCounts })
if (path === '/datasources') {
if (url.searchParams.get('product') === 'geo') {
return jsonResponse({
total: 1,
data: [
{
...datasource,
id: 36,
source_id: 'earth_imagery_sentinel2',
name: 'earth_imagery_sentinel2',
display_name: 'Sentinel-2 无云高分底图',
module: 'L1',
source: 'earth_imagery_sentinel2',
product: 'geo',
},
],
counts: { all: 1, active: 1, inactive: 0 },
})
}
return jsonResponse({ total: 2, data: [datasource, disabledDatasource], counts: datasourceCounts })
}
if (path === '/datasources/configs') return jsonResponse([datasource])
if (path === '/datasources/configs/all') return jsonResponse([datasource])
if (path === '/datasources/configs/all') return jsonResponse([
{ ...datasource, product: 'bgp' },
{
...datasource,
id: 34,
name: 'global_cloud_map',
display_name: '全球卫星红外云图',
source: 'global_cloud_map',
product: 'weather',
source_type: 'http',
endpoint: 'https://gibs.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi',
config: { primary_source: 'multi_sat_ir', resolution: '2048x1024' },
},
{
...datasource,
id: 36,
name: 'earth_imagery_sentinel2',
display_name: 'Sentinel-2 无云高分底图',
source: 'earth_imagery_sentinel2',
product: 'geo',
source_type: 'http',
endpoint: 'https://tiles.maps.eox.at/wmts/1.0.0/s2cloudless-2024_3857/default/GoogleMapsCompatible/{z}/{y}/{x}.jpg',
config: { warmup_max_zoom: 3, max_zoom: 10 },
},
])
const productStatusMatch = path.match(/^\/data-products\/([a-z_]+)\/status$/)
if (productStatusMatch) {
const productId = productStatusMatch[1]
return jsonResponse({
product_id: productId,
name: productId,
total_count: 1,
has_data: true,
total_collector_count: productId === 'weather' ? 3 : 1,
active_collector_count: productId === 'weather' ? 3 : 1,
running_collector_count: 0,
datasources_url: `/datasources?product=${productId}`,
stats: productId === 'weather' ? { wind_available_flag: 1 } : {},
build_state: 'ready',
})
}
if (path === '/data-products') {
return jsonResponse({
generated_at: now,
data: ['vessels', 'cables', 'satellites', 'bgp', 'compute', 'weather', 'geo'].map((productId) => ({
product_id: productId,
name: productId,
total_count: 1,
has_data: true,
total_collector_count: productId === 'weather' ? 3 : 1,
active_collector_count: productId === 'weather' ? 3 : 1,
running_collector_count: 0,
datasources_url: `/datasources?product=${productId}`,
})),
})
}
if (path === '/datasources/mappings') return jsonResponse({ mappings: [{ id: 1, name: 'Default Mapping', target_schema: 'collected_data', validation_status: 'valid' }] })
if (path === '/datasources/target-schemas') return jsonResponse({ schemas: [{ id: 'collected_data', name: 'collected_data', status: 'active' }] })
if (path === '/datasources/snapshots') return jsonResponse({ data: [{ id: 1, source: 'open_bgp', status: 'completed', record_count: 12, is_current: true, completed_at: now }] })
@@ -1179,7 +1347,233 @@ function apiPayloadFor(requestUrl, method) {
return jsonResponse({ id: 'run_smoke_1', workflow_id: 'default.general', status: 'completed', actor_key: 'admin', question: 'Smoke run question', tool_trace: ['intake', 'default_advisor'], started_at: now })
}
if (path === '/earth/brand') return jsonResponse({ brand: { title: '智能星球', subtitle: 'Smoke', logo_alt: 'Planet' } })
if (path === '/earth/brand') return jsonResponse({
brand: {
logo_src: '/earth/assets/brand/earth-logo.png',
title_src: '/earth/assets/brand/title-zh.png',
title_text: '智能星球计划',
subtitle: 'Smoke',
description: '卫星 · 海底光缆 · 算力基础设施',
aria_label: '智能星球计划品牌标识',
title_alt: '智能星球计划',
},
})
if (path === '/earth/clouds/meta') return jsonResponse({
enabled: true,
mode: 'realtime',
degraded: false,
source: 'multi_sat_ir',
satellites: ['himawari', 'goes_east', 'goes_west', 'meteosat_0deg', 'meteosat_iodc'],
captured_at: now,
version: '20261203T113000Z',
image_url: '/api/v1/earth/clouds/frames/20261203T113000Z',
default_opacity: 0.9,
timelapse_enabled: true,
show_convective_markers: true,
convective_threshold: 0.78,
frames: [
{
version: '20261203T113000Z',
captured_at: now,
source: 'multi_sat_ir',
satellites: ['himawari', 'goes_east', 'goes_west', 'meteosat_0deg', 'meteosat_iodc'],
degraded: false,
resolution: '2048x1024',
file_size_bytes: 184320,
image_url: '/api/v1/earth/clouds/frames/20261203T113000Z',
global_summary: {
global_cloud_cover_pct: 61.4,
global_overcast_pct: 32.8,
global_convective_pct: 4.6,
convective_cluster_count: 2,
min_brightness_temp_c: -68.2,
},
},
],
summary: {
global_cloud_cover_pct: 61.4,
global_overcast_pct: 32.8,
global_convective_pct: 4.6,
northern_hemisphere_pct: 58.1,
southern_hemisphere_pct: 64.7,
tropics_pct: 52.3,
delta_pct: 1.2,
convective_cluster_count: 2,
min_brightness_temp_c: -68.2,
},
regions: [
{
key: 'east_asia_west_pac',
name: '东亚与西太平洋',
name_en: 'East Asia & West Pacific',
center_lat: 27.5,
center_lon: 122.5,
cloud_cover_pct: 59.2,
overcast_coverage_pct: 34.1,
convective_coverage_pct: 5.4,
min_brightness_temp_c: -64.5,
delta_pct: 0.8,
},
],
convective_clusters: [
{
cluster_id: 'cc_smoke_1',
latitude: 14.5,
longitude: 131.2,
area_km2: 86400,
peak_intensity: 0.91,
min_brightness_temp_c: -68.2,
region: '东亚与西太平洋',
region_en: 'East Asia & West Pacific',
bbox: { lon_min: 128, lon_max: 134, lat_max: 17, lat_min: 12 },
},
],
storage_stats: { file_count: 3, total_bytes: 262144, total_mb: 0.25 },
})
if (path === '/earth/clouds/configuration' || path === '/earth/clouds/configuration/reset') return jsonResponse({
config: {
enabled: true,
primary_source: 'multi_sat_ir',
fallback_source: 'matteason_live',
resolution: '2048x1024',
ir_threshold: 0.12,
contrast_gamma: 0.85,
convective_threshold: 0.78,
min_cluster_area_km2: 12000,
polar_feather_enabled: true,
max_history_frames: 12,
timelapse_enabled: true,
show_convective_markers: true,
default_opacity: 0.9,
request_timeout_seconds: 25,
},
revision: 'smoke-cloud-rev-1',
is_default: true,
meta: {
enabled: true,
mode: 'realtime',
degraded: false,
source: 'multi_sat_ir',
satellites: ['himawari', 'goes_east', 'goes_west', 'meteosat_0deg', 'meteosat_iodc'],
captured_at: now,
version: '20261203T113000Z',
image_url: '/api/v1/earth/clouds/frames/20261203T113000Z',
default_opacity: 0.9,
timelapse_enabled: true,
show_convective_markers: true,
convective_threshold: 0.78,
frames: [],
summary: { global_cloud_cover_pct: 61.4, convective_cluster_count: 2 },
regions: [],
convective_clusters: [],
storage_stats: { file_count: 3, total_bytes: 262144, total_mb: 0.25 },
},
datasource: {
id: 34,
source: 'global_cloud_map',
name: '全球气象云图采集',
is_active: true,
frequency_minutes: 30,
last_run_at: now,
next_run_at: now,
last_status: 'success',
},
})
if (method === 'POST' && path === '/earth/clouds/test') return jsonResponse({
source_id: 'multi_sat_ir',
ok: true,
latency_ms: 48,
reachable_count: 5,
total_count: 5,
satellites: [
{ id: 'himawari', label: 'Himawari-9', ok: true, latency_ms: 48 },
],
})
if (method === 'DELETE' && path === '/earth/clouds/cache') return jsonResponse({ deleted_files: 3, freed_bytes: 262144 })
if (method === 'GET' && path.startsWith('/earth/clouds/frames/')) {
return {
status: 200,
contentType: 'image/png',
body: Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X2S8AAAAASUVORK5CYII=', 'base64'),
}
}
if (method === 'GET' && path.startsWith('/earth/clouds/flows/')) {
return {
status: 200,
contentType: 'image/png',
body: Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X2S8AAAAASUVORK5CYII=', 'base64'),
}
}
if (path === '/earth/basemap/meta' || path === '/earth/basemap/configuration' || path === '/earth/basemap/configuration/reset') {
return jsonResponse({
config: {
active_source: 'earth_imagery_sentinel2',
hd_tiles_enabled: true,
cloud_hd_tiles_enabled: true,
lod_switch_altitude: 2.3,
max_zoom: 7,
warmup_max_zoom: 3,
max_cache_mb: 1024,
request_timeout_seconds: 15,
},
revision: 'smoke-basemap-rev-1',
is_default: true,
meta: {
active_source: 'earth_imagery_sentinel2',
hd_tiles_enabled: true,
cloud_hd_tiles_enabled: true,
hd_tiles_ready: true,
cloud_hd_tiles_ready: true,
lod_switch_altitude: 2.3,
max_zoom: 7,
warmup_max_zoom: 3,
max_cache_mb: 1024,
tile_url_template: '/api/v1/earth/tiles/earth_imagery_sentinel2/{z}/{x}/{y}.webp',
cloud_tile_url_template: '/api/v1/earth/tiles/cloud_hd_tiles/{z}/{x}/{y}.webp',
sources: [
{ source: 'earth_imagery_sentinel2', display_name: 'Sentinel-2 无云高分底图', is_active: true, has_data: true, cached_tiles: 21, cache_mb: 1.2, zoom_levels: [0, 1, 2], max_zoom: 10, warmup_max_zoom: 3, max_cache_mb: 1024, tile_url_template: '/api/v1/earth/tiles/earth_imagery_sentinel2/{z}/{x}/{y}.webp', upstream_template: '' },
],
},
})
}
if (method === 'GET' && path.startsWith('/earth/tiles/')) {
return {
status: 200,
contentType: 'image/webp',
body: Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+X2S8AAAAASUVORK5CYII=', 'base64'),
}
}
if (method === 'DELETE' && /^\/earth\/tiles\/[a-z0-9_]+\/cache$/.test(path)) {
return jsonResponse({ removed_files: 5 })
}
if (path === '/earth/wind/meta') {
return jsonResponse({
available: true,
is_active: true,
has_data: true,
version: '20261203T120000Z',
captured_at: now,
forecast_time: now,
grid_url: '/api/v1/earth/wind/grid/20261203T120000Z',
global_summary: { mean_speed_ms: 8.4, max_speed_ms: 24.5, storm_core_count: 2 },
regions: [],
storm_cores: [],
})
}
if (path.startsWith('/earth/wind/grid/')) {
return jsonResponse({
version: '20261203T120000Z',
width: 4,
height: 2,
lat_min: -45,
lat_max: 45,
lon_min: -180,
lon_max: 90,
max_speed_ms: 12.0,
u: [5, 6, 7, 8, 5, 6, 7, 8],
v: [1, 2, 1, 2, -1, -2, -1, -2],
})
}
if (path === '/data-products/compute/configuration') return jsonResponse({
config: JSON.parse(readRepoText('backend/app/services/compute_history_defaults.json')),
revision: 'compute-configuration-smoke',
@@ -1769,9 +2163,25 @@ async function runAdminInteractionChecks(browser, failures, consoleErrors) {
await clickFirstVisible(page.getByRole('button', { name: /添加用户/ }), 'users add dialog button')
await expectVisibleText(page, '添加用户', 'users add dialog')
await page.goto(urlFor('/data'), { waitUntil: 'domcontentloaded' })
await page.goto(urlFor('/admin'), { waitUntil: 'domcontentloaded' })
await clickFirstVisible(page.getByRole('button', { name: '按类型' }), 'data distribution toggle')
await expectVisibleText(page, '按类型', 'data distribution toggle')
await clickFirstVisible(page.getByRole('button', { name: '图层占比' }), 'runtime layer donut toggle')
await expectVisibleText(page, '算力中心地理定位进度', 'runtime layer donut toggle')
smokeProgress('data ledger compute')
await page.goto(urlFor('/data?layer=compute'), { waitUntil: 'domcontentloaded' })
await expectVisibleText(page, 'Frontier', 'data ledger compute row')
await expectVisibleText(page, 'IBM DYEUS', 'data ledger compute terminal row')
const actionHeader = page.locator("th[data-column-id='actions']").first()
await actionHeader.waitFor({ state: 'visible', timeout: SMOKE_RENDER_TIMEOUT_MS })
assert.equal((await actionHeader.innerText()).trim(), '操作', 'compute ledger actions header must be 操作')
const actionButton = page.locator('.an-table-actions .an-table-action').first()
await actionButton.waitFor({ state: 'visible', timeout: SMOKE_RENDER_TIMEOUT_MS })
const actionBox = await actionButton.boundingBox()
assert.ok(actionBox && Math.round(actionBox.height) === 28 && Math.round(actionBox.width) === 28, `expected 28px TableActionButton, got ${JSON.stringify(actionBox)}`)
await clickFirstVisible(page.getByRole('button', { name: /超算/ }), 'data ledger site_type filter')
await expectVisibleText(page, 'Frontier', 'data ledger compute filtered row')
smokeProgress('earth news source test')
await page.goto(urlFor('/earth-content?section=news_sources'), { waitUntil: 'domcontentloaded' })
@@ -1801,6 +2211,73 @@ async function runAdminInteractionChecks(browser, failures, consoleErrors) {
await clickFirstVisible(page.getByRole('button', { name: '导入配置草稿' }), 'compute candidate import')
await expectVisibleText(page, '已将审核通过的候选观测导入草稿', 'compute candidate import toast')
smokeProgress('earth brand preview bundled assets')
await page.goto(urlFor('/earth-content?section=brand'), { waitUntil: 'domcontentloaded' })
await page.locator('.an-earth-brand-preview img.earth-brand__logo').waitFor({ state: 'visible', timeout: 8000 })
const brandImageCheck = await page.evaluate(async () => {
const imgs = Array.from(document.querySelectorAll('.an-earth-brand-preview img'))
await Promise.all(
imgs.map((img) => {
if (img.complete) return Promise.resolve()
return new Promise((resolve) => {
img.addEventListener('load', resolve, { once: true })
img.addEventListener('error', resolve, { once: true })
setTimeout(resolve, 4000)
})
}),
)
return imgs.map((img) => ({
className: img.className,
src: img.getAttribute('src') || '',
complete: img.complete,
naturalWidth: img.naturalWidth,
}))
})
assert(
brandImageCheck.length >= 2 &&
brandImageCheck.every((img) => img.complete && img.naturalWidth > 0 && img.src.startsWith('/assets/')),
`brand preview images must load from bundled /assets/: ${JSON.stringify(brandImageCheck)}`,
)
smokeProgress('cloud map workbench')
await page.goto(urlFor('/earth-content?section=cloud_map'), { waitUntil: 'domcontentloaded' })
await expectVisibleText(page, '全球实时红外云图', 'cloud map workbench title')
await checkAdminShellOneScreen(page, 'cloud map workbench one-screen', { expectAccountVisible: true })
const cloudImageCheck = await page.evaluate(async () => {
const img = document.querySelector('.an-cloud-canvas__img')
if (!img) return null
if (!img.complete) {
await new Promise((resolve) => {
img.addEventListener('load', resolve, { once: true })
img.addEventListener('error', resolve, { once: true })
setTimeout(resolve, 4000)
})
}
return {
src: img.getAttribute('src') || '',
complete: img.complete,
naturalWidth: img.naturalWidth,
}
})
assert(
cloudImageCheck && cloudImageCheck.complete && cloudImageCheck.naturalWidth > 0,
`cloud map preview image failed to load: ${JSON.stringify(cloudImageCheck)}`,
)
smokeProgress('basemap workbench')
await page.goto(urlFor('/earth-content?section=basemap'), { waitUntil: 'domcontentloaded' })
await expectVisibleText(page, '地球高清底图与瓦片金字塔', 'basemap workbench title')
await checkAdminShellOneScreen(page, 'basemap workbench one-screen', { expectAccountVisible: true })
smokeProgress('geo datasources filter')
await page.goto(urlFor('/datasources?product=geo'), { waitUntil: 'domcontentloaded' })
await expectVisibleText(page, 'earth_imagery_sentinel2', 'geo datasource item')
smokeProgress('collection-management product labels')
await page.goto(urlFor('/collection-management'), { waitUntil: 'domcontentloaded' })
await expectVisibleText(page, 'global_cloud_map', 'collection-management cloud collector item')
await expectVisibleText(page, '气象', 'collection-management weather domain subtitle')
await page.goto(urlFor('/definitely-not-a-real-admin-route'), { waitUntil: 'domcontentloaded' })
await expectUrl(page, 'authenticated unknown route fallback', (location) => location.pathname === '/admin')
await expectVisibleText(page, '仪表盘', 'authenticated unknown route fallback')
@@ -1845,6 +2322,12 @@ async function runAdminInteractionChecks(browser, failures, consoleErrors) {
await checkNoFrameworkOverlay(mobilePage, label)
await checkNoGlobalHorizontalOverflow(mobilePage, label)
}
smokeProgress('mobile cloud map workbench')
await mobilePage.goto(urlFor('/earth-content?section=cloud_map'), { waitUntil: 'domcontentloaded' })
await expectVisibleText(mobilePage, '全球实时红外云图', 'mobile cloud map workbench title')
await checkNoFrameworkOverlay(mobilePage, 'mobile cloud map workbench')
await checkNoGlobalHorizontalOverflow(mobilePage, 'mobile cloud map workbench')
} catch (error) {
failures.push(formatSmokeError(error))
} finally {
@@ -1969,15 +2452,15 @@ async function runDatasourceSchedulingChecks(browser, failures, consoleErrors) {
const alignment = await page.evaluate(() => {
const cb = document.querySelector('thead th.an-data-table__selection-cell input')?.getBoundingClientRect()
const cell = document.querySelector('thead th.an-data-table__selection-cell')?.getBoundingClientRect()
const schedTh = document.querySelector('thead th[data-column-id="schedule"]')?.getBoundingClientRect()
const schedLabel = document.querySelector('thead th[data-column-id="schedule"] .an-data-table__header-label')?.getBoundingClientRect()
const schedSwitch = document.querySelector('tbody td[data-column-id="schedule"] [role="switch"]')?.getBoundingClientRect()
return {
checkboxDelta: cb && cell ? Math.abs((cb.left - cell.left) - (cell.right - cb.right)) : null,
scheduleDelta: schedTh && schedSwitch ? Math.abs(((schedTh.left + schedTh.right) / 2) - ((schedSwitch.left + schedSwitch.right) / 2)) : null,
scheduleDelta: schedLabel && schedSwitch ? Math.abs(schedLabel.left - schedSwitch.left) : null,
}
})
assert.ok(alignment.checkboxDelta !== null && alignment.checkboxDelta <= 1.5, `selection checkbox must be centered, got delta=${alignment.checkboxDelta}`)
assert.ok(alignment.scheduleDelta !== null && alignment.scheduleDelta <= 1.5, `schedule switch must align with header center, got delta=${alignment.scheduleDelta}`)
assert.ok(alignment.scheduleDelta !== null && alignment.scheduleDelta <= 1.5, `schedule switch must align with header left edge, got delta=${alignment.scheduleDelta}`)
const listRequestsBeforeToggle = listRequests
await enableSwitch.first().click()
await page.locator('.an-toast--success').first().waitFor({ state: 'visible' })
+62
View File
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
# Install the Earth boundary PMTiles toolchain (tippecanoe + pmtiles) into a
# user prefix without sudo. Production images build the same tools in
# backend/Dockerfile; this script is only for local WSL/Linux development.
set -euo pipefail
PREFIX="${PLANET_TOOLS_PREFIX:-$HOME/.local}"
TIPPECANOE_REF="${TIPPECANOE_REF:-2.79.0}"
PMTILES_VERSION="${PMTILES_VERSION:-1.31.2}"
SQLITE_AMALGAMATION="${SQLITE_AMALGAMATION:-sqlite-amalgamation-3500400}"
SQLITE_YEAR="${SQLITE_YEAR:-2025}"
mkdir -p "$PREFIX/bin"
work="$(mktemp -d "${TMPDIR:-/tmp}/planet-earth-tools.XXXXXX")"
trap 'rm -rf "$work"' EXIT
have() { command -v "$1" >/dev/null 2>&1; }
if have tippecanoe && [ "${FORCE:-0}" != "1" ]; then
echo "ok: tippecanoe already installed ($(command -v tippecanoe))"
else
sqlite_flags=(PLANET_TOOLS_BUILD=1)
if [ ! -f /usr/include/sqlite3.h ]; then
echo "info: sqlite3 headers missing; building static sqlite amalgamation"
curl -fsSL "https://www.sqlite.org/${SQLITE_YEAR}/${SQLITE_AMALGAMATION}.zip" -o "$work/sqlite.zip"
(cd "$work" && python3 -m zipfile -e sqlite.zip .)
sqlite_dir="$work/$SQLITE_AMALGAMATION"
mkdir -p "$work/sqlite/include" "$work/sqlite/lib"
cp "$sqlite_dir/sqlite3.h" "$work/sqlite/include/"
cc -O2 -DSQLITE_THREADSAFE=1 -c "$sqlite_dir/sqlite3.c" -o "$work/sqlite/sqlite3.o"
ar rcs "$work/sqlite/lib/libsqlite3.a" "$work/sqlite/sqlite3.o"
# The tippecanoe Makefile appends to CFLAGS/CXXFLAGS/LDFLAGS inherited from env.
sqlite_flags=(
"CFLAGS=-I$work/sqlite/include"
"CXXFLAGS=-I$work/sqlite/include"
"LDFLAGS=-L$work/sqlite/lib -ldl"
)
fi
git clone --depth 1 --branch "$TIPPECANOE_REF" https://github.com/felt/tippecanoe.git "$work/tippecanoe"
env "${sqlite_flags[@]}" make -C "$work/tippecanoe" -j"$(nproc)" tippecanoe tile-join
install -m 0755 "$work/tippecanoe/tippecanoe" "$work/tippecanoe/tile-join" "$PREFIX/bin/"
echo "ok: installed tippecanoe into $PREFIX/bin"
fi
if have pmtiles && [ "${FORCE:-0}" != "1" ]; then
echo "ok: pmtiles already installed ($(command -v pmtiles))"
else
arch="$(uname -m)"
case "$arch" in
x86_64) arch="x86_64" ;;
aarch64|arm64) arch="arm64" ;;
*) echo "error: unsupported arch $arch" >&2; exit 1 ;;
esac
url="https://github.com/protomaps/go-pmtiles/releases/download/v${PMTILES_VERSION}/go-pmtiles_${PMTILES_VERSION}_Linux_${arch}.tar.gz"
curl -fsSL "$url" -o "$work/pmtiles.tar.gz"
tar -xzf "$work/pmtiles.tar.gz" -C "$work" pmtiles
install -m 0755 "$work/pmtiles" "$PREFIX/bin/pmtiles"
echo "ok: installed pmtiles into $PREFIX/bin"
fi
"$PREFIX/bin/tippecanoe" --version 2>&1 | head -1 || true
"$PREFIX/bin/pmtiles" version 2>&1 | head -1 || true
@@ -42,7 +42,7 @@ class BackendRuntimeAssetsTests(unittest.TestCase):
self.assertFalse((exported / "app/backend/.env").exists())
self.assertFalse((exported / "app/config/earth-boundary-sources.local.json").exists())
self.assertTrue((exported / "app/resources/earth/boundary-pov-geometry.china-v1.json").is_file())
for builder in ("build_earth_boundary_china_pov_geojson.py", "build_earth_boundary_pmtiles.py"):
for builder in ("build_earth_boundary_pmtiles.py",):
probe = subprocess.run(
[sys.executable, str(exported / "app/scripts" / builder), "--help"],
capture_output=True, text=True, timeout=10,
+6
View File
@@ -343,7 +343,13 @@ class DatabaseLifecycleTests(unittest.TestCase):
def test_backend_worker_import_failure_is_distinct_from_optional_collector_errors(self) -> None:
for contents, expected_status in (
("Process SpawnProcess-1:\nModuleNotFoundError: missing_app\n", 0),
(
"Process SpawnProcess-19:\n"
"TypeError: Can't instantiate abstract class CloudHDTilesCollector without an implementation for abstract method 'fetch'\n",
0,
),
("Collector unavailable\nImportError: optional_dependency\n", 1),
("Collector warning\nTypeError: transient parse error\n", 1),
):
with self.subTest(contents=contents), tempfile.TemporaryDirectory() as directory:
log_file = Path(directory) / "backend.log"