feat(research): cut over canonical runtime and enforce agent budgets

This commit is contained in:
Boki 2026-10-24 16:47:19 -04:00
parent ab08db82fd
commit bbf0dd4453
103 changed files with 6138 additions and 3112 deletions

View file

@ -23,9 +23,35 @@ import {
import { buildExperimentPreview } from '../../apps/stock/web-api/src/services/experiment-input';
import { prepareChronologicalValidation } from '../../apps/stock/web-api/src/services/validation-preview';
import type { Backtest } from '../../apps/stock/web-app/src/features/backtest/services/backtestApiV2';
import { parseWalkForwardDetail } from '../../apps/stock/web-app/src/features/experiments/services/walkForwardApi';
import { nativeReplayFixture } from '../fixtures/native-replay';
import { walkForwardDataset } from '../fixtures/walk-forward';
test('saved walk-forward report preserves agent authorship across nested validation evidence', () => {
const value = document('reported');
if (!value.report) {
throw new Error('Reported fixture needs its immutable report');
}
const actor = 'agent:aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa';
value.report.principal = actor;
for (const window of value.windows) {
if (!window.validation?.selection || !window.validation.report) {
throw new Error('Reported window needs its selection and report');
}
window.validation.selection.principal = actor;
window.validation.report.principal = actor;
}
const parsed = parseWalkForwardDetail(value);
expect(parsed.report?.principal).toBe(actor);
expect(parsed.windows.map(window => window.validation?.report?.principal)).toEqual([
actor,
actor,
]);
expect(() =>
parseWalkForwardDetail({ ...value, report: { ...value.report, principal: 'agent:operator' } })
).toThrow();
});
const browser = new GlobalWindow({ url: 'http://localhost:5173' });
const keys = ['window', 'document', 'Event', 'ResizeObserver', 'IS_REACT_ACT_ENVIRONMENT'] as const;
const originals = new Map(keys.map(key => [key, Object.getOwnPropertyDescriptor(globalThis, key)]));