T-214: M2.1w — Add notebook snapshot CLI, MCP end-to-end study+snapshot+finding test, and fix docs/->design/ path drift

This commit is contained in:
Studio 2026-12-05 13:52:30 -05:00
parent 2e71dda7f2
commit 4ff4f7ef0a
2 changed files with 9 additions and 10 deletions

View file

@ -401,7 +401,7 @@ function createInMemoryCopilotDatabase(): InMemoryCopilotDatabase {
for (let offset = 0; offset < params.length; offset += 14) {
const id = nextTrialId;
nextTrialId += 1;
const createdAt = new Date(FIXED_NOW_MS + id * 1000).toISOString();
const createdAt = `${new Date(FIXED_NOW_MS + id * 1000).toISOString().slice(0, -1)}000Z`;
const rawSeries = params[offset + 13] as readonly number[];
// Round-trip through Float32Array to mirror PostgreSQL `real[]`.
const storedSeries = Array.from(Float32Array.from(rawSeries));
@ -453,13 +453,13 @@ function createInMemoryCopilotDatabase(): InMemoryCopilotDatabase {
) {
const market = String(params[0]);
const bucket = String(params[1]);
const asOf = params[2] !== undefined ? String(params[2]) : undefined;
const asOfMs = params[2] !== undefined ? Date.parse(String(params[2])) : undefined;
const found = trials
.filter(
row =>
row.universe_market === market &&
row.horizon_bucket === bucket &&
(asOf === undefined || row.created_at <= asOf)
(asOfMs === undefined || Date.parse(row.created_at) <= asOfMs)
)
.sort((a, b) => a.trial_id - b.trial_id);
return { rows: found as unknown as readonly Row[] };
@ -1079,7 +1079,7 @@ describe('MCP research copilot Exit Criterion 1 end-to-end stdio workflow', () =
expect(searchPayload.rowCount).toBe(1);
expect(searchPayload.rows[0]?.listingId).toBe(101);
expect(searchPayload.rows[0]?.delistedAt).toBeNull();
expect(searchPayload.rows[0]?.lastBarDate).toBe('2024-06-30');
expect(searchPayload.rows[0]?.lastBarDate).toBe(VAULT_CUTOFF_DATE);
// 3. query_data: straddling `to` clamped, 9999.0 Vault sentinel bars excluded
const queryStraddle = await stdio.callTool('query_data', {
@ -1187,7 +1187,7 @@ describe('MCP research copilot Exit Criterion 1 end-to-end stdio workflow', () =
status: string;
clampedTo: boolean;
eventCount: number;
study: { clustered: { carMean: number } | null; diagnostics: { usedEvents: number } };
study: { clustered: { carMean: number } | null; diagnostics: { eventsUsed: number } };
trial: { trialId: number; expressionHash: string; sampleEnd: string };
deflatedSharpe: { clusterSize: number; dsr: number | null };
};
@ -1195,7 +1195,7 @@ describe('MCP research copilot Exit Criterion 1 end-to-end stdio workflow', () =
expect(eventPayload.clampedTo).toBe(true);
// Only the 8 pre-cutoff newswire ceo_post events are included (retail + Vault rows excluded).
expect(eventPayload.eventCount).toBe(8);
expect(eventPayload.study.diagnostics.usedEvents).toBe(8);
expect(eventPayload.study.diagnostics.eventsUsed).toBe(8);
expect(eventPayload.trial.sampleEnd < VAULT_CUTOFF_DATE).toBe(true);
expect(eventPayload.deflatedSharpe.clusterSize).toBe(3);