T-88: M1.1m — Security-master run composer: readers output + bar spans → Stage A → Stage B → Pass 6 → Pass 4 → match report + persist input (pure, in-memory, no new dependencies)
This commit is contained in:
parent
3bdf7a8da6
commit
8ccca45174
2 changed files with 23 additions and 10 deletions
|
|
@ -910,18 +910,28 @@ describe('persistSecurityMaster unit tests', () => {
|
|||
q => q.text.includes('FROM resolution_conflict rc') && q.text.includes('rc.detail = u.detail')
|
||||
);
|
||||
expect(pass4Selects.length).toBe(1);
|
||||
// Regression: PostgreSQL UTF-8 text/varchar rejects NUL bytes (\u0000); Pass 4 existence check
|
||||
// must pass integer row indices ($5::int4[]) rather than NUL-delimited internal keys.
|
||||
expect(pass4Selects[0]?.values?.[4]).toEqual([0, 1]);
|
||||
for (const param of pass4Selects[0]?.values ?? []) {
|
||||
if (Array.isArray(param)) {
|
||||
for (const item of param) {
|
||||
if (typeof item === 'string') {
|
||||
expect(item.includes('\u0000')).toBe(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const conflictInserts = first.queries.filter(q =>
|
||||
q.text.startsWith('INSERT INTO resolution_conflict')
|
||||
);
|
||||
expect(conflictInserts.length).toBe(1);
|
||||
expect((conflictInserts[0]?.values?.[0] as string[]).length).toBe(2);
|
||||
|
||||
// Second run: simulate pair 1 already existing in DB via its conflict_key -> only pair 2 inserted.
|
||||
const existingKey =
|
||||
'eod\u0000AAPL.US\u0000price_ratio_mismatch\u0000qm\u0000AAPL:US';
|
||||
// Second run: simulate pair 1 (index 0 in sorted slice) already existing in DB -> only pair 2 inserted.
|
||||
const second = createMockClient(text => {
|
||||
if (text.includes('FROM resolution_conflict rc') && text.includes('rc.detail = u.detail')) {
|
||||
return { rows: [{ conflict_key: existingKey }] };
|
||||
return { rows: [{ row_idx: 0 }] };
|
||||
}
|
||||
return { rows: [] };
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue