Automate issuer overlay creation from ticker searches

This commit is contained in:
2026-03-19 20:44:58 -04:00
parent 17de3dd72d
commit 391d6d34ce
79 changed files with 4746 additions and 695 deletions

View File

@@ -168,6 +168,8 @@ function clearProjectionTables(client: { exec: (query: string) => void }) {
client.exec('DELETE FROM portfolio_insight;');
client.exec('DELETE FROM company_overview_cache;');
client.exec('DELETE FROM filing;');
client.exec('DELETE FROM issuer_overlay;');
client.exec('DELETE FROM issuer_overlay_revision;');
}
function seedFilingRecord(client: Database, input: {
@@ -568,6 +570,27 @@ if (process.env.RUN_TASK_WORKFLOW_E2E === '1') {
expect(tasks).toHaveLength(1);
});
it('queues ticker automation only once per ticker via the explicit ensure endpoint', async () => {
const first = await jsonRequest('POST', '/api/tickers/ensure', {
ticker: 'NVDA',
source: 'search'
});
const second = await jsonRequest('POST', '/api/tickers/ensure', {
ticker: 'nvda',
source: 'analysis'
});
expect(first.response.status).toBe(200);
expect(second.response.status).toBe(200);
const firstBody = first.json as { queued: boolean; task: { id: string } | null };
const secondBody = second.json as { queued: boolean; task: { id: string } | null };
expect(firstBody.queued).toBe(true);
expect(secondBody.queued).toBe(true);
expect(secondBody.task?.id).toBe(firstBody.task?.id);
});
it('lets different tickers queue independent filing sync tasks', async () => {
const nvda = await jsonRequest('POST', '/api/filings/sync', { ticker: 'NVDA', limit: 20 });
const msft = await jsonRequest('POST', '/api/filings/sync', { ticker: 'MSFT', limit: 20 });