From 94da5851cac504a45fde957c5a8b4e8115d5707c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acharn=C3=A9?= Date: Fri, 21 Aug 2026 18:22:31 +0700 Subject: [PATCH] fix(seed): move pilot registrations to July and August --- services/api/scripts/seed-local.mjs | 16 ++++++---------- services/api/test/seed-local.test.mjs | 19 ++++++++++--------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/services/api/scripts/seed-local.mjs b/services/api/scripts/seed-local.mjs index 71d803ee..402cc06d 100644 --- a/services/api/scripts/seed-local.mjs +++ b/services/api/scripts/seed-local.mjs @@ -235,22 +235,18 @@ function minutesAfter(minutes) { return new Date(NOW.getTime() + minutes * 60 * 1000); } -// IAM-026/BUA-024: keep the synthetic customer-growth story bounded to the -// June-August 2026 pilot window. July carries the majority of registrations, -// while only four customer identities land after August 14. +// IAM-026/BUA-024: keep the synthetic customer-growth story bounded to July +// and the first thirteen days of August 2026. August carries roughly three +// times July's registrations, matching the requested pilot-dashboard shape. function platformAnalyticsRegistrationDate(index) { let monthIndex; let day; - if (index < 8) { - monthIndex = 5; - day = 2 + index * 4; - } else if (index < 47) { + if (index < 16) { monthIndex = 6; - day = 1 + Math.floor(((index - 8) * 31) / 39); + day = 1 + Math.floor((index * 31) / 16); } else { monthIndex = 7; - const augustIndex = index - 47; - day = augustIndex < 12 ? augustIndex + 1 : 15 + (augustIndex - 12) * 2; + day = 1 + Math.floor(((index - 16) * 13) / 47); } return new Date(Date.UTC(2026, monthIndex, day, 8 + (index % 9), (index * 11) % 60)); diff --git a/services/api/test/seed-local.test.mjs b/services/api/test/seed-local.test.mjs index 67c6dd53..5fe7125e 100644 --- a/services/api/test/seed-local.test.mjs +++ b/services/api/test/seed-local.test.mjs @@ -217,24 +217,25 @@ test('[IAM-026][BUA-024] platform overview seed uses 63 valid, unique supplied c assert.equal(new Set(analytics.users.map((user) => user.email)).size, 63); }); -test('[IAM-026][BUA-024] platform overview registrations start in June, peak in July, and leave only four customers after August 14', () => { +test('[IAM-026][BUA-024] platform overview registrations use a smaller July cohort and a larger pre-August-14 cohort', () => { const { users } = buildPlatformAnalyticsRows(); const registrationsByMonth = Object.fromEntries( - ['2026-06', '2026-07', '2026-08'].map((month) => [ + ['2026-07', '2026-08'].map((month) => [ month, users.filter((user) => user.createdAt.toISOString().startsWith(month)).length, ]), ); assert.deepEqual(registrationsByMonth, { - '2026-06': 8, - '2026-07': 39, - '2026-08': 16, + '2026-07': 16, + '2026-08': 47, }); - assert.ok(users.every((user) => user.createdAt >= new Date('2026-06-01T00:00:00.000Z'))); - assert.equal( - users.filter((user) => user.createdAt >= new Date('2026-08-15T00:00:00.000Z')).length, - 4, + assert.ok( + users.every( + (user) => + user.createdAt >= new Date('2026-07-01T00:00:00.000Z') && + user.createdAt < new Date('2026-08-14T00:00:00.000Z'), + ), ); });