T-116: M1.2af — data-pipeline: read-only security-master → curate-etl input exporter (provider_mapping.tsv, listing_currencies.tsv, Pass 6 delistings.tsv from PostgreSQL) with tests and local benchmark
This commit is contained in:
parent
40a48e90ee
commit
88b7f1f020
7 changed files with 718 additions and 137 deletions
|
|
@ -8,6 +8,7 @@ import { getLogger, setLoggerConfig } from '@stock-bot/logger';
|
|||
import { PostgreSQLClient, runPostgresMigrations } from '@stock-bot/postgres';
|
||||
import {
|
||||
exportCurateInputs,
|
||||
pinCurateInputSnapshot,
|
||||
type SecurityMasterQueryable,
|
||||
type SecurityMasterQueryResult,
|
||||
} from '../../apps/stock/data-pipeline/src/security-master';
|
||||
|
|
@ -383,15 +384,26 @@ describe('exportCurateInputs PostgreSQL integration (isolated stock_bot_safety_*
|
|||
})
|
||||
);
|
||||
|
||||
// Read-only SQL verification: REPEATABLE READ READ ONLY transaction + zero writes/DDL.
|
||||
// Read-only SQL verification: REPEATABLE READ READ ONLY transaction + server-side cursor + zero writes/DDL.
|
||||
for (const sqlLog of [sql5000, sql1]) {
|
||||
expect(sqlLog[0]).toBe('BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ READ ONLY');
|
||||
expect(sqlLog[sqlLog.length - 1]).toBe('COMMIT');
|
||||
expect(sqlLog.some(s => s.startsWith('DECLARE curate_export_pm_cursor NO SCROLL CURSOR FOR'))).toBe(
|
||||
true
|
||||
);
|
||||
expect(sqlLog.some(s => s === 'CLOSE curate_export_pm_cursor')).toBe(true);
|
||||
for (const stmt of sqlLog) {
|
||||
expect(stmt).not.toMatch(/\b(INSERT|UPDATE|DELETE|CREATE|ALTER|DROP|TRUNCATE|GRANT|REVOKE)\b/i);
|
||||
}
|
||||
}
|
||||
|
||||
// Verify snapshot pinning resolves to the published immutable generation.
|
||||
const pinned5000 = await pinCurateInputSnapshot(outDir5000);
|
||||
expect(pinned5000.generationId).toBe(res5000.generationId);
|
||||
expect(pinned5000.providerMapping).toBe(res5000.providerMapping.path);
|
||||
expect(pinned5000.listingCurrencies).toBe(res5000.listingCurrencies.path);
|
||||
expect(pinned5000.delistings).toBe(res5000.delistings.path);
|
||||
|
||||
// Verify chunkSize=1 actually paginated across multiple queries.
|
||||
expect(sql1.length).toBeGreaterThan(sql5000.length);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue