mirror of
https://github.com/samvallad33/vestige.git
synced 2026-07-26 23:51:02 +02:00
Turn all 17 sparse organs from text-on-black voids into full-bleed, moving, bioluminescent WebGPU fields. Each cell maps to a real backend fact; verified live on the real brain with a decoded fill% + motion + zero-error probe. Foundation: one reusable LivingFieldPass (src/lib/observatory/field/) does splat -> separable-blur (render passes) -> membrane base coat -> HDR cells with orbital drift and a CPU pick-mirror. Each organ writes a ~20-line data->cells mapper (cell-layout.ts: layoutGalaxy / layoutRings / FIELD_HUE). Organs brought alive (fill% before -> after, all zero WebGPU errors): stats 0.8->80.9, observatory 10.8->81.4, graph 12.3->82.4, memories ->78.4, blackbox 18.2->83.3, contradictions 1.6->69.6, dreams 0.3->64.5, settings 2.7->76.4, reasoning 2.7->39.2, patterns 7.1->45.6, activation 10->64.9, feed ->89, explore ->83.3, intentions ->66.6, importance ->73.7, memory-prs ->74.4, schedule ->37.1. Backend surfaces: add api.memoryChangelog() + ChangelogResponse; surface suppress/unsuppress on the memories field (shift/alt-click -> scar). Tests: palace-launch-gate now asserts fillPct>30 + isAnimating (not just non-black), with a longer settle for reasoning's deep_reference and a raised timeout for the curated tour. all-routes-smoke treats settings as the WebGPU field it now is. Gates green: check 0/0, build ok, palace-launch-gate 22/22 + tour, all-routes-smoke 20/20. Protected work untouched: MemoryCinema, graph/cinema, observatory scene shaders, node-renderer, palace-map. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
66 lines
2.4 KiB
TypeScript
66 lines
2.4 KiB
TypeScript
// Phase 0 gate: the live nervous system is actually connected.
|
|
//
|
|
// The +layout.svelte WS guard was `!isMarketingRoute && !isImmersiveRoute`,
|
|
// which is ALWAYS false (isImmersiveRoute === !isMarketingRoute), so the
|
|
// WebSocket never connected on any organ route and every "live" claim on the
|
|
// dashboard was dead. This spec proves the fix: on an immersive organ, the app
|
|
// opens /ws and the shared store's `connected` flag flips true against the real
|
|
// backend.
|
|
import { test, expect } from '@playwright/test';
|
|
import { BASE, gotoRoute } from './helpers/dashboard';
|
|
|
|
test.describe('live nervous system', () => {
|
|
test('app opens a /ws connection on an immersive organ', async ({ page }) => {
|
|
// Observe the real WebSocket the APP opens (not one we create). We watch
|
|
// for the websocket request at the network layer via CDP-backed events.
|
|
const wsOpened = new Promise<string>((resolve) => {
|
|
page.on('websocket', (ws) => {
|
|
if (ws.url().includes('/ws')) resolve(ws.url());
|
|
});
|
|
});
|
|
|
|
await gotoRoute(page, '/stats');
|
|
|
|
const url = await Promise.race([
|
|
wsOpened,
|
|
new Promise<string>((_, reject) =>
|
|
setTimeout(() => reject(new Error('app never opened a /ws websocket')), 10_000)
|
|
)
|
|
]);
|
|
expect(url).toContain('/ws');
|
|
});
|
|
|
|
test('app WS reaches OPEN and receives a live frame from the backend', async ({ page }) => {
|
|
// Authoritative connection proof that does not depend on module identity:
|
|
// watch the app's OWN socket reach readyState OPEN and deliver at least one
|
|
// frame (heartbeat or event). A frame can only arrive if the store actually
|
|
// connected — i.e. $isConnected is true — against the real backend.
|
|
let framePromiseResolve!: (v: string) => void;
|
|
const gotFrame = new Promise<string>((res) => (framePromiseResolve = res));
|
|
let opened = false;
|
|
|
|
page.on('websocket', (ws) => {
|
|
if (!ws.url().includes('/ws')) return;
|
|
opened = true;
|
|
ws.on('framereceived', (frame) => {
|
|
const payload = typeof frame.payload === 'string' ? frame.payload : frame.payload.toString();
|
|
framePromiseResolve(payload);
|
|
});
|
|
});
|
|
|
|
await gotoRoute(page, '/stats');
|
|
|
|
const frame = await Promise.race([
|
|
gotFrame,
|
|
new Promise<string>((_, reject) =>
|
|
setTimeout(
|
|
() => reject(new Error(`no live WS frame (socket opened=${opened})`)),
|
|
15_000
|
|
)
|
|
)
|
|
]);
|
|
// The backend streams JSON events (Heartbeat / MemoryCreated / etc).
|
|
expect(opened).toBe(true);
|
|
expect(frame.length).toBeGreaterThan(0);
|
|
});
|
|
});
|