- Links run on v1's clock and follow the real path: Link.Style decorations, Wave and Coil, reroutes as one chain. The nine animations, markers, the centred halo shadow and the density presets are v1's; bases are baked into the background and only motion is drawn per frame. - Particle-like glows come from sprites. With more than 12 glowing bases on screen, bases are baked without glow while the view or graph moves and with it 150 ms after. - Nodes: the four effects over the body in under and over layers, halo, selection frame, particles only, five title styles, fireworks on this client's run, and node menus storing flat enhanced_fx_* properties. - Level A compares every v1 frame, each difference listed with a proof in tests/unit/v1-deviations.ts; Level B pins clock, counts and layering; a sha256 manifest guards the v1 traces. Perf gains ELN_GPU=1, pan fps and budget failures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.6 KiB
TypeScript
40 lines
1.6 KiB
TypeScript
/**
|
|
* Each deliberate deviation from v1 (v1-deviations.ts) draws what it says it
|
|
* draws, and names only frames the v1 traces have. The Level A tests
|
|
* (links.test.ts, nodes.test.ts) check that the traces differ from v1's only
|
|
* where one of them says so.
|
|
*/
|
|
|
|
import { readFileSync, readdirSync } from 'fs';
|
|
import { join, relative, resolve } from 'path';
|
|
import { describe, it, expect, afterEach, vi } from 'vitest';
|
|
import { DEVIATIONS } from '../v1-deviations';
|
|
|
|
afterEach(() => {
|
|
vi.restoreAllMocks();
|
|
vi.unstubAllGlobals();
|
|
});
|
|
|
|
const ROOT = resolve(__dirname, '../__traces__/v1');
|
|
|
|
function files(dir: string): string[] {
|
|
return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => (entry.isDirectory() ? files(join(dir, entry.name)) : [join(dir, entry.name)]));
|
|
}
|
|
|
|
/** Every frame of the v1 traces, as the Level A tests name them: `<file>: <header>`. */
|
|
const FRAMES = files(ROOT).flatMap((file) => readFileSync(file, 'utf8').split('\n').slice(1)
|
|
.filter((line) => line.startsWith('# ') && !line.startsWith('# gradients='))
|
|
.map((header) => `${relative(ROOT, file)}: ${header}`));
|
|
|
|
describe('v1 deviations', () => {
|
|
for (const deviation of DEVIATIONS) it(deviation.title, deviation.proof);
|
|
|
|
it('name only frames the v1 traces have', () => {
|
|
expect(DEVIATIONS.filter((d) => d.frames && !FRAMES.some((frame) => d.frames!.test(frame))).map((d) => d.title)).toEqual([]);
|
|
});
|
|
|
|
it('hide what they change in the frames they name, so that the rest of each frame is compared', () => {
|
|
expect(DEVIATIONS.filter((d) => Boolean(d.frames) !== Boolean(d.mask)).map((d) => d.title)).toEqual([]);
|
|
});
|
|
});
|