T-40: M1.1c — Pass 1 exchanges: ISO MIC seed, source-code role classifier and reviewable seed-SQL generator

This commit is contained in:
Studio 2026-11-27 14:56:52 -05:00
parent 2dbfb7e5bc
commit c36f89352c
12 changed files with 1848 additions and 20 deletions

View file

@ -367,7 +367,7 @@ describe.skipIf(!url)('startup migrations on real PostgreSQL', () => {
).toBe(1);
});
test('34-security-master.sql is applied on master and all tracks, excluded from research, and idempotent', async () => {
test('34-security-master.sql and 35-security-master-exchange-seed.sql are applied on master and all tracks, excluded from research, and idempotent', async () => {
const securityMasterTables = [
'exchange',
'exchange_source_map',
@ -382,13 +382,16 @@ describe.skipIf(!url)('startup migrations on real PostgreSQL', () => {
'golden_field_audit',
];
// 1. research track must NOT apply 34-security-master.sql or create any of its 11 tables;
// master track applies it and is idempotent on re-run.
// 1. research track must NOT apply 34-security-master.sql or 35-security-master-exchange-seed.sql;
// master track applies both in order and is idempotent on re-run.
const f1 = await fixture();
const runner1 = f1.startup();
const researchApplied = await runner1.runTrack('research');
expect(researchApplied).not.toContain('34-security-master.sql');
expect(await f1.recorded()).not.toContain('34-security-master.sql');
expect(researchApplied).not.toContain('35-security-master-exchange-seed.sql');
const recordedAfterResearch = await f1.recorded();
expect(recordedAfterResearch).not.toContain('34-security-master.sql');
expect(recordedAfterResearch).not.toContain('35-security-master-exchange-seed.sql');
const tablesAfterResearch = new Set(await f1.relations());
for (const table of securityMasterTables) {
@ -397,7 +400,13 @@ describe.skipIf(!url)('startup migrations on real PostgreSQL', () => {
const masterApplied = await runner1.runTrack('master');
expect(masterApplied).toContain('34-security-master.sql');
expect(await f1.recorded()).toContain('34-security-master.sql');
expect(masterApplied).toContain('35-security-master-exchange-seed.sql');
expect(masterApplied.indexOf('35-security-master-exchange-seed.sql')).toBe(
masterApplied.indexOf('34-security-master.sql') + 1
);
const recordedAfterMaster = await f1.recorded();
expect(recordedAfterMaster).toContain('34-security-master.sql');
expect(recordedAfterMaster).toContain('35-security-master-exchange-seed.sql');
const tablesAfterMaster = new Set(await f1.relations());
for (const table of securityMasterTables) {
@ -406,7 +415,7 @@ describe.skipIf(!url)('startup migrations on real PostgreSQL', () => {
expect(await runner1.runTrack('master')).toEqual([]);
// 2. all track applies 34-security-master.sql alongside 01-05 and 09-33 and is idempotent.
// 2. all track applies 34 and 35 alongside 01-05 and 09-33 and is idempotent.
const f2 = await fixture();
const runner2 = f2.startup();
const allApplied = await runner2.runTrack('all');
@ -415,7 +424,10 @@ describe.skipIf(!url)('startup migrations on real PostgreSQL', () => {
expect(allApplied).toContain('09-backtest-run-contract.sql');
expect(allApplied).toContain('33-candidate-decimal-normalization.sql');
expect(allApplied).toContain('34-security-master.sql');
expect(await f2.recorded()).toContain('34-security-master.sql');
expect(allApplied).toContain('35-security-master-exchange-seed.sql');
const recordedAfterAll = await f2.recorded();
expect(recordedAfterAll).toContain('34-security-master.sql');
expect(recordedAfterAll).toContain('35-security-master-exchange-seed.sql');
const tablesAfterAll = new Set(await f2.relations());
for (const table of securityMasterTables) {