Introduce a content-bound scene route provider, advisory runtime graph and plan-preview-launch workflow. Preserve live sensing authority and retire blocked intermediate goals without discarding final-arrival evidence. Bound native visual context losslessly and provide verified cache relocation. Full Maroseyka route qualification remains open.
42 lines
2.7 KiB
JavaScript
42 lines
2.7 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import { test } from 'node:test';
|
|
import ts from 'typescript';
|
|
|
|
const source=ts.transpileModule(readFileSync(new URL('../src/core/simulation/runConfiguration.ts',import.meta.url),'utf8'),
|
|
{compilerOptions:{module:ts.ModuleKind.ESNext}}).outputText;
|
|
const {parseSavedSelection,currentSelection,selectionStorageKey}=
|
|
await import(`data:text/javascript;base64,${Buffer.from(source).toString('base64')}`);
|
|
const selection={schema_version:'missioncore.observatory-ai-composition/v1',selections:[
|
|
{group:'segmentation',module_id:'outdoor-provider',module_sha256:'a'.repeat(64),parameters:{}},
|
|
{group:'policy',module_id:'mission',module_sha256:'b'.repeat(64),parameters:{environment:'park'}},
|
|
]};
|
|
const installed={selection:{...selection,selections:[]},catalog:{groups:[
|
|
{group:'segmentation',modules:[{moduleId:'outdoor-provider',moduleSha256:'c'.repeat(64),defaults:{}}]},
|
|
{group:'policy',modules:[{moduleId:'mission',moduleSha256:'d'.repeat(64),defaults:{environment:'natural'}}]},
|
|
]}};
|
|
|
|
test('stored per-location intent survives JSON; malformed, duplicate or foreign groups are rejected',()=>{
|
|
assert.deepEqual(parseSavedSelection(JSON.stringify(selection)),selection);
|
|
for(const value of [null,'broken',JSON.stringify({...selection,selections:[...selection.selections,selection.selections[0]]}),
|
|
JSON.stringify({...selection,selections:[{...selection.selections[0],group:'source'}]}),
|
|
JSON.stringify({...selection,selections:[{...selection.selections[0],parameters:[]} ]})]) {
|
|
assert.equal(parseSavedSelection(value),undefined);
|
|
}
|
|
assert.notEqual(selectionStorageKey('riverside','tracked'),selectionStorageKey('forest','tracked'));
|
|
assert.notEqual(selectionStorageKey('riverside','tracked'),selectionStorageKey('riverside','wheeled'));
|
|
});
|
|
test('alternative provider is rebound from full registry and park permissions survive an update',()=>{
|
|
const fresh=currentSelection(selection,installed);
|
|
assert.equal(fresh.selections[0].module_sha256,'c'.repeat(64));
|
|
assert.equal(fresh.selections[1].parameters.environment,'park');
|
|
assert.equal(selection.selections[0].module_sha256,'a'.repeat(64));
|
|
assert.throws(()=>currentSelection(selection,{...installed,catalog:{groups:[]}}),/недоступен/);
|
|
});
|
|
test('continuous simulation admission does not send a distance-based duration ceiling',()=>{
|
|
const api=readFileSync(new URL('../src/core/simulation/aiPolygon.ts',import.meta.url),'utf8');
|
|
const start=api.slice(api.indexOf('export const startAiRun'),api.indexOf('export const sendAiPlanningCommand'));
|
|
assert.doesNotMatch(start,/duration_seconds|runDurationSeconds/);
|
|
assert.match(start,/clock: "realtime"/);
|
|
});
|