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:
Boki 2026-11-27 16:11:57 -05:00
parent 199f7beecd
commit 9e259ca43b
18 changed files with 255 additions and 34 deletions

View file

@ -487,7 +487,11 @@ function buildNormalizedSpanStages(spec: BarSpanCollectionSpec): Record<string,
_id: '$sourceId',
firstBarDate: { $min: '$normalizedDate' },
lastBarDate: { $max: '$normalizedDate' },
barCount: { $sum: 1 },
barCount: {
$sum: {
$cond: [{ $ne: ['$normalizedDate', null] }, 1, 0],
},
},
},
};
return [projectStage, groupStage];
@ -638,12 +642,11 @@ function normalizeRequestedSourceIds(source: BarSpanSource, rawIds: readonly str
`sourceIdsBySource.${source}[${i}] must be a string, received ${typeof raw}`
);
}
const trimmed = raw.trim();
if (trimmed.length === 0 || seen.has(trimmed)) {
if (raw.trim().length === 0 || seen.has(raw)) {
continue;
}
seen.add(trimmed);
deduped.push(trimmed);
seen.add(raw);
deduped.push(raw);
}
return deduped;
}
@ -672,8 +675,8 @@ function foldGroupedRow(
return;
}
const sourceId = record._id.trim();
if (sourceId.length === 0) {
const sourceId = record._id;
if (sourceId.trim().length === 0) {
sourceSkipped.invalidId++;
sourceSkipped.total++;
totalSkipped.invalidId++;

View file

@ -1,5 +1,7 @@
export type TickerSource = 'eod' | 'qm' | 'ib' | 'ceo';
export const MAX_CLASS_SUFFIX_LENGTH = 12;
export interface ParsedTicker {
tickerRoot: string;
classSuffix: string;
@ -82,7 +84,8 @@ export function parseTicker(
const secondSep = findNextSeparator(s, pos);
if (secondSep === -1) {
return { tickerRoot, classSuffix: s.slice(pos) };
const classSuffix = s.slice(pos);
return classSuffix.length <= MAX_CLASS_SUFFIX_LENGTH ? { tickerRoot, classSuffix } : null;
}
let classSuffix = s.slice(pos, secondSep);
@ -104,5 +107,9 @@ export function parseTicker(
pos = nextSep;
}
if (classSuffix.length > MAX_CLASS_SUFFIX_LENGTH) {
return null;
}
return { tickerRoot, classSuffix };
}