Files
leleka/engine/strata/apps/host/tests/ui6-fork.test.mjs
T
Pavlo RatushnyiandClaude Sonnet 5.5 87e2633afe engine/strata: bring the Strata subtree to upstream 41cf05a0 (engine 0.1.50) with the local patches re-applied
Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree
(570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base =
the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main).

Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR
experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details,
conflict table and left-out files are in docs/upstream.md.

Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61),
docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out.

scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run").
Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR
macros on. No GPU run, no quality gate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 12:49:15 +01:00

53 lines
3.4 KiB
JavaScript

/** Round 8, item 11: the fork design's events (notes-split-agent8.md) are read into the job; the folder chip reads the host's answer. */
import test from 'node:test';
import assert from 'node:assert/strict';
import { build } from 'esbuild';
import { fileURLToPath } from 'node:url';
const src = f => fileURLToPath(new URL(`../src/${f}`, import.meta.url));
const stub = fileURLToPath(new URL('./helpers/react-stub.mjs', import.meta.url));
globalThis.window ??= globalThis; globalThis.localStorage ??= { getItem: () => null, setItem: () => {} }; globalThis.navigator ??= { language: 'en' };
async function load(file) {
const r = await build({ entryPoints: [src(file)], bundle: true, format: 'esm', platform: 'node', write: false, alias: { react: stub }, logLevel: 'silent' });
return import(`data:text/javascript;base64,${Buffer.from(r.outputFiles[0].text).toString('base64')}`);
}
const T = await load('lib/time-skip.ts');
const F = await load('lib/chat-folder.ts');
test('an event carries the plan, the lever with its why, both lanes and one friendly line', () => {
const f = T.forkFields({ phase: 'running', activity: 'Step 2 of 5 in A: Draw the layout', plan: { steps: [{ id: 's1', text: 'Look' }, { text: 'Draw' }, 5] }, lever: { step: 3, total: 5, text: 'Styles', why: 'The layout decides everything after it.', defaulted: false }, a: { state: 'running', step: 2, total: 5, text: 'Draw', line: 'Step 2 of 5', waiting: false }, b: { state: 'waiting', waiting: true } });
assert.deepEqual(f.plan.steps.map(s => s.id), ['s1', '2']);
assert.equal(f.lever.why, 'The layout decides everything after it.');
assert.equal(f.a.step, 2); assert.equal(f.b.waiting, true);
assert.deepEqual(f.activity, { code: 'line', text: 'Step 2 of 5 in A: Draw the layout' });
assert.equal(T.isForkJob(f), true);
assert.equal(T.isForkJob({}), false);
});
test('an older job (an activity object, no plan) is not a fork job and keeps its activity', () => {
const f = T.forkFields({ phase: 'generating', activity: { code: 'reading-files', text: 'Reading' } });
assert.deepEqual(f.activity, { code: 'reading-files', text: 'Reading' });
assert.equal(T.isForkJob(f), false);
assert.equal(T.forkFields({ lever: null }).lever, null);
});
test('the folder answer: a path gives a name; nothing gives no folder', () => {
assert.deepEqual(F.readFolder({ path: 'C:\Users\me\pagoda-site', name: 'pagoda-site', exists: true }), { path: 'C:\Users\me\pagoda-site', name: 'pagoda-site', exists: true });
assert.equal(F.readFolder({ path: '/home/me/site' }).name, 'site');
assert.equal(F.readFolder(null), null);
assert.equal(F.readFolder({ path: '' }), null);
});
test('the sample time-skip copy appears only when the host cannot be reached at all', async () => {
const { readFileSync } = await import('node:fs');
const store = readFileSync(src('lib/store.ts'), 'utf8');
const chat = readFileSync(src('screens/Chat.tsx'), 'utf8');
const panel = readFileSync(src('components/TimeSkipPanel.tsx'), 'utf8');
const route = store.slice(store.indexOf('const demoPrompt = '), store.indexOf('const imageTarget'));
assert.match(route, /connection === 'live'/);
assert.match(route, /connection === 'connecting'/);
assert.ok(route.indexOf('startTimeSkipDemo') > route.indexOf("'connecting'"), 'the sample run is the last resort, after live and connecting');
assert.match(chat, /hostLive \? tr\('This was a sample run/);
assert.match(panel, /run\.job \? 'Working on a copy of your files\.'/);
});