Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions services/api/scripts/seed-local.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
19 changes: 10 additions & 9 deletions services/api/test/seed-local.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
),
);
});

Expand Down
Loading