Say undefined where the SMSC named no id for a segment it took (#101)

* Cover the ids a send gets back where the SMSC named only some of them

* Say undefined where the SMSC named no id for a segment it took

* Record why the merger takes the wider type, and de-duplicate the interop narrowing

* Guard the numbering hole the merger must refuse, and correct the phase record
This commit is contained in:
2026-09-12 22:37:55 +02:00
committed by GitHub
parent ca1a7473ed
commit 13e3ff8f1f
12 changed files with 121 additions and 34 deletions
+3 -3
View File
@@ -37,12 +37,12 @@ const severity: Record<MessageState, number> = {
};
/** The base and the part numbers one send's ids carry, or nothing when they do not spell out one message. */
function idNumbering(smsIds: string[]): { base: string; parts: Set<number> } | undefined {
function idNumbering(smsIds: (string | undefined)[]): { base: string; parts: Set<number> } | undefined {
const bases = new Set<string>();
const parts = new Set<number>();
for (const smsId of smsIds) {
const numbering = parseSegmentId(smsId);
const numbering = smsId === undefined ? undefined : parseSegmentId(smsId);
if (!numbering) return undefined;
@@ -93,7 +93,7 @@ export class DlrMerger {
}
/** Registers the ids one multipart send got back, so their receipts can be merged. */
expect(smsIds: string[]): void {
expect(smsIds: (string | undefined)[]): void {
if (smsIds.length < 2) return;
const numbering = idNumbering(smsIds);