Skip to content

Latest commit

 

History

History
33 lines (27 loc) · 8.86 KB

testing.md

File metadata and controls

33 lines (27 loc) · 8.86 KB

Testing

Part of: Architecture spec (index) · Sections: A12 · Implements: D-18, D-32, D-25, D-29, Q-132, Q-146, Q-114, Q-115, Q-117 · Read with: ../rendering/acceptance-tests.md (R11), ../rendering/reference/ (visual review and frame times), plan.md (A13)

A12 Testing

CI (GitHub Actions). .github/workflows/ci.yml is the only entry point. It runs on every PR, in the merge queue (the PR on top of the latest dev, D-42), on pushes to dev and main and on manual runs. Its job ci-gate is the one required check: it always reports, and it fails if any job below failed or was cancelled. A path filter picks the jobs. The backend runs for backend/, shared/, .github/workflows/, the root package.json and .gitattributes, and the frontend files the backend checks read (frontend/src/viewer/, frontend/src/app/search/); the frontend runs for frontend/, shared/, .github/workflows/, the root package.json and .gitattributes, and the backend files the frontend tests read (backend/app/core/, backend/assets/). A new test that reads a file from the other side adds its folder to the filter in ci.yml. If the changed files can't be listed, everything runs.

  • .github/workflows/backend.yml (reusable), job "ruff, mypy, pytest (offline)": scripts.generate_contract --check, scripts.bake_fixtures --check, scripts.area_fixtures --check, scripts.bake_demo_pack --check, ruff check, ruff format --check, mypy, pytest -q, all with SX_OFFLINE=1.
  • .github/workflows/frontend.yml (reusable), job "typecheck, lint, test, build": contract:check, typecheck, lint, format:check, test (Vitest 5.1.0), build; job "playwright (chromium, n/4)": test:e2e (Playwright 1.64.1) split into 4 shards on 4 runners in parallel, each shard's report uploaded on failure.
Layer Method Where CI Status
Contract Every ObjectCard and RenderParams (fixtures and live replies) validated against shared/schemas/; generated Pydantic models and frontend/src/contract/ types must equal a fresh regeneration (D-18); D-32 tier rules checked on the fixtures backend/tests/test_contract_fixtures.py, scripts/generate_contract.py --check, npm run contract:check both Built
Backend stages Unit and API tests per stage on recorded cache entries: adapters, resolver order, frames, photometry and units, spectrum targets, classify, exoplanet rule, card to params, shape models, Horizons geometry, overlays, composite, fan-out (shuffled delays), baker, fixture bake drift (test_bake_fixtures.py, Q-114), gas giant layers (test_gas_giant_layers.py, Q-115), Gemini paint, sky routes, HTTP retry, keys backend/tests/ (34 test modules) backend Built
No network in tests An autouse guard blocks every non-loopback socket and DNS lookup backend/tests/conftest.py, test_network_guard.py backend Built
Demo preflight scripts.preflight [--wait-warm S] against the running backend: warm start finished, then every demo search row, demo target and Eros answers resolve, card, render-params, a texture (a 404 is retried while the background bake lands), frames, spectrum and a cutout (frames = false rows skip the last three); prints each call's time; exit 1 on any non-200 (issue #103, Q-454). The go/no-go check: where it and smoke_offline disagree, it counts backend/scripts/preflight.py (npm run backend:preflight); tests/test_preflight.py (health fields, exit code) script: no (needs the full cache; run on the A15); tests: yes Built; not yet run on the A15 (#15)
Offline demo check scripts.smoke_offline --group test --group demo: every target answers with the network blocked under SX_OFFLINE=1 (a frames = false target skips only /frames and its cutouts), and its render parameters carry no data gap (data_gaps(), Q-369); data_gaps and the repeatable --group are unit-tested in backend/tests/test_smoke_offline.py (backend CI) backend/scripts/smoke_offline.py (npm run backend:smoke-offline) no (needs the full cache; run on the A15) Built; not yet run on the A15 (#15)
Data adapters Recorded responses so tests do not hit IRSA. The cached responses double as these fixtures (D-25). Never hand-edit them; re-record with scripts.record_fixtures backend/tests/fixtures/cache/ backend Built
Physics functions Unit tests with known values (Jupiter band count, Sedov radius, spin limit, Teq) frontend/src/physics/physics.test.ts frontend Built
Frontend units Refusal grouping and wording (incl. backendReasons.test.ts against the backend reasons), URL hash, badges, viewer plans, fields, haptics engine, calibration, audio graph, spectrum mapping; the D-37 world engine's lifecycle with a compile that never finishes (app/WorldEngineStage.lifecycle.test.tsx), the ready and form timeouts (app/engineWatchdog.test.ts) and the ?engines= kill switch (app/enginesSwitch.test.ts) (R5.9, Q-338, Q-367) frontend/src/**/*.test.ts(x) frontend Built
Determinism Same card and seed give the same bytes (cross-machine PNG checks compare chunks and image data, Q-204): baker SHA-256 (test_render_baker.py), browser determinism (e2e/determinism.spec.ts) both both Built
Rendering acceptance The tests of rendering doc R11: determinism, seam, normals, honesty, refusal, performance, spectrum haptics, comet epochs ../rendering/acceptance-tests.md partly Partly built (see R11)
Browser shaders Reference screenshots of the five shader kinds plus two extra views, compared by Playwright (toHaveScreenshot, status overlay masked, tolerance 0.2 % of pixels, per-pixel threshold 0.05, and 0.01 for the gas-giant storm view). Changing the storm count, band turbulence, seed, sea level or ice extent is detected. Drawn on the WebGL2 fallback (SwiftShader), not a real GPU; re-recorded with --update-snapshots after a deliberate look change. A unit test pins the GPU's field lookup to FieldSampler. frontend/e2e/shaderKinds.spec.ts, shaderLibrary.spec.ts, __snapshots__/ frontend e2e Built
Golden frames Every fixture with a 3D view (not candidate) at Measured only, + Estimated and + Artistic (all at the low quality tier; asteroid_procedural also has asteroid_procedural.artistic.medium.png, the only golden that shows the displacement, Q-117; asteroid_shape draws the Eros mesh at every state since Q-114), compared by SSIM (GOLDEN_MIN_SSIM in e2e/golden.ts); ssim.spec.ts is the negative control; SX_UPDATE_GOLDENS=1 rewrites them frontend/e2e/golden.spec.ts, __goldens__/ frontend e2e Built
App flows (e2e) Sky view and marker click, flipbook, frame grid, progressive loading, colour views, overlays and overlay grid, Build it, island, phone sheet layout, smoke frontend/e2e/sky.spec.ts, flipbook.spec.ts, frameGrid.spec.ts, progressive.spec.ts, colour.spec.ts, overlays.spec.ts, overlayGrid.spec.ts, build.spec.ts, island.spec.ts, phoneSheet.spec.ts, smoke.spec.ts frontend e2e Built; against the dev fixtures, not the real cache
Sound (event) The audio driver plays every event, rate-limited (no more than 40 events per second under fast drags); the Track path sound (Q-134) follows its spec; the body tone (Q-133) is deferred (D-39); data sounds duck the ambience (R13.9) frontend/src/sound/ frontend Driver, buses and ducking built (#111, D-39: haptics cut); tone and path sound to build (Atish)
Track (A19) Path, frame list, masks, spectrum hop by hop, export, labels; e2e on the recorded Eros fixtures A19 (moving-objects/track.md) to add To build (Atish)
Area search (A16 to A18) Discovery determinism (A17.10), UI tests (A18.10), e2e on the real cache (D3) A18.10 to add To build (D1 to D3)
Hardware (event) Run the real app on the Asus A15 from the offline cache, record frame times in Chrome (R5.5), check the sound output and the A15's GPU #16 (to re-scope to the A15, Q-132) no To do (M5)
Milestones M1 to M4 each build against their own fixtures (recorded responses, sample cards and spectra), so they do not depend on each other (D-29) Rule

After the event (Q-132): vibration on both Android phones (the faintest calibrated tick is felt, silent no-op on iPhone where audio takes over, the calibration value persists), the sound-to-vibration offset of the same event on both phones, and frame rates on the phones.