Clear M1 milestone bugs (T-37, T-39, T-41, T-42, T-44, T-45, T-46, T-48, T-49, T-51, T-52)
This commit is contained in:
parent
199f7beecd
commit
9e259ca43b
18 changed files with 255 additions and 34 deletions
|
|
@ -122,7 +122,11 @@ describe('bar-span pipeline builders and safety guards', () => {
|
|||
_id: '$sourceId',
|
||||
firstBarDate: { $min: '$normalizedDate' },
|
||||
lastBarDate: { $max: '$normalizedDate' },
|
||||
barCount: { $sum: 1 },
|
||||
barCount: {
|
||||
$sum: {
|
||||
$cond: [{ $ne: ['$normalizedDate', null] }, 1, 0],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(eodTargeted).toHaveLength(3);
|
||||
|
|
@ -253,6 +257,10 @@ describe('bar-span pipeline builders and safety guards', () => {
|
|||
const [left, right] = obj.$eq as [unknown, unknown];
|
||||
return evalExpr(left, doc, vars) === evalExpr(right, doc, vars);
|
||||
}
|
||||
if ('$ne' in obj) {
|
||||
const [left, right] = obj.$ne as [unknown, unknown];
|
||||
return evalExpr(left, doc, vars) !== evalExpr(right, doc, vars);
|
||||
}
|
||||
if ('$gte' in obj) {
|
||||
const [left, right] = obj.$gte as [unknown, unknown];
|
||||
return (evalExpr(left, doc, vars) as number) >= (evalExpr(right, doc, vars) as number);
|
||||
|
|
@ -269,6 +277,12 @@ describe('bar-span pipeline builders and safety guards', () => {
|
|||
return true;
|
||||
}
|
||||
if ('$cond' in obj) {
|
||||
if (Array.isArray(obj.$cond)) {
|
||||
const [condExpr, thenExpr, elseExpr] = obj.$cond as [unknown, unknown, unknown];
|
||||
return evalExpr(condExpr, doc, vars)
|
||||
? evalExpr(thenExpr, doc, vars)
|
||||
: evalExpr(elseExpr, doc, vars);
|
||||
}
|
||||
const cfg = obj.$cond as { if: unknown; then: unknown; else: unknown };
|
||||
return evalExpr(cfg.if, doc, vars)
|
||||
? evalExpr(cfg.then, doc, vars)
|
||||
|
|
@ -425,7 +439,14 @@ describe('bar-span pipeline builders and safety guards', () => {
|
|||
}
|
||||
out[field] = maxVal;
|
||||
} else if ('$sum' in accObj) {
|
||||
out[field] = bucket.length;
|
||||
let total = 0;
|
||||
for (const doc of bucket) {
|
||||
const val = evalExpr(accObj.$sum, doc);
|
||||
if (typeof val === 'number') {
|
||||
total += val;
|
||||
}
|
||||
}
|
||||
out[field] = total;
|
||||
}
|
||||
}
|
||||
grouped.push(out);
|
||||
|
|
@ -490,7 +511,7 @@ describe('bar-span pipeline builders and safety guards', () => {
|
|||
sourceId: 'TZLESS_EXTREMUM.US',
|
||||
firstBarDate: '2024-06-03',
|
||||
lastBarDate: '2024-06-07',
|
||||
barCount: 5,
|
||||
barCount: 2,
|
||||
});
|
||||
expect(result.index.get('qm', 'MIXED:TO')).toEqual({
|
||||
source: 'qm',
|
||||
|
|
@ -505,7 +526,7 @@ describe('bar-span pipeline builders and safety guards', () => {
|
|||
sourceId: 'QM_OLD:TO',
|
||||
firstBarDate: '2024-06-03',
|
||||
lastBarDate: '2024-06-07',
|
||||
barCount: 3,
|
||||
barCount: 2,
|
||||
});
|
||||
// Must not falsely overlap a different listing starting June 10.
|
||||
expect(
|
||||
|
|
@ -731,7 +752,8 @@ describe('computeBarSpans', () => {
|
|||
});
|
||||
|
||||
// 5 unique eod IDs at batchSize 2 => 3 batched queries (never 5 per-symbol queries)
|
||||
expect(batchesSeen).toEqual([['A.US', 'B.US'], ['C.US', 'D.US'], ['E.US']]);
|
||||
// Exact source IDs (including surrounding spaces) are preserved so stored IDs can be targeted.
|
||||
expect(batchesSeen).toEqual([['A.US', ' B.US '], ['C.US', 'D.US'], ['E.US']]);
|
||||
expect(result.bySource.eod?.batchesRun).toBe(3);
|
||||
// Empty targeted list for qm must execute 0 queries (never fall back to a full collection scan)
|
||||
expect(result.bySource.qm?.batchesRun).toBe(0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue