T-210: M2.3s — Implement MarketDataStore.macroAsOf, crossSection, QuestDB fx('1m'), and copilot 1m routing

This commit is contained in:
Studio 2026-12-04 15:31:29 -05:00
parent 5e255d7e30
commit 373936c312
6 changed files with 168 additions and 129 deletions

View file

@ -8,11 +8,16 @@ describe('scripts/questdb-init-m2', () => {
const baseUrl = `postgresql://admin:${encodeURIComponent(secret)}@10.0.0.51:8812/qdb`;
const conflictingEnvs: Array<Record<string, string>> = [
{ QUESTDB_URL: `${baseUrl}?sslmode=no-verify`, QUESTDB_SSL: 'true' },
{ QUESTDB_URL: `${baseUrl}?sslmode=disable`, QUESTDB_SSL: 'true' },
{ QUESTDB_URL: `${baseUrl}?sslmode=disable`, QUESTDB_SSL: 'false' },
{ RESEARCH_MCP_QUESTDB_URL: `${baseUrl}?sslmode=disable`, RESEARCH_MCP_QUESTDB_SSL: 'true' },
{ QUESTDB_URL: `${baseUrl}?sslmode=require`, QUESTDB_SSL: 'true' },
{ QUESTDB_URL: `${baseUrl}?sslmode=require`, QUESTDB_SSL: 'false' },
{ QUESTDB_URL: `${baseUrl}?ssl=false`, QUESTDB_SSL: 'true' },
{ QUESTDB_URL: `${baseUrl}?ssl=false`, QUESTDB_SSL: 'false' },
{ QUESTDB_URL: `${baseUrl}?sslmode=prefer`, QUESTDB_SSL: 'true' },
{ QUESTDB_URL: `${baseUrl}?uselibpqcompat=true`, QUESTDB_SSL: 'true' },
];
let openCalls = 0;
@ -34,7 +39,7 @@ describe('scripts/questdb-init-m2', () => {
expect(openCalls).toBe(0);
});
test('rejects invalid SSL flag values and accepts consistent URL + SSL configs', async () => {
test('rejects invalid SSL flag values and accepts single-source-of-truth URL or flag TLS configs', async () => {
expect(() =>
resolveQuestDbInitM2Config({
QUESTDB_HOST: '10.0.0.51',
@ -42,12 +47,19 @@ describe('scripts/questdb-init-m2', () => {
})
).toThrow(RangeError);
const resolved = resolveQuestDbInitM2Config({
const urlOnlyTls = resolveQuestDbInitM2Config({
QUESTDB_URL: 'postgresql://admin:pass@10.0.0.51:8812/qdb?sslmode=require',
});
expect(urlOnlyTls).toEqual({
url: 'postgresql://admin:pass@10.0.0.51:8812/qdb?sslmode=require',
});
const flagOnlyTls = resolveQuestDbInitM2Config({
QUESTDB_URL: 'postgresql://admin:pass@10.0.0.51:8812/qdb?application_name=init-m2',
QUESTDB_SSL: 'true',
});
expect(resolved).toEqual({
url: 'postgresql://admin:pass@10.0.0.51:8812/qdb?sslmode=require',
expect(flagOnlyTls).toEqual({
url: 'postgresql://admin:pass@10.0.0.51:8812/qdb?application_name=init-m2',
ssl: true,
});
@ -55,7 +67,7 @@ describe('scripts/questdb-init-m2', () => {
let closed = false;
const result = await runQuestDbInitM2(
{
QUESTDB_URL: 'postgresql://admin:pass@10.0.0.51:8812/qdb?sslmode=disable',
QUESTDB_URL: 'postgresql://admin:pass@10.0.0.51:8812/qdb',
QUESTDB_SSL: 'false',
},
async () => ({