Compare commits

...
Author SHA1 Message Date
Antigravity AI b30d656d2a chore: bump to 2.48.19 and reconcile lockfile after merging main (validateManifest fix) 2026-06-04 22:35:20 +12:00
Antigravity AI 6f5e231cb0 Merge remote-tracking branch 'origin/main' into feat/ci-plugin-seeder-smoke 2026-06-04 22:34:34 +12:00
Antigravity AI 58fe768382 chore: bump version to 2.48.18 for CI foundation landing 2026-06-04 21:29:18 +12:00
Antigravity AI 529a2bcb5b fix(ci): add /__health route to mock-upstream and gate engine on service_healthy 2026-06-04 21:25:11 +12:00
Antigravity AI 5329d92283 refactor(ci-probe): extract shared payload-shape validator with contract tests 2026-06-04 21:23:14 +12:00
Antigravity AI 3cb07eb9ba Merge remote-tracking branch 'origin/main' into feat/ci-plugin-seeder-smoke
# Conflicts:
#	.agents/rules/directory-structure.md
#	.agents/rules/ecosystem-repositories.md
#	.agents/rules/platform-architecture.md
#	.agents/skills/migrate-legacy-plugin/SKILL.md
#	package.json
#	pnpm-lock.yaml
2026-06-04 21:19:43 +12:00
Antigravity AIandClaude Sonnet 4.6 8442f4594f feat: CI smoke-test foundation (probe + docker compose + rule updates)
Phase 1 of multi-repo CI initiative for catching plugin/seeder integration
failures (ADR-0002 id drift, missing mapWebsocketPayload, namespace
collisions, BOM in package.json) that current CI misses.

- packages/wwv-ci-probe: shared CLI with `seeder`, `ws`, `id-contract`
  subcommands. README documents why no `plugin` subcommand (Playwright belongs
  in wwv-plugins, not coupled to this probe). `files` + `prepublishOnly`
  configured for clean npm publish.
- docker/ci/: reusable docker-compose stacks for plugin-CI and seeder-CI,
  plus mock-upstream HTTP fixture server and CI-only stub-seeder. Compose
  comments document scope boundary (consumer workflow owns user/plugin-row
  injection via Playwright globalSetup pattern) and the deferred stub-seeder
  bake-in for wwv-data-engine.
- .github/workflows/docker-publish.yml: adds `:ci` tag alias for downstream
  consumers (one-line edit).
- .agents/rules/*: rename worldwideview-plugins → wwv-plugins (4 files) to
  reflect repo rename + clarify it lives at local-plugins/ as its own git
  working tree.

Bump 2.15.16 → 2.16.0 (Minor — new ci-probe package + new docker/ci
infrastructure are net-new features for the CI ecosystem).

Foundation has NOT been booted end-to-end yet — ghcr.io/silvertakana/
worldwideview:ci doesn't exist until this lands on main and the workflow
publishes. Next session: validate via real compose-up, then mirror the :ci
tag in wwv-data-engine repo and wire consumer workflows in wwv-plugins.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-05-21 11:24:25 +12:00
19 changed files with 1140 additions and 1 deletions

No files matched your search

+1
View File
@@ -61,6 +61,7 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=ci,enable={{is_default_branch}}
type=ref,event=branch
type=sha,format=short
+101
View File
@@ -0,0 +1,101 @@
# Reusable compose for plugin smoke CI (consumed by wwv-plugins repo).
#
# Boots a full stack with a STUB seeder that emits known-good GeoEntity[]
# data under the plugin-under-test's id. This isolates "is the frontend
# wiring correct" from "is the real backend healthy" — a broken real seeder
# cannot fail plugin CI.
#
# ─── Scope boundary (what THIS compose does vs what the workflow does) ───
#
# This compose only boots services. The consuming workflow's Playwright
# `globalSetup` is responsible for:
# 1. Inserting the test user into `users` (for NextAuth credentials login)
# 2. Inserting the `InstalledPlugin` row with the plugin's manifest JSON
# (entry URL → http://localhost:3000/plugins-local/<PLUGIN_ID>/frontend.mjs)
# 3. UI login → save storageState.json
# 4. Running the smoke spec
#
# Reuse the pattern from worldwideview/tests/global.setup.ts. DB migrations
# are handled automatically by the wwv-app entrypoint at container start.
#
# ─── Known foundation gap (deferred) ───
#
# The stub-seeder is mounted via `./stub-seeder:/app/seeders/community/stub-seeder`
# below — a path RELATIVE to this compose file. When a consumer repo downloads
# only this YAML, that path resolves to nothing. The clean fix is to bake the
# stub-seeder into the `wwv-data-engine:ci` image at /app/seeders/community/__ci-stub__/
# so the compose only needs to set STUB_PLUGIN_ID. That requires a coordinated
# Dockerfile change in the wwv-data-engine repo — tracked as the next session's
# first task.
#
# Until then, this compose only works when the worldwideview source tree
# (with docker/ci/stub-seeder/) is the working directory.
#
# Expected env vars from consuming workflow:
# PLUGIN_ID — kebab-case id of the plugin under test (e.g. "aviation")
# PLUGIN_BUNDLE_DIR — host path to the plugin's compiled dist/ (mounted into wwv-app)
# CI_IMAGE_TAG — image tag to pull (default: ci)
services:
db:
image: postgres:15-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: worldwideview
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d worldwideview"]
interval: 3s
timeout: 3s
retries: 20
wwv-redis:
image: redis:7-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 3s
timeout: 3s
retries: 10
wwv-data-engine:
image: ghcr.io/silvertakana/wwv-data-engine:${CI_IMAGE_TAG:-ci}
command: ["node", "dist/server.js"]
ports:
- "5000:5000"
environment:
PORT: 5000
REDIS_URL: redis://wwv-redis:6379
SEEDERS_DIR: /app/seeders
DB_PATH: /tmp/engine.db
# Stub seeder reads the target plugin id from this env var
STUB_PLUGIN_ID: ${PLUGIN_ID}
volumes:
# Mount only the stub seeder — no other seeders to avoid contamination
- ./stub-seeder:/app/seeders/community/stub-seeder:ro
depends_on:
wwv-redis:
condition: service_healthy
wwv-app:
image: ghcr.io/silvertakana/worldwideview:${CI_IMAGE_TAG:-ci}
ports:
- "3000:3000"
environment:
AUTH_SECRET: ci-placeholder-secret-not-used-in-tests
DATABASE_URL: postgresql://postgres:postgres@db:5432/worldwideview?schema=public
NEXT_PUBLIC_WWV_EDITION: local
NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL: http://localhost:5000
volumes:
# Mount the plugin's compiled bundle so the app can load it locally
- ${PLUGIN_BUNDLE_DIR}:/app/public/plugins-local/${PLUGIN_ID}:ro
depends_on:
db:
condition: service_healthy
wwv-data-engine:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1"]
interval: 5s
timeout: 5s
retries: 30
start_period: 30s
+64
View File
@@ -0,0 +1,64 @@
# Reusable compose for seeder smoke CI (consumed by wwv-seeders-* repos).
#
# Runs the REAL seeder against a MOCK upstream HTTP server. This isolates
# "is the seeder code correct" from "is the upstream provider up" — a
# NASA FIRMS / OpenSky / Overpass outage cannot fail seeder CI.
#
# Expected env vars from consuming workflow:
# SEEDER_NAME — kebab-case name of the seeder under test
# SEEDER_DIST_DIR — host path to the seeder's compiled dist/ + package.json
# FIXTURE_DIR — host path to the seeder's __fixtures__ directory
# CI_IMAGE_TAG — image tag to pull (default: ci)
#
# Plus any seeder-specific upstream env vars (e.g. OPENSKY_API_BASE)
# already exported in the workflow shell, all pointing at http://mock-upstream:8080
services:
wwv-redis:
image: redis:7-alpine
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 3s
timeout: 3s
retries: 10
mock-upstream:
build:
context: ./mock-upstream
volumes:
- ${FIXTURE_DIR}:/fixtures:ro
environment:
FIXTURE_DIR: /fixtures
PORT: 8080
healthcheck:
test: ["CMD-SHELL", "wget -q -O- http://localhost:8080/__health || exit 1"]
interval: 5s
timeout: 3s
retries: 5
wwv-data-engine:
image: ghcr.io/silvertakana/wwv-data-engine:${CI_IMAGE_TAG:-ci}
command: ["node", "dist/server.js"]
ports:
- "5000:5000"
volumes:
# Mount ONLY this seeder under /app/seeders/community/<name> — isolates
# the test from any cross-seeder dependencies or collisions.
- ${SEEDER_DIST_DIR}:/app/seeders/community/${SEEDER_NAME}:ro
environment:
PORT: 5000
REDIS_URL: redis://wwv-redis:6379
SEEDERS_DIR: /app/seeders
DB_PATH: /tmp/engine.db
# Seeder-specific upstream env vars are injected by the consuming
# workflow via `environment:` overrides or `env_file:`.
env_file:
- path: ./.seeder.env
required: false
depends_on:
wwv-redis:
condition: service_healthy
mock-upstream:
condition: service_healthy
+5
View File
@@ -0,0 +1,5 @@
FROM node:22-alpine
WORKDIR /mock
COPY server.mjs ./
EXPOSE 8080
CMD ["node", "/mock/server.mjs"]
+48
View File
@@ -0,0 +1,48 @@
# mock-upstream
Tiny HTTP server used in CI to stand in for upstream data APIs (OpenSky, NASA FIRMS, Overpass, etc.) so seeder CI can run hermetically without real API keys or network flakiness.
## How it works
Mount a fixture directory at `/fixtures`. The directory must contain a `routes.json` mapping request paths → fixture filenames:
```json
{
"/api/states/all": "opensky-states.json",
"/api/v2/flights": "flights.json"
}
```
When the server receives `GET /api/states/all`, it serves the contents of `/fixtures/opensky-states.json`.
## Env vars
| Var | Default | Purpose |
|---|---|---|
| `FIXTURE_DIR` | `/fixtures` | Directory mounted from the seeder repo |
| `ROUTES_FILE` | `${FIXTURE_DIR}/routes.json` | Override the routes manifest path |
| `PORT` | `8080` | Listen port |
## Per-seeder convention
Each seeder ships its own `__fixtures__/` folder next to `src/`:
```
wwv-seeders-community/aviation/
├── src/index.ts
└── __fixtures__/
├── routes.json
└── opensky-states.json
```
In CI compose, that folder is mounted into the mock-upstream container at `/fixtures` for the duration of the seeder smoke test.
## Architectural contract
Seeders MUST read upstream URLs from documented env vars with the production URL as the default, e.g.:
```ts
const UPSTREAM = process.env.OPENSKY_API_BASE ?? "https://opensky-network.org";
```
The CI compose then overrides `OPENSKY_API_BASE=http://mock-upstream:8080`. Without this convention, CI mocking is impossible — hardcoded URLs cannot be intercepted.
+61
View File
@@ -0,0 +1,61 @@
import { createServer } from "node:http";
import { readFileSync, existsSync } from "node:fs";
import { resolve, join } from "node:path";
const FIXTURE_DIR = process.env.FIXTURE_DIR ?? "/fixtures";
const PORT = Number(process.env.PORT ?? 8080);
const ROUTES_FILE = process.env.ROUTES_FILE ?? join(FIXTURE_DIR, "routes.json");
if (!existsSync(ROUTES_FILE)) {
console.error(`[mock-upstream] no routes file at ${ROUTES_FILE}`);
process.exit(1);
}
let routes;
try {
routes = JSON.parse(readFileSync(ROUTES_FILE, "utf8"));
} catch (err) {
console.error(`[mock-upstream] failed to parse ${ROUTES_FILE}:`, err);
process.exit(1);
}
console.log(`[mock-upstream] loaded ${Object.keys(routes).length} routes from ${ROUTES_FILE}`);
createServer((req, res) => {
const path = req.url?.split("?")[0] ?? "/";
if (path === "/__health") {
res.statusCode = 200;
res.setHeader("content-type", "application/json");
res.end(JSON.stringify({ status: "ok" }));
return;
}
const file = routes[path];
if (!file) {
console.warn(`[mock-upstream] 404 ${req.method} ${path}`);
res.statusCode = 404;
res.setHeader("content-type", "application/json");
res.end(JSON.stringify({ error: "no fixture", path }));
return;
}
const filePath = resolve(FIXTURE_DIR, file);
if (!filePath.startsWith(resolve(FIXTURE_DIR))) {
res.statusCode = 400;
res.end("bad fixture path");
return;
}
try {
const body = readFileSync(filePath);
res.statusCode = 200;
res.setHeader("content-type", file.endsWith(".json") ? "application/json" : "text/plain");
res.end(body);
console.log(`[mock-upstream] 200 ${req.method} ${path} -> ${file}`);
} catch (err) {
console.error(`[mock-upstream] 500 ${req.method} ${path}:`, err);
res.statusCode = 500;
res.end("fixture read failed");
}
}).listen(PORT, () => {
console.log(`[mock-upstream] listening on :${PORT}`);
});
+50
View File
@@ -0,0 +1,50 @@
// CI-only stub seeder. Emits a known-good GeoEntity[] payload under the
// plugin id provided via STUB_PLUGIN_ID. Used by plugin-CI to isolate
// frontend wiring from real backend health.
//
// NOTE: This bypasses ADR-0002's compile-time name rule on purpose — the
// data engine reads `name` once at load time, so an env-driven name is
// fine in CI. Do NOT copy this pattern into real seeders.
const pluginId = process.env.STUB_PLUGIN_ID;
if (!pluginId) {
console.error("[stub-seeder] STUB_PLUGIN_ID env var is required");
process.exit(1);
}
function makeEntities() {
const now = new Date().toISOString();
return [
{
id: `${pluginId}-stub-1`,
pluginId,
latitude: 0,
longitude: 0,
altitude: 0,
timestamp: now,
label: "Stub entity 1",
properties: { source: "ci-stub" },
},
{
id: `${pluginId}-stub-2`,
pluginId,
latitude: 10,
longitude: 10,
altitude: 0,
timestamp: now,
label: "Stub entity 2",
properties: { source: "ci-stub" },
},
];
}
export default {
name: pluginId,
// Run immediately and every 10s — CI doesn't wait for cron schedules
cron: "*/10 * * * * *",
fn: async (ctx) => {
const entities = makeEntities();
await ctx.setLiveSnapshot(pluginId, entities, 300);
console.log(`[stub-seeder] emitted ${entities.length} entities for ${pluginId}`);
},
};
+7
View File
@@ -0,0 +1,7 @@
{
"name": "stub-seeder",
"version": "0.1.0",
"type": "module",
"main": "dist/index.mjs",
"private": true
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "worldwideview",
"version": "2.48.18",
"version": "2.48.19",
"private": true,
"type": "module",
"packageManager": "[email protected]",
+55
View File
@@ -0,0 +1,55 @@
# @worldwideview/wwv-ci-probe
CI probe — asserts plugin/seeder integration health for the WorldWideView ecosystem.
Used by the smoke-test workflows in [`wwv-plugins`](https://github.com/silvertakana/wwv-plugins), [`wwv-seeders-community`](https://github.com/silvertakana/wwv-seeders-community), and [`wwv-seeders-private`](https://github.com/silvertakana/wwv-seeders-private).
## Install
```bash
# Via npx (recommended in CI)
npx --yes @worldwideview/wwv-ci-probe <subcommand>
# Or as a dev dependency
pnpm add -D @worldwideview/wwv-ci-probe
```
## Subcommands
### `seeder <name>`
Polls Redis for `data:<name>:live` and validates the payload shape. Accepts `GeoEntity[]`, `{ items: [...] }`, or `{ <key>: [...] }`. Use this in seeder CI after booting the data engine against a mock upstream.
```bash
wwv-probe seeder aviation --redis redis://localhost:6379 --timeout 60000
```
### `ws <name>`
Connects to the data engine's `/stream` WebSocket and waits for a `data` message matching the given `pluginId`. Validates the same payload shapes as `seeder`. Use this when you want to assert the engine is broadcasting (not just persisting).
```bash
wwv-probe ws aviation --url ws://localhost:5000/stream --timeout 30000
```
### `id-contract <seederDist>`
Statically validates that a compiled seeder exports a kebab-case `name` (ADR-0002). Optionally checks the name matches an expected id.
```bash
wwv-probe id-contract ./dist/index.mjs --expect aviation
```
## Plugin smoke testing — not in this probe
The probe deliberately does **not** include a `plugin` subcommand. Plugin smoke tests need to exercise the full Next.js + Cesium frontend (plugin bundle loading, `mapWebsocketPayload`, DataBus wiring), which requires a real browser via Playwright.
The `wwv-plugins` repo writes its own Playwright spec for that — it reuses the auth bootstrap pattern from `worldwideview/tests/global.setup.ts` (insert test user + `InstalledPlugin` row, UI login to capture `storageState.json`, then run the plugin-toggle smoke).
Keeping that logic inside `wwv-plugins` avoids coupling this probe to `@playwright/test` and to the specific UI structure of the Next.js frontend.
## Exit codes
- `0` — assertion passed within the timeout
- `1` — assertion failed (timeout exceeded, invalid payload shape, or contract violation)
- `2` — fatal probe error (unhandled exception)
+30
View File
@@ -0,0 +1,30 @@
{
"name": "@worldwideview/wwv-ci-probe",
"version": "0.1.0",
"type": "module",
"description": "CI probe — asserts plugin/seeder integration health (ADR-0002, WS payload contract, Redis snapshots)",
"main": "dist/index.js",
"bin": {
"wwv-probe": "dist/index.js"
},
"files": [
"dist",
"README.md"
],
"scripts": {
"build": "tsc",
"dev": "tsc --watch",
"clean": "rm -rf dist",
"prepublishOnly": "tsc"
},
"dependencies": {
"commander": "^14.0.3",
"ioredis": "^5.4.1",
"ws": "^8.18.0"
},
"devDependencies": {
"@types/node": "^25.9.1",
"@types/ws": "^8.5.13",
"typescript": "^5.0.0"
}
}
+51
View File
@@ -0,0 +1,51 @@
import { pathToFileURL } from "node:url";
import { resolve } from "node:path";
const KEBAB_RE = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
/**
* Validates ADR-0002: a seeder's exported `name` field must be kebab-case
* and (optionally) match an expected plugin id.
*
* @returns true if the contract holds; false (with stderr explanation) otherwise.
*/
export async function probeIdContract(opts: {
seederDist: string;
expectId?: string;
}): Promise<boolean> {
const absPath = resolve(opts.seederDist);
let mod: any;
try {
mod = await import(pathToFileURL(absPath).href);
} catch (err) {
console.error(`[id-contract] failed to import ${absPath}:`, err);
return false;
}
const seeder = mod.default ?? mod;
if (!seeder || typeof seeder !== "object") {
console.error(`[id-contract] ${absPath} has no default export (or export is not an object)`);
return false;
}
const name = seeder.name;
if (typeof name !== "string" || name.length === 0) {
console.error(`[id-contract] seeder default export missing required string field 'name'`);
return false;
}
if (!KEBAB_RE.test(name)) {
console.error(`[id-contract] seeder name "${name}" is not valid kebab-case (must match ${KEBAB_RE})`);
return false;
}
if (opts.expectId && opts.expectId !== name) {
console.error(
`[id-contract] seeder name "${name}" does not match expected plugin id "${opts.expectId}" (ADR-0002 violation)`,
);
return false;
}
console.log(`[id-contract] OK — seeder name "${name}"${opts.expectId ? ` matches expected id` : ""}`);
return true;
}
+60
View File
@@ -0,0 +1,60 @@
#!/usr/bin/env node
import { Command } from "commander";
import { probeSeeder } from "./seeder.js";
import { probeWs } from "./ws.js";
import { probeIdContract } from "./id-contract.js";
const program = new Command();
program
.name("wwv-probe")
.description("WorldWideView CI probe — asserts plugin/seeder integration health")
.version("0.1.0");
program
.command("seeder")
.description("Wait for Redis key data:<name>:live to be populated and validate payload shape")
.argument("<name>", "Canonical plugin id (kebab-case)")
.option("--redis <url>", "Redis URL", "redis://localhost:6379")
.option("--timeout <ms>", "Timeout in milliseconds", "60000")
.action(async (name: string, opts: { redis: string; timeout: string }) => {
const ok = await probeSeeder({
name,
redisUrl: opts.redis,
timeoutMs: Number(opts.timeout),
});
process.exit(ok ? 0 : 1);
});
program
.command("ws")
.description("Connect to engine /stream and wait for a data payload for the given pluginId")
.argument("<name>", "Canonical plugin id (kebab-case)")
.option("--url <url>", "WebSocket URL", "ws://localhost:5000/stream")
.option("--timeout <ms>", "Timeout in milliseconds", "30000")
.action(async (name: string, opts: { url: string; timeout: string }) => {
const ok = await probeWs({
name,
wsUrl: opts.url,
timeoutMs: Number(opts.timeout),
});
process.exit(ok ? 0 : 1);
});
program
.command("id-contract")
.description("Verify seeder dist exports a kebab-case name matching the expected plugin id (ADR-0002)")
.argument("<seederDist>", "Path to compiled seeder dist/index.mjs")
.option("--expect <id>", "Expected plugin id (if omitted, only validates kebab-case)")
.action(async (seederDist: string, opts: { expect?: string }) => {
const ok = await probeIdContract({
seederDist,
expectId: opts.expect,
});
process.exit(ok ? 0 : 1);
});
program.parseAsync().catch((err) => {
console.error("[wwv-probe] fatal:", err);
process.exit(2);
});
@@ -0,0 +1,38 @@
import { describe, it, expect } from "vitest";
import { validatePayloadValue, validatePayloadString } from "./payloadShape.js";
describe("validatePayloadValue", () => {
it("accepts a non-empty GeoEntity array", () => {
expect(validatePayloadValue([{ id: "a" }])).toEqual({ ok: true, shape: "geo-entity-array" });
});
it("rejects an empty array", () => {
expect(validatePayloadValue([])).toEqual({ ok: false, reason: "GeoEntity[] is empty" });
});
it("accepts a non-empty items object", () => {
expect(validatePayloadValue({ items: [1] })).toEqual({ ok: true, shape: "items-object" });
});
it("rejects an empty items array", () => {
expect(validatePayloadValue({ items: [] })).toEqual({ ok: false, reason: "items[] is empty" });
});
it("accepts a single named collection", () => {
expect(validatePayloadValue({ quakes: [1, 2] })).toEqual({ ok: true, shape: "named-collection" });
});
it("rejects an object with no array field", () => {
const r = validatePayloadValue({ a: 1, b: 2 });
expect(r.ok).toBe(false);
});
it("rejects a non-object, non-array value", () => {
const r = validatePayloadValue(42);
expect(r.ok).toBe(false);
});
});
describe("validatePayloadString", () => {
it("parses then validates", () => {
expect(validatePayloadString('[{"id":"x"}]')).toEqual({ ok: true, shape: "geo-entity-array" });
});
it("rejects invalid JSON", () => {
const r = validatePayloadString("{not json");
expect(r.ok).toBe(false);
});
});
+59
View File
@@ -0,0 +1,59 @@
/**
* Shared payload-shape validator for the WWV data contract (data-engine-architecture.md §7).
* A valid live payload is one of three non-empty shapes:
* - geo-entity-array: a top-level non-empty array
* - items-object: an object with a non-empty `items` array
* - named-collection: an object whose single array-valued key is non-empty
*/
export type PayloadShape = "geo-entity-array" | "items-object" | "named-collection";
export type PayloadValidation =
| { ok: true; shape: PayloadShape }
| { ok: false; reason: string };
/**
* Validate an already-parsed payload value.
* @param p - parsed JSON value
* @returns ok with the detected shape, or a reason for rejection
*/
export function validatePayloadValue(p: unknown): PayloadValidation {
if (Array.isArray(p)) {
return p.length > 0
? { ok: true, shape: "geo-entity-array" }
: { ok: false, reason: "GeoEntity[] is empty" };
}
if (p && typeof p === "object") {
const obj = p as Record<string, unknown>;
if (Array.isArray(obj.items)) {
return obj.items.length > 0
? { ok: true, shape: "items-object" }
: { ok: false, reason: "items[] is empty" };
}
const arrayKeys = Object.keys(obj).filter((k) => Array.isArray(obj[k]));
if (arrayKeys.length === 1) {
const arr = obj[arrayKeys[0]] as unknown[];
return arr.length > 0
? { ok: true, shape: "named-collection" }
: { ok: false, reason: `${arrayKeys[0]}[] is empty` };
}
return {
ok: false,
reason: `payload object has no recognizable array field (keys: ${Object.keys(obj).join(", ")})`,
};
}
return { ok: false, reason: `payload is neither array nor object (typeof=${typeof p})` };
}
/**
* Parse a raw JSON string, then validate the resulting value's shape.
* @param raw - raw JSON string from Redis
*/
export function validatePayloadString(raw: string): PayloadValidation {
let parsed: unknown;
try {
parsed = JSON.parse(raw);
} catch (err) {
return { ok: false, reason: `not valid JSON (${(err as Error).message})` };
}
return validatePayloadValue(parsed);
}
+52
View File
@@ -0,0 +1,52 @@
import { Redis } from "ioredis";
import { validatePayloadString } from "./payloadShape.js";
/**
* Polls Redis for `data:<name>:live` and validates that the seeder produced a
* non-empty payload in one of the three accepted shapes (see
* data-engine-architecture.md §7).
*
* @returns true if a valid payload arrived within the timeout; false otherwise.
*/
export async function probeSeeder(opts: {
name: string;
redisUrl: string;
timeoutMs: number;
}): Promise<boolean> {
const redis = new Redis(opts.redisUrl, { lazyConnect: true, maxRetriesPerRequest: 1 });
const key = `data:${opts.name}:live`;
const deadline = Date.now() + opts.timeoutMs;
const pollIntervalMs = 1000;
try {
await redis.connect();
} catch (err) {
console.error(`[seeder] cannot connect to Redis at ${opts.redisUrl}:`, err);
return false;
}
console.log(`[seeder] waiting for ${key} (timeout ${opts.timeoutMs}ms)`);
while (Date.now() < deadline) {
const raw = await redis.get(key);
if (raw && raw.length > 0) {
const validation = validatePayloadString(raw);
await redis.quit();
if (!validation.ok) {
console.error(`[seeder] payload present but invalid: ${validation.reason}`);
return false;
}
console.log(`[seeder] OK — ${key} populated (shape: ${validation.shape}, bytes: ${raw.length})`);
return true;
}
await sleep(pollIntervalMs);
}
await redis.quit();
console.error(`[seeder] timed out — ${key} never populated within ${opts.timeoutMs}ms`);
return false;
}
function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
+70
View File
@@ -0,0 +1,70 @@
import WebSocket from "ws";
import { validatePayloadValue } from "./payloadShape.js";
/**
* Connects to the data-engine's /stream WebSocket and resolves when a
* `{ type: "data", pluginId: <name>, payload: ... }` message arrives for the
* given plugin id (see data-engine-architecture.md §7).
*
* Rejects with exit code 1 if no matching payload arrives within the timeout
* — which is the signature of an ADR-0002 id mismatch or a silently-dropped
* object payload.
*/
export async function probeWs(opts: {
name: string;
wsUrl: string;
timeoutMs: number;
}): Promise<boolean> {
return new Promise((resolve) => {
const ws = new WebSocket(opts.wsUrl);
let settled = false;
const timer = setTimeout(() => {
if (settled) return;
settled = true;
console.error(
`[ws] timed out — no data message with pluginId="${opts.name}" in ${opts.timeoutMs}ms ` +
`(check ADR-0002 seeder.name vs plugin id, and that the seeder is producing data)`,
);
ws.terminate();
resolve(false);
}, opts.timeoutMs);
ws.on("open", () => {
console.log(`[ws] connected to ${opts.wsUrl}, waiting for pluginId="${opts.name}"`);
});
ws.on("message", (raw) => {
let msg: any;
try {
msg = JSON.parse(raw.toString());
} catch {
return;
}
if (msg?.type !== "data" || msg.pluginId !== opts.name) return;
if (settled) return;
const payload = msg.payload;
const valid = validatePayloadValue(payload);
if (!valid.ok) {
console.error(`[ws] received message for "${opts.name}" but payload invalid: ${valid.reason}`);
// Keep waiting — a later message might be valid.
return;
}
settled = true;
clearTimeout(timer);
console.log(`[ws] OK — received valid payload for "${opts.name}" (shape: ${valid.shape})`);
ws.close();
resolve(true);
});
ws.on("error", (err) => {
if (settled) return;
settled = true;
clearTimeout(timer);
console.error(`[ws] connection error:`, err);
resolve(false);
});
});
}
+16
View File
@@ -0,0 +1,16 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noEmit": false
},
"include": ["src/**/*"]
}
+371
View File
@@ -234,6 +234,276 @@ importers:
specifier: ^4.1.7
version: 4.1.8(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
local-plugins/wwv-plugin-air-defense:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
devDependencies:
'@types/node':
specifier: ^22.0.0
version: 22.19.19
'@types/react':
specifier: ^19.0.0
version: 19.2.16
typescript:
specifier: ^5.0.0
version: 5.9.3
local-plugins/wwv-plugin-airports:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
local-plugins/wwv-plugin-aviation:
dependencies:
'@worldwideview/wwv-lib-aviation':
specifier: workspace:*
version: link:../../packages/wwv-lib-aviation
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
lucide-react:
specifier: '>=0.576.0'
version: 1.17.0([email protected])
local-plugins/wwv-plugin-borders:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
local-plugins/wwv-plugin-camera:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
lucide-react:
specifier: '>=0.576.0'
version: 1.17.0([email protected])
react:
specifier: '>=18'
version: 19.2.7
local-plugins/wwv-plugin-civil-unrest:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
cesium:
specifier: ^1.139.0
version: 1.142.0
lucide-react:
specifier: ^0.477.0
version: 0.477.0([email protected])
react:
specifier: ^19.0.0
version: 19.2.7
resium:
specifier: 1.19.4
version: 1.19.4([email protected])([email protected]([email protected]))([email protected])
devDependencies:
'@vitejs/plugin-react':
specifier: ^6.0.1
version: 6.0.2([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
vite:
specifier: ^8.0.8
version: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
local-plugins/wwv-plugin-conflict-events:
dependencies:
'@worldwideview/wwv-lib-incidents':
specifier: workspace:*
version: link:../../packages/wwv-lib-incidents
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
cesium:
specifier: ^1.139.0
version: 1.142.0
lucide-react:
specifier: ^0.477.0
version: 0.477.0([email protected])
react:
specifier: ^19.0.0
version: 19.2.7
resium:
specifier: 1.19.4
version: 1.19.4([email protected])([email protected]([email protected]))([email protected])
devDependencies:
'@vitejs/plugin-react':
specifier: ^6.0.1
version: 6.0.2([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
vite:
specifier: ^8.0.8
version: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
local-plugins/wwv-plugin-cyber-attacks:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
lucide-react:
specifier: ^1.14.0
version: 1.17.0([email protected])
devDependencies:
'@vitejs/plugin-react':
specifier: ^6.0.1
version: 6.0.2([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
vite:
specifier: ^8.0.8
version: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
local-plugins/wwv-plugin-earthquakes:
dependencies:
'@worldwideview/wwv-lib-incidents':
specifier: workspace:*
version: link:../../packages/wwv-lib-incidents
'@worldwideview/wwv-plugin-sdk':
specifier: ^1.4.10
version: 1.5.0([email protected])
lucide-react:
specifier: ^1.14.0
version: 1.17.0([email protected])
local-plugins/wwv-plugin-fortiguard:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
devDependencies:
typescript:
specifier: ^5.0.0
version: 5.9.3
local-plugins/wwv-plugin-gps-jamming:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
cesium:
specifier: ^1.139.0
version: 1.142.0
h3-js:
specifier: ^4.4.0
version: 4.4.0
lucide-react:
specifier: ^0.477.0
version: 0.477.0([email protected])
react:
specifier: ^19.0.0
version: 19.2.7
resium:
specifier: 1.19.4
version: 1.19.4([email protected])([email protected]([email protected]))([email protected])
devDependencies:
'@vitejs/plugin-react':
specifier: ^6.0.1
version: 6.0.2([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
vite:
specifier: ^8.0.8
version: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
local-plugins/wwv-plugin-international-sanctions:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
lucide-react:
specifier: ^1.14.0
version: 1.17.0([email protected])
devDependencies:
'@vitejs/plugin-react':
specifier: ^6.0.1
version: 6.0.2([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
vite:
specifier: ^8.0.8
version: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
local-plugins/wwv-plugin-iranwarlive:
dependencies:
'@worldwideview/wwv-lib-incidents':
specifier: workspace:*
version: link:../../packages/wwv-lib-incidents
'@worldwideview/wwv-plugin-sdk':
specifier: ^1.4.10
version: 1.5.0([email protected])
local-plugins/wwv-plugin-maritime:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
lucide-react:
specifier: '>=0.576.0'
version: 1.17.0([email protected])
local-plugins/wwv-plugin-military-aviation:
dependencies:
'@worldwideview/wwv-lib-aviation':
specifier: workspace:*
version: link:../../packages/wwv-lib-aviation
'@worldwideview/wwv-plugin-sdk':
specifier: ^1.4.10
version: 1.5.0([email protected])
lucide-react:
specifier: '>=0.576.0'
version: 1.17.0([email protected])
local-plugins/wwv-plugin-nz-traffic-cameras:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
devDependencies:
'@types/node':
specifier: ^20.0.0
version: 20.19.41
typescript:
specifier: ^5.0.0
version: 5.9.3
vitest:
specifier: ^4.1.8
version: 4.1.8(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
local-plugins/wwv-plugin-satellite:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: ^1.4.10
version: 1.5.0([email protected])
local-plugins/wwv-plugin-wildfire:
dependencies:
'@worldwideview/wwv-plugin-sdk':
specifier: workspace:*
version: link:../../packages/wwv-plugin-sdk
lucide-react:
specifier: '>=0.576.0'
version: 1.17.0([email protected])
packages/wwv-ci-probe:
dependencies:
commander:
specifier: ^14.0.3
version: 14.0.3
ioredis:
specifier: ^5.4.1
version: 5.11.0
ws:
specifier: ^8.18.0
version: 8.21.0
devDependencies:
'@types/node':
specifier: ^25.9.1
version: 25.9.1
'@types/ws':
specifier: ^8.5.13
version: 8.18.1
typescript:
specifier: ^5.0.0
version: 5.9.3
packages/wwv-cli:
dependencies:
commander:
@@ -2056,6 +2326,12 @@ packages:
'@types/[email protected]':
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
'@types/[email protected]':
resolution: {integrity: sha512-ECymXOukMnOoVkC2bb1Vc/w/836DXncOg5m8Xj1RH7xSHZJWNYY6Zh7EH477vcnD5egKNNfy2RpNOmuChhFPgQ==}
'@types/[email protected]':
resolution: {integrity: sha512-dyh/xO2Fh5bYrfWaaqGrRQQGkNdmYw6AmaAUvYeUMNTWQtvb796ikLdmTchRmOlOiIJ1TDXfWgVx1QkUlQ6Hew==}
'@types/[email protected]':
resolution: {integrity: sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg==}
@@ -3508,6 +3784,10 @@ packages:
[email protected]:
resolution: {integrity: sha512-5ykVn/EXM1hF0XCaWh05VbYvEiOL2lY1kBxZtaYsyvjp7cmWOU1XsAdfQBwClraEofXDT197lFbXOEVMHpvQOg==}
[email protected]:
resolution: {integrity: sha512-DvJh07MhGgY2KcC4OeZc8SSyA+ZXpdvoh6uCzGpoKvWtZxJB+g6VXXC1+eWYkaMIsLz7J/ErhOalHCpcs1KYog==}
engines: {node: '>=4', npm: '>=3', yarn: '>=1.3.0'}
[email protected]:
resolution: {integrity: sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==}
engines: {node: '>=4'}
@@ -4061,6 +4341,11 @@ packages:
resolution: {integrity: sha512-DqC6n3QQ77zdFpCMASA1a3Jlb64Hv2N2DciFGkO/4L9+q/IpIAuRlKOvCXabtRW6cQf8usbmM6BE/TOPysCdIA==}
engines: {bun: '>=1.0.0', deno: '>=1.30.0', node: '>=8.0.0'}
[email protected]:
resolution: {integrity: sha512-yCf7aYxerFZAbd8jHJxjwe1j7jEMPptjnaOqdYeirFnEy85cNR3/L+o0I875CYFYya+eEVzZSbNuRk8BZPDpVw==}
peerDependencies:
react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
[email protected]:
resolution: {integrity: sha512-9FA9evdox/JQL5PT57fdA1x/yg8T7knJ98+zjTL3UfKza6pflQUUh3XtaQIHKvnsJw1lmsEyHVlt5jchYxOQ5w==}
peerDependencies:
@@ -4712,6 +4997,14 @@ packages:
resolution: {integrity: sha512-QT7FVMXfWOYFbeRBF6nu+I6tr2Tf3u0q8RIEjNob/heKY/nh7drD/k7eeMFmSQgnTtCzLDcCu/XEnpW2wk4xCQ==}
engines: {node: '>=9.3.0 || >=8.10.0 <9.0.0'}
[email protected]:
resolution: {integrity: sha512-RW0ffHlQUbgqbc0jDaF2Dnor/GKbiz5s5AKdamEKxMJfxiwQNgtgfaKK7UvafFpX25Y2J4DZP1MclTlEQ/5YUw==}
engines: {node: '>=20.19.0'}
peerDependencies:
cesium: 1.x
react: '>=18.2.0'
react-dom: '>=18.2.0'
[email protected]:
resolution: {integrity: sha512-pR+ySBudmCstgYOBFY+qcPQt0+xPmsdhSkD3u7JBfaiHcx/pxyuigjYoL0ET7Ak2a2uZ7jEu47cdZKThZx8A5w==}
engines: {node: '>=20.19.0'}
@@ -5265,6 +5558,9 @@ packages:
[email protected]:
resolution: {integrity: sha512-DXtD3ZtEQzc7M8m4cXotyHR+FAS18C64asBYY5vqZexfYryNNnDc02W4hKg3rdQuqOYas1jkseX0+nZXjTXnvQ==}
[email protected]:
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
[email protected]:
resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==}
@@ -7324,6 +7620,14 @@ snapshots:
'@types/[email protected]': {}
'@types/[email protected]':
dependencies:
undici-types: 6.21.0
'@types/[email protected]':
dependencies:
undici-types: 6.21.0
'@types/[email protected]':
dependencies:
undici-types: 7.24.6
@@ -7548,6 +7852,14 @@ snapshots:
chai: 6.2.2
tinyrainbow: 3.1.0
'@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':
dependencies:
'@vitest/spy': 4.1.8
estree-walker: 3.0.3
magic-string: 0.30.21
optionalDependencies:
vite: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
'@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))':
dependencies:
'@vitest/spy': 4.1.8
@@ -9060,6 +9372,8 @@ snapshots:
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]:
@@ -9598,6 +9912,10 @@ snapshots:
[email protected]: {}
[email protected]([email protected]):
dependencies:
react: 19.2.7
[email protected]([email protected]):
dependencies:
react: 19.2.7
@@ -10269,6 +10587,12 @@ snapshots:
transitivePeerDependencies:
- supports-color
[email protected]([email protected])([email protected]([email protected]))([email protected]):
dependencies:
cesium: 1.142.0
react: 19.2.7
react-dom: 19.2.7([email protected])
[email protected]([email protected])([email protected]([email protected]))([email protected]):
dependencies:
cesium: 1.142.0
@@ -10912,6 +11236,8 @@ snapshots:
[email protected]: {}
[email protected]: {}
[email protected]: {}
[email protected]: {}
@@ -10994,6 +11320,21 @@ snapshots:
'@vimeo/player': 2.29.0
media-played-ranges-mixin: 0.1.0
[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]):
dependencies:
lightningcss: 1.32.0
picomatch: 4.0.4
postcss: 8.5.15
rolldown: 1.0.3
tinyglobby: 0.2.17
optionalDependencies:
'@types/node': 20.19.41
esbuild: 0.28.0
fsevents: 2.3.3
jiti: 2.7.0
terser: 5.48.0
tsx: 4.22.4
[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]):
dependencies:
lightningcss: 1.32.0
@@ -11009,6 +11350,36 @@ snapshots:
terser: 5.48.0
tsx: 4.22.4
[email protected](@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])):
dependencies:
'@vitest/expect': 4.1.8
'@vitest/mocker': 4.1.8([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))
'@vitest/pretty-format': 4.1.8
'@vitest/runner': 4.1.8
'@vitest/snapshot': 4.1.8
'@vitest/spy': 4.1.8
'@vitest/utils': 4.1.8
es-module-lexer: 2.1.0
expect-type: 1.3.0
magic-string: 0.30.21
obug: 2.1.1
pathe: 2.0.3
picomatch: 4.0.4
std-env: 4.1.0
tinybench: 2.9.0
tinyexec: 1.2.4
tinyglobby: 0.2.17
tinyrainbow: 3.1.0
vite: 8.0.16(@types/[email protected])([email protected])([email protected])([email protected])([email protected])
why-is-node-running: 2.3.0
optionalDependencies:
'@opentelemetry/api': 1.9.1
'@types/node': 20.19.41
'@vitest/coverage-v8': 4.1.8([email protected])
jsdom: 28.1.0
transitivePeerDependencies:
- msw
[email protected](@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])):
dependencies:
'@vitest/expect': 4.1.8