From adb5dbb8fc913bb704a6eb1c37b13c02c95743a3 Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Tue, 26 Aug 2025 09:02:08 -0400 Subject: [PATCH] Clamp lookback to maximum in simulator --- api.bs | 2 +- impl/src/backend.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/api.bs b/api.bs index 6635ca0..d3b170b 100644 --- a/api.bs +++ b/api.bs @@ -1538,7 +1538,7 @@ To validate {{AttributionConversionOptions}} |options|: :: |credit| 1. Let |lookback| be |options|.{{AttributionConversionOptions/lookbackDays}} [=days=] if it [=map/exists=], the [=implementation-defined=] maximum otherwise. -1. Let |lookback| be the [=implementation-defined=] maximum +1. Set |lookback| to the [=implementation-defined=] maximum if it is larger than that maximum. 1. If |lookback| is 0 [=days=], throw a {{RangeError}}. 1. If the [=list/size=] of diff --git a/impl/src/backend.ts b/impl/src/backend.ts index bbe8c4e..fd5011f 100644 --- a/impl/src/backend.ts +++ b/impl/src/backend.ts @@ -276,6 +276,7 @@ export class Backend { if (lookbackDays <= 0 || !Number.isInteger(lookbackDays)) { throw new RangeError("lookbackDays must be a positive integer"); } + lookbackDays = Math.min(lookbackDays, this.#delegate.maxLookbackDays); const matchValueSet = new Set(); for (const value of matchValues) {