Clear T-18, T-34, T-54, T-55 on master (release note, test/ lint gate, Stage A fixes)

This commit is contained in:
Boki 2026-11-27 16:24:57 -05:00
parent d9d49ebc22
commit ade0a3ef1d
10 changed files with 74 additions and 23 deletions

View file

@ -781,7 +781,9 @@ describe('MongoDBClient read-only mode (offline)', () => {
if (mode === 'next') {
while (true) {
const item = await (mappedCursor.next as () => Promise<unknown>)();
if (item == null) break;
if (item === null || item === undefined) {
break;
}
results.push(item);
}
} else if (mode === 'toArray') {

View file

@ -300,6 +300,49 @@ describe('security master Pass 3 Stage A instrument matcher', () => {
assertConservationAndSchema(result, 5);
});
test('rejects sparse input arrays instead of silently skewing stats (T-54)', () => {
const sparse = new Array(2) as unknown as Parameters<typeof matchInstrumentsStageA>[0];
sparse[1] = {
source: 'eod',
sourceId: 'AAPL.US',
isin: 'US0378331005',
cusip: '037833100',
country: 'US',
};
expect(() => matchInstrumentsStageA(sparse)).toThrow(TypeError);
});
test('does not quarantine interlisted US/CA shares when listing country differs from issuer country (T-55)', () => {
const result = matchInstrumentsStageA([
{
source: 'eod',
sourceId: 'SHOP.TO',
isin: 'CA82509L1076',
cusip: '82509L107',
country: 'CA',
currency: 'CAD',
name: 'Shopify Inc.',
},
{
source: 'eod',
sourceId: 'SHOP.US',
isin: 'CA82509L1076',
cusip: '82509L107',
country: 'US',
currency: 'USD',
name: 'Shopify Inc.',
},
]);
expect(result.conflicts).toEqual([]);
expect(result.unresolved).toEqual([]);
expect(result.instruments).toHaveLength(1);
expect(result.instruments[0]?.primaryIsin).toBe('CA82509L1076');
expect(result.instruments[0]?.issuerCountry).toBe('CA');
expect(result.instruments[0]?.members.map(m => m.sourceId)).toEqual(['SHOP.TO', 'SHOP.US']);
assertConservationAndSchema(result, 2);
});
test('quarantines isin_cusip_mismatch and duplicate_source_id without joining any instrument', () => {
const result = matchInstrumentsStageA([
// Explicit CA country mismatch