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>
42 lines
3.0 KiB
JavaScript
42 lines
3.0 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { checkUpdates } from '../server/updates.mjs';
|
|
const installed = { appVersion: '0.1.0', engineVersion: 'strata-engine 0.1.0' };
|
|
const response = releases => async () => ({ ok: true, json: async () => releases });
|
|
const release = (tag, extra = {}) => ({ tag_name: tag, html_url: `https://github.com/Niko1221/Strata/releases/tag/${tag}`, ...extra });
|
|
|
|
test('release checks compare stable versions and preserve installer capability truth', async () => {
|
|
const result = await checkUpdates(installed, response([release('v0.1.0'), release('v0.2.0'), release('v0.3.0', { prerelease: true }), release('v0.4.0', { draft: true })]));
|
|
assert.equal(result.strata.status, 'available');
|
|
assert.equal(result.strata.latestVersion, 'v0.2.0');
|
|
assert.equal(result.strata.canInstall, false);
|
|
assert.equal(result.engine.status, 'unavailable');
|
|
assert.equal(result.engine.canInstall, false);
|
|
assert.equal((await checkUpdates(installed, response([release('v0.1.0')]))).strata.status, 'current');
|
|
});
|
|
test('empty, failed and unknown release checks never claim up to date', async () => {
|
|
assert.equal((await checkUpdates(installed, response([]))).strata.status, 'no-releases');
|
|
assert.equal((await checkUpdates(installed, async () => ({ ok: false, status: 403 }))).strata.status, 'error');
|
|
assert.equal((await checkUpdates({ ...installed, appVersion: 'development' }, response([release('v0.2.0')]))).strata.status, 'unavailable');
|
|
assert.equal((await checkUpdates(installed, response({ invalid: true }))).strata.status, 'error');
|
|
});
|
|
test('release content cannot inject an external or script update link', async () => {
|
|
const result = await checkUpdates(installed, response([release('v0.2.0', { html_url: 'javascript:alert(1)' })]));
|
|
assert.equal(result.strata.status, 'available');
|
|
assert.equal(result.strata.releaseUrl, undefined);
|
|
});
|
|
|
|
test('offline, "Check for updates" says there is no internet connection instead of "fetch failed"', async () => {
|
|
const offline = async () => { throw Object.assign(new TypeError('fetch failed'), { cause: Object.assign(new Error('getaddrinfo ENOTFOUND api.github.com'), { code: 'ENOTFOUND' }) }); };
|
|
const result = await checkUpdates(installed, offline);
|
|
assert.equal(result.strata.status, 'error');
|
|
assert.equal(result.strata.message, "No internet connection. Try again when you're online.");
|
|
for (const reason of ['EAI_AGAIN', 'ECONNREFUSED', 'ENETUNREACH']) {
|
|
const r = await checkUpdates(installed, async () => { throw Object.assign(new Error('connect failed'), { code: reason }); });
|
|
assert.equal(r.strata.message, "No internet connection. Try again when you're online.", reason);
|
|
}
|
|
// a slow or broken server is not "offline"
|
|
const slow = await checkUpdates(installed, async () => { throw Object.assign(new Error('The operation was aborted due to timeout'), { name: 'TimeoutError' }); });
|
|
assert.equal(slow.strata.message, 'The release check timed out. Try again.');
|
|
});
|