Adds North Carolina DOT as a sixth source for `/api/camera/traffic`.
~770 cameras statewide, no API key required, direct JPEG snapshots.
NCDOT exposes a two-step API: a bulk endpoint that returns only
`{ id, latitude, longitude }` per camera, and a per-camera detail
endpoint with the rest (locationName, mileMarker, roadId, countyId,
imageURL, status). The adapter fans out the detail fetches with a
bounded concurrency of 20, lands the initial population in ~15 seconds,
and the registry's per-adapter cache holds it for 24h after that.
Cameras with `status !== "OK"` are filtered out. The adapter is built
on top of the CameraAdapter pattern introduced in the camera adapter
refactor PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Two related bugs in the local-engine detection path:
1. Hardcoded port 5000 — should be 5001
wwv-data-engine's docker-compose.yaml binds the engine to port 5001
(and has since the v2 refactor), but engineManifest.ts polls
`localhost:5000/manifest` to detect it. The detection always
reported "no local engine" even when one was running, falling back
to the cloud engine on every plugin toggle.
Bonus pain: macOS hijacks port 5000 for the AirPlay Receiver, which
returns 403 to any GET request. On any macOS dev machine, this
produced a misleading 403 in the browser console even when no
engine was running at all. Famous local-dev gotcha that ate dev
time.
2. NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL is ignored
Every other code path in the app honors this env var as the
override for the engine URL — `resolveEngineUrl`, plugin context
injection, the radio-garden plugin, etc. But `engineManifest` ran
its own detection independently against hardcoded localhost. So
even when the operator pointed plugins at a custom engine URL,
manifest detection failed silently.
Fix: read `NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL` first (normalizing
ws[s]:// → http[s]:// and stripping a trailing /stream), then fall
back to localhost:5001 if not set. Same approach used elsewhere in
the codebase.
Side effects:
- Symptoms in the browser console downstream of this bug (notably
the spurious 403 on `localhost:5000/manifest` and the cascade of
"seeder not running" 404s when plugins fall back to the cloud
engine that doesn't have that seeder) clear up.
- Existing engineManifest unit tests still pass — they mock fetch
and don't care about the URL shape.
Worth adding a test for the env-var precedence in a follow-up; left
out of this PR to keep the diff to the one-file behaviour fix.
The setup page's `.logo` and `.button` rules use
`rgb(var(--accent-rgb, 200, 30, 30))`. Because CSS `var()` only treats
the value after the first comma as the *fallback*, the syntax
intends "use --accent-rgb if defined, otherwise fall back to
`200, 30, 30`."
The fallback never triggers in practice: `theme-tokens.css` defines
`--accent-rgb: 255, 255, 255` at the `:root` level, so the variable
is always set when the setup page renders. `rgb(255, 255, 255)`
combined with the rules' `color: #fff` gives white-on-white — the
"Sign In" button text and the "W" logo are invisible on the page.
The setup flow is pre-auth and pre-theme; it shouldn't be inheriting
the accent. Replace the var() lookups with an explicit brand red
(`rgb(200, 30, 30)`) so the page is readable regardless of which
theme is active in the rest of the app.
Affected rules: `.logo` background, `.button` background, `.input:focus`
border. Three identical edits.
Consolidates four overlapping test-infra PRs (#113, #114, #117, #118)
into a single coherent batch. Each contributing PR has redundancies
with one or more of the others; together they ship a real ~134-test
expansion of the unit suite plus mutation-testing infrastructure.
Same shape as #110 / #111: small, focused, behavior-pinning tests
against load-bearing systems. Each test answers one question — *what
specific regression does it catch that I'd otherwise find from a user
bug report?* Tests pin observable contracts (events emitted, cache
entries written, public-API state) rather than internal mechanics, so
they survive refactors during the longer-term migration toward the
six-interface architecture.
## What's in this PR
### Stryker mutation testing (new in this batch)
- `stryker.config.json` — hybrid config: `coverageAnalysis: "perTest"`
for the 5–10× speedup on a real codebase, `ignoreStatic: true` to
drop false-positive mutants in module-load code, and a `mutate`
scope of `src/core/**` + `src/lib/**` covering the logic-heavy
layers without dragging the React component surface into noise.
- `.github/workflows/mutation-testing.yml` — runs Stryker on a weekly
schedule (Sundays 22:00 US Eastern / 03:00 UTC Monday) plus
`workflow_dispatch` for on-demand validation. Per-PR triggering
would be too expensive (10–30 min per run even with `perTest`).
- `package.json` — adds `@stryker-mutator/core`, `@stryker-mutator/vitest-runner`,
and `fast-check` as devDependencies. New `test:mutate` script.
### New test files (22 added)
Plugin lifecycle and loaders:
- `src/core/plugins/PluginManager.test.ts` — orchestrator lifecycle:
register, enable, disable, data-flow contract, getAllEntities
filters by enabled, updateTimeRange, destroy, togglePlugin,
loadFromManifest. 11 tests.
- `src/core/plugins/loadPluginFromManifest.test.ts`
- `src/core/plugins/validateManifest.test.ts`
- `src/core/plugins/loaders/mapGeoJsonToEntities.test.ts`
- `src/core/plugins/loaders/mapJsonToEntities.test.ts`
Data layer:
- `src/core/data/DataUtils.test.ts`
- `src/core/data/WsClient.test.ts`
State (9 Zustand slices + the integration tests):
- `src/core/state/StateSlices.test.ts`
- `src/core/state/configSlice.test.ts`
- `src/core/state/dataSlice.test.ts`
- `src/core/state/favoritesSlice.test.ts`
- `src/core/state/filterSlice.test.ts`
- `src/core/state/geojsonSlice.test.ts`
- `src/core/state/globeSlice.test.ts`
- `src/core/state/layersSlice.test.ts`
- `src/core/state/timelineSlice.test.ts`
- `src/core/state/uiSlice.test.ts`
Filters:
- `src/core/filters/filterEngine.test.ts`
Library:
- `src/lib/AuthConfig.test.ts`
- `src/lib/analytics.test.ts`
- `src/lib/origin.test.ts`
### Test files extended (9 modified)
Property-based and edge-case additions to existing tests, drawn from
the upstream PRs:
- `src/core/plugins/loaders/getNestedValue.test.ts` (+46 lines)
- `src/lib/geojson/converter.test.ts` (+31)
- `src/lib/geojson/normalizer.test.ts` (+52)
- `src/lib/rateLimit.test.ts` (+44)
- `src/core/plugins/loaders/DeclarativePlugin.test.ts` (+147 — type
fixes for `DataSourceConfig.method`/`pollInterval`/`format`)
- `src/lib/marketplace/cors.test.ts` (+5)
- `src/lib/marketplace/marketplaceToken.test.ts` (+21)
- `src/core/filters/filterEngine.test.ts` (type-corrected — uses
`latitude`/`longitude` not `position.lat`/`lon`, nested
`range: { min, max, step }` config, etc.)
## What's *not* in this PR (intentionally)
- **Duplicate tests for code already on main.** #113 originally
included `.spec.ts` versions of `CacheLayer`, `DataBus`,
`PollingManager`, `cors`, `marketplaceToken`, `repository`,
`rateLimit`, `edition`, and `seedDefaultPlugins` — all of which are
already tested via `.test.ts` files on main from #110 + prior. Vitest
picks up both `.test.ts` and `.spec.ts`, so keeping both would double
the maintenance burden without adding signal. Dropped.
- **Tautological tests.** A few accessors-only tests from #113
(`getEntities` returning the cached array, `getAllPlugins().length`
equals N) were dropped per the test-writing bar set on #110/#111:
each test must catch a specific bug class that two different broken
implementations would fail differently on.
- **`version` bump in `package.json`.** Three of the contributing PRs
bumped the version line independently (2.9.5, 2.9.10, 2.9.10), each
conflicting with the others. Reserve version bumps for explicit
release commits — feature/test PRs should leave the version field
alone to avoid this conflict hairball.
- **A duplicate `stryker.conf.json`.** #114 used that filename; #117
used `stryker.config.json`. Stryker accepts both but only loads one
(alphabetical resolution). Picked `stryker.config.json` as the
canonical name.
## Verification
```
Test Files 38 passed (38)
Tests 271 passed (271)
```
137 tests on main before this PR; +134 from this consolidation, no
regressions. Type check clean (`pnpm exec tsc --noEmit`).
## Replaces
- PR #113 (test/improve-coverage) — most of its 18 truly-new files
are included here; the 9 duplicate-of-main entries are not.
- PR #114 (chore/stryker-setup) — its CI workflow shape is here with
the trigger changed to weekly+manual instead of per-PR.
- PR #117 (chore/stryker-and-fast-check) — its full deps and test
additions are here.
- PR #118 (test/improve-project-coverage) — the type-corrected
versions of its 6 test files are here, including the typefix commit
pushed to that branch earlier.
Each of those PRs should be closed once this lands, with a comment
referencing this PR for credit.
Co-Authored-By: silvertakana <[email protected]>
This commit includes the work done by the Flash subagent to add comprehensive TSDoc comments to src/components/panels, src/core/state, and src/core/plugins, improving IDE intellisense and codebase maintainability.
Replace direct Ion fallback with a 3-tier chain per maintainer feedback:
1. Google XYZ tiles (free, no API key)
2. Bing via Cesium Ion (free shared token)
3. OSM as last resort
useImageryManager catch block still falls to OSM if createImageryProvider
throws at runtime (e.g. direct Bing key failure, ArcGIS down).
WorldWideView's Vitest setup is already wired and CI already runs
\`pnpm test\` on every PR. What's missing is tests for the systems
that actually break: the plugin lifecycle plumbing (data bus, cache,
polling) and the camera adapter aggregator that the UI hits on every
layer toggle.
This PR adds a focused first batch — 12 tests across 4 files — covering
the most common failure modes we've actually seen in practice. The
intent is to land the patterns alongside the tests so the next
contributor (human or agent) can copy the shape rather than improvise.
## What's tested
| File | Coverage | Tests |
| ---- | -------- | ----- |
| src/core/data/DataBus.test.ts | emit/subscribe round-trip, unsubscribe correctness, handler-failure isolation | 3 |
| src/core/data/CacheLayer.test.ts | memory-tier get/set, TTL expiry + eviction | 2 |
| src/core/data/PollingManager.test.ts | immediate-run on start(), interval scheduling, stop() cancels | 3 |
| src/app/api/camera/adapters/registry.test.ts | resolveSources for "all" / null / "none" / mixed-with-unknowns | 4 |
Each test answers one question: what regression does it catch that
we'd otherwise find by user bug report?
## Config change
vitest.config.ts now includes \`src/app/**/*.{test,spec}.*\` so API-route
tests under \`src/app/api\` are picked up by \`pnpm test\`. Previously only
\`src/lib\`, \`src/core\`, \`src/plugins\`, and \`packages\` were scanned —
api-route handlers had no test home.
## Docs
\`docs/testing.md\` gets four new sections:
- **Patterns** — plain-function, stateful-singleton, mock-with-vi.mock,
fake-timers — with a callout for the \`runOnlyPendingTimersAsync\`
double-counting gotcha we hit while writing PollingManager tests.
- **What NOT to Test (Yet)** — Cesium-heavy components, live DB
round-trips, dynamic plugin imports.
- **Philosophy** — small focused suite > large expensive one, test
pure logic, add a test when you fix a bug.
Original overview/test-types/run-commands sections are unchanged.
## Verification
Locally (Node 22 + pnpm 9.15.4):
\`\`\`
Test Files 17 passed (17)
Tests 127 passed (127)
\`\`\`
Existing 115 tests still pass; new 12 land cleanly.
## What's next (not in this PR)
The list of load-bearing systems still without coverage:
- PluginManager (the central plugin lifecycle orchestrator)
- The new plugin-backend supervisor + proxy (PR #100)
- The agent bus (PR #79)
- Plugin marketplace install/uninstall round-trip
- React component tests for LayerPanel and DataBusSubscriber
Worth a follow-up batch once the patterns from this PR are familiar.
Co-authored-by: Sapphire <sapphire@tiktokcoach>
Introduces a baseline ESLint configuration and wires it into CI.
Config:
- `eslint.config.mjs` (flat config, ESLint 9). Extends
`eslint-config-next/core-web-vitals` and `eslint-config-next/typescript`
directly — both ship as native flat-config arrays in `eslint-config-next` 16+.
- Ignores cover `.next`, `out`, `src/generated`, `public/cesium`,
`packages/*/dist`, plus the gitignored sandboxes (`local-scripts`,
`local-plugins`, `local-seeders`, `.agents`, `.claude`, `.worktrees`).
Rule policy:
- All rules that the Next.js preset surfaces as errors are demoted to
`warn` on first introduction, so the lint job is runnable against
the current codebase without blocking on pre-existing debt. The
demoted set (react-hooks/* in React 19's stricter purity suite,
no-unescaped-entities, ban-ts-comment, no-assign-module-variable,
prefer-const) plus the originally-flagged `no-explicit-any` and
`no-console` are all documented in the config with a recommended
promotion order.
- Current state: 0 errors, 564 warnings.
Scripts:
- `pnpm lint` runs `eslint .`.
CI:
- New `lint` job in `.github/workflows/ci.yml`, parallel to typecheck /
test / audit. Blocking on errors only — warnings are visible in the
job log but don't fail the build.
Same incremental-introduction pattern as the audit job (#97): land the
infrastructure now, tighten policy via follow-up PRs as the backlog is
worked down.
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Co-authored-by: Silvertakana <[email protected]>
- feat(cli): Add --org flag to publish to allow publishing under custom NPM scopes (Minor).
- feat(cli): Allow publish command to run from project root via path resolution (Minor).
- feat(cli): Change create default scaffolding to local-plugins/ instead of packages/ (Minor).
- feat(cli): Add --core flag to create to override default and scaffold into packages/ (Minor).
- docs: Update tutorial, CLI readmes, and agent architecture workflows with new commands (Fix).
`docs/ARCHITECTURE.md` was a 33-line stub, despite the README pitching
a "Deep dive into the Cesium rendering pipeline, event data bus, and
performance optimizations". The substantive content was duplicated /
buried in `AGENTS.md` §4.
Migrate it to a proper human-facing doc:
- `docs/ARCHITECTURE.md` (33 → 200 lines) now contains the full
architecture deep-dive: system overview with mermaid diagram, plugin
system & All-Bundle Model, Zustand state management (with slice
table), data pipeline, data engine & seeders (agnostic-renderer
contract), rendering pipeline (primitive collections, chunked
processing, horizon culling, LOD, stack/spiderifier), edition
system, key source files table, and cross-refs into `.agents/rules/`.
- `AGENTS.md` §4 collapses from ~80 lines of duplicated prose to a
short stub that points contributors to `docs/ARCHITECTURE.md` and
lists the key invariants agents must respect (plugin SDK as source
of truth, agnostic frontend, nine slices, primitive rendering, three
editions). Same hub-and-spoke pattern as the maintainer already
applied to §3, §6, §7.
- README link description updated from "DataBus event stream and
Zustand state management" to reflect the expanded scope.
No code changes; no version bump (consistent with prior `docs:` commits
in the history that did not touch root `package.json`).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The aggregator uses `Promise.allSettled`, so the request takes as long
as the slowest adapter. Today ny511 (without a real API key) returns
empty after ~5s — fast adapters (cached) come back in <50ms but the
client waits 5s+ for the aggregate response.
With a 4s per-adapter cap, the stuck source rejects fast and either
its stale cache or an empty list is served; healthy adapters return on
their own cadence.
Concrete latency before this commit, all 7 adapters in parallel:
caltrans: 0.04s gdot: 0.02s tfl: 0.01s
ny511: 5.03s wsdot: 0.02s ncdot: 0.02s
osm-surveillance:0.03s
total: ~10s