@ak--47/dungeon-master 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/dungeons/technical/array-of-object-lookup.js +0 -2
- package/dungeons/technical/hook-helpers-verify.js +89 -0
- package/dungeons/technical/identity-model-verify.js +47 -0
- package/dungeons/technical/pattern-aggregate-by-bin.js +41 -0
- package/dungeons/technical/pattern-attributed-by-source.js +42 -0
- package/dungeons/technical/pattern-frequency-by-frequency.js +40 -0
- package/dungeons/technical/pattern-funnel-frequency.js +54 -0
- package/dungeons/technical/pattern-ttc-by-segment.js +45 -0
- package/dungeons/technical/simple.js +3 -4
- package/dungeons/technical/simplest-schema.json +5 -0
- package/dungeons/technical/text-generation.js +1 -1
- package/dungeons/vertical/ai-platform.js +216 -164
- package/dungeons/vertical/community.js +74 -41
- package/dungeons/vertical/crypto.js +343 -233
- package/dungeons/vertical/dating.js +246 -292
- package/dungeons/vertical/devtools.js +179 -70
- package/dungeons/vertical/ecommerce.js +275 -122
- package/dungeons/vertical/education.js +345 -312
- package/dungeons/vertical/fintech.js +445 -314
- package/dungeons/vertical/fitness.js +199 -165
- package/dungeons/vertical/food-delivery.js +309 -330
- package/dungeons/vertical/gaming.js +387 -241
- package/dungeons/vertical/healthcare.js +149 -66
- package/dungeons/vertical/insurance-application.js +173 -75
- package/dungeons/vertical/logistics.js +107 -12
- package/dungeons/vertical/marketplace.js +171 -76
- package/dungeons/vertical/media.js +259 -402
- package/dungeons/vertical/real-estate.js +336 -318
- package/dungeons/vertical/sass.js +294 -288
- package/dungeons/vertical/social.js +289 -234
- package/dungeons/vertical/travel.js +66 -20
- package/index.js +17 -17
- package/lib/core/config-validator.js +226 -175
- package/lib/core/context.js +10 -24
- package/lib/core/storage.js +6 -1
- package/lib/generators/events.js +57 -104
- package/lib/generators/funnels.js +212 -93
- package/lib/generators/mirror.js +3 -2
- package/lib/generators/product-names.js +1 -1
- package/lib/generators/scd.js +2 -1
- package/lib/generators/text.js +1 -1
- package/lib/hook-helpers/_internal.js +23 -0
- package/lib/hook-helpers/cohort.js +124 -0
- package/lib/hook-helpers/identity.js +56 -0
- package/lib/hook-helpers/index.js +44 -0
- package/lib/hook-helpers/inject.js +99 -0
- package/lib/hook-helpers/mutate.js +151 -0
- package/lib/hook-helpers/timing.js +99 -0
- package/lib/hook-patterns/aggregate-per-user-by-bin.js +38 -0
- package/lib/hook-patterns/attributed-by-source.js +72 -0
- package/lib/hook-patterns/frequency-by-frequency.js +46 -0
- package/lib/hook-patterns/funnel-frequency-breakdown.js +73 -0
- package/lib/hook-patterns/index.js +14 -0
- package/lib/hook-patterns/time-to-convert-by-segment.js +41 -0
- package/lib/orchestrators/user-loop.js +143 -293
- package/lib/utils/utils.js +97 -52
- package/lib/verify/emulate-breakdown.js +281 -0
- package/lib/verify/index.js +12 -0
- package/lib/verify/verify-dungeon.js +61 -0
- package/package.json +6 -4
- package/scripts/smoke-test-all.mjs +162 -0
- package/scripts/verify-runner.mjs +72 -24
- package/types.d.ts +434 -225
- package/dungeons/technical/ad-spend-schema.json +0 -128
- package/dungeons/technical/anonymous-users-schema.json +0 -92
- package/dungeons/technical/array-of-object-lookup-schema.json +0 -191
- package/dungeons/technical/experiments-schema.json +0 -203
- package/dungeons/technical/foobar-schema.json +0 -362
- package/dungeons/technical/group-analytics-schema.json +0 -241
- package/dungeons/technical/mirror-strategies-schema.json +0 -84
- package/dungeons/technical/nested-objects-schema.json +0 -145
- package/dungeons/technical/retention-cadence-schema.json +0 -37
- package/dungeons/technical/sanity-schema.json +0 -185
- package/dungeons/technical/scale-test-schema.json +0 -70
- package/dungeons/technical/scd-schema.json +0 -467
- package/dungeons/technical/simple-schema.json +0 -362
- package/dungeons/technical/text-generation-schema.json +0 -1062
- package/dungeons/vertical/ai-platform-schema.json +0 -617
- package/dungeons/vertical/community-schema.json +0 -579
- package/dungeons/vertical/crypto-schema.json +0 -546
- package/dungeons/vertical/dating-schema.json +0 -401
- package/dungeons/vertical/devtools-schema.json +0 -601
- package/dungeons/vertical/ecommerce-schema.json +0 -604
- package/dungeons/vertical/education-schema.json +0 -5686
- package/dungeons/vertical/fintech-schema.json +0 -630
- package/dungeons/vertical/fitness-schema.json +0 -530
- package/dungeons/vertical/food-delivery-schema.json +0 -36728
- package/dungeons/vertical/gaming-schema.json +0 -2703
- package/dungeons/vertical/healthcare-schema.json +0 -549
- package/dungeons/vertical/insurance-application-schema.json +0 -485
- package/dungeons/vertical/logistics-schema.json +0 -574
- package/dungeons/vertical/marketplace-schema.json +0 -533
- package/dungeons/vertical/media-schema.json +0 -4749
- package/dungeons/vertical/real-estate-schema.json +0 -527
- package/dungeons/vertical/sass-schema.json +0 -3128
- package/dungeons/vertical/social-schema.json +0 -620
- package/dungeons/vertical/travel-schema.json +0 -580
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ── TWEAK THESE ──
|
|
2
2
|
const SEED = "dm4-devtools";
|
|
3
|
-
const num_days =
|
|
4
|
-
const num_users =
|
|
3
|
+
const num_days = 120;
|
|
4
|
+
const num_users = 10_000;
|
|
5
5
|
const avg_events_per_user_per_day = 1.2;
|
|
6
6
|
let token = "your-mixpanel-token";
|
|
7
7
|
|
|
@@ -16,9 +16,6 @@ import * as v from "ak-tools";
|
|
|
16
16
|
|
|
17
17
|
dayjs.extend(utc);
|
|
18
18
|
const chance = u.initChance(SEED);
|
|
19
|
-
const NOW = dayjs();
|
|
20
|
-
const DATASET_START = NOW.subtract(num_days, "days");
|
|
21
|
-
|
|
22
19
|
/** @typedef {import("../../types").Dungeon} Config */
|
|
23
20
|
|
|
24
21
|
// Generate consistent pipeline/repo IDs at module level
|
|
@@ -58,9 +55,17 @@ const repoIds = v.range(1, 150).map(() => `REPO_${v.uid(6)}`);
|
|
|
58
55
|
|
|
59
56
|
/**
|
|
60
57
|
* ===============================================================
|
|
61
|
-
* ANALYTICS HOOKS (
|
|
58
|
+
* ANALYTICS HOOKS (10 hooks)
|
|
59
|
+
*
|
|
60
|
+
* Adds 10. BUILD-DEPLOY TIME-TO-CONVERT: enterprise/business 0.67x faster, free
|
|
61
|
+
* 1.33x slower (funnel-post). Discover via Build-Deploy Pipeline median TTC by tier.
|
|
62
|
+
* NOTE (funnel-post measurement): visible only via Mixpanel funnel median TTC.
|
|
63
|
+
* Cross-event MIN→MIN SQL queries on raw events do NOT show this.
|
|
62
64
|
* ===============================================================
|
|
63
65
|
*
|
|
66
|
+
* NOTE: All cohort effects are HIDDEN — discoverable only via behavioral
|
|
67
|
+
* cohorts or raw-prop breakdowns. No cohort flag is stamped on events.
|
|
68
|
+
*
|
|
64
69
|
* ---------------------------------------------------------------
|
|
65
70
|
* 1. BUILD FAILURE CASCADE (event hook)
|
|
66
71
|
* ---------------------------------------------------------------
|
|
@@ -76,40 +81,31 @@ const repoIds = v.range(1, 150).map(() => `REPO_${v.uid(6)}`);
|
|
|
76
81
|
* - Event: "build completed"
|
|
77
82
|
* - Measure: Average of "build_duration_sec"
|
|
78
83
|
* - Breakdown: "build_status"
|
|
79
|
-
* - Expected: failed ~2x longer than success
|
|
80
|
-
* (failed ~ 480s, success ~ 240s)
|
|
84
|
+
* - Expected: failed ~ 2x longer than success
|
|
81
85
|
*
|
|
82
86
|
* REAL-WORLD ANALOGUE: Failed CI builds run full test suites,
|
|
83
|
-
* timeout
|
|
84
|
-
* that inflate overall build times.
|
|
87
|
+
* timeout, and trigger retry cascades that inflate build times.
|
|
85
88
|
*
|
|
86
89
|
* ---------------------------------------------------------------
|
|
87
|
-
* 2. NIGHT DEPLOY RISK (
|
|
90
|
+
* 2. NIGHT DEPLOY RISK (everything hook)
|
|
88
91
|
* ---------------------------------------------------------------
|
|
89
92
|
*
|
|
90
|
-
* PATTERN: Deployments between 10PM-6AM get
|
|
91
|
-
* "failed" 40% of the time.
|
|
92
|
-
*
|
|
93
|
+
* PATTERN: Deployments between 10PM-6AM UTC get deploy_status forced
|
|
94
|
+
* to "failed" 40% of the time. No flag — analyst breaks down by
|
|
95
|
+
* hour-of-day on deployment-completed events to discover the risk window.
|
|
93
96
|
*
|
|
94
97
|
* HOW TO FIND IT IN MIXPANEL:
|
|
95
98
|
*
|
|
96
|
-
* Report 1: Deploy Failure Rate by Hour
|
|
99
|
+
* Report 1: Deploy Failure Rate by Hour of Day
|
|
97
100
|
* - Report type: Insights
|
|
98
101
|
* - Event: "deployment completed"
|
|
99
102
|
* - Measure: Total
|
|
100
103
|
* - Filter: deploy_status = "failed"
|
|
101
|
-
* - Breakdown:
|
|
102
|
-
* - Expected:
|
|
103
|
-
*
|
|
104
|
-
* Report 2: Night Deploy Volume
|
|
105
|
-
* - Report type: Insights
|
|
106
|
-
* - Event: "deployment completed"
|
|
107
|
-
* - Measure: Total
|
|
108
|
-
* - Breakdown: "is_night_deploy"
|
|
109
|
-
* - Expected: ~15-20% of deploys happen at night
|
|
104
|
+
* - Breakdown: hour of day
|
|
105
|
+
* - Expected: 22:00-05:59 hours show ~ 40% failure vs ~ 15% baseline
|
|
110
106
|
*
|
|
111
|
-
* REAL-WORLD ANALOGUE: Night
|
|
112
|
-
*
|
|
107
|
+
* REAL-WORLD ANALOGUE: Night deploys fail more due to skeleton crews
|
|
108
|
+
* and delayed incident response.
|
|
113
109
|
*
|
|
114
110
|
* ---------------------------------------------------------------
|
|
115
111
|
* 3. COPILOT ADOPTION -> PR VELOCITY (everything hook)
|
|
@@ -153,26 +149,26 @@ const repoIds = v.range(1, 150).map(() => `REPO_${v.uid(6)}`);
|
|
|
153
149
|
* in SRE/DevOps. Alert fatigue degrades response quality over time.
|
|
154
150
|
*
|
|
155
151
|
* ---------------------------------------------------------------
|
|
156
|
-
* 5. OPEN SOURCE
|
|
152
|
+
* 5. OPEN SOURCE POWER USAGE (everything hook)
|
|
157
153
|
* ---------------------------------------------------------------
|
|
158
154
|
*
|
|
159
|
-
* PATTERN: OSS users with >15
|
|
160
|
-
*
|
|
161
|
-
*
|
|
155
|
+
* PATTERN: OSS-segment users with >15 events get extra cloned build
|
|
156
|
+
* + deploy events in their later activity (representing power usage).
|
|
157
|
+
* Cloned events use unique offset timestamps. No flag — discover via
|
|
158
|
+
* cohort by segment + event count, observing per-user build/deploy volume.
|
|
162
159
|
*
|
|
163
160
|
* HOW TO FIND IT IN MIXPANEL:
|
|
164
161
|
*
|
|
165
|
-
* Report 1:
|
|
166
|
-
* - Report type: Insights
|
|
167
|
-
* -
|
|
168
|
-
* -
|
|
169
|
-
* -
|
|
170
|
-
* -
|
|
171
|
-
* - Expected:
|
|
162
|
+
* Report 1: Builds per User — Active OSS Users
|
|
163
|
+
* - Report type: Insights (with cohort)
|
|
164
|
+
* - Cohort A: segment = "oss_user" AND events >= 15
|
|
165
|
+
* - Cohort B: segment = "oss_user" AND events < 15
|
|
166
|
+
* - Event: "build completed"
|
|
167
|
+
* - Measure: Total per user
|
|
168
|
+
* - Expected: A noticeably higher than B
|
|
172
169
|
*
|
|
173
|
-
* REAL-WORLD ANALOGUE:
|
|
174
|
-
*
|
|
175
|
-
* paid plans.
|
|
170
|
+
* REAL-WORLD ANALOGUE: Power OSS users hit free-tier limits via
|
|
171
|
+
* heavy build/deploy volume.
|
|
176
172
|
*
|
|
177
173
|
* ---------------------------------------------------------------
|
|
178
174
|
* 6. POST-OUTAGE RECOVERY (everything hook)
|
|
@@ -232,8 +228,38 @@ const repoIds = v.range(1, 150).map(() => `REPO_${v.uid(6)}`);
|
|
|
232
228
|
* - Expected: enterprise ~ 60% vs free ~ 40% conversion
|
|
233
229
|
*
|
|
234
230
|
* REAL-WORLD ANALOGUE: Enterprise CI/CD customers get priority
|
|
235
|
-
* runners, dedicated support, and SLA-backed uptime guarantees
|
|
236
|
-
*
|
|
231
|
+
* runners, dedicated support, and SLA-backed uptime guarantees.
|
|
232
|
+
*
|
|
233
|
+
* ---------------------------------------------------------------
|
|
234
|
+
* 9. BUILD-COUNT MAGIC NUMBER (everything hook)
|
|
235
|
+
* ---------------------------------------------------------------
|
|
236
|
+
*
|
|
237
|
+
* PATTERN: Users with 15-30 "build completed" events sit in the
|
|
238
|
+
* healthy CI sweet spot — 30% extra deploy events are cloned (unique
|
|
239
|
+
* timestamps). Users with 31+ builds suffer flaky-CI burnout; ~25%
|
|
240
|
+
* of their deploy events drop. No flag — discover by binning users
|
|
241
|
+
* on build-count and comparing per-user deploy volume.
|
|
242
|
+
*
|
|
243
|
+
* HOW TO FIND IT IN MIXPANEL:
|
|
244
|
+
*
|
|
245
|
+
* Report 1: Deploys per User by Build Bucket
|
|
246
|
+
* - Report type: Insights (with cohort)
|
|
247
|
+
* - Cohort A: users with 15-30 "build completed"
|
|
248
|
+
* - Cohort B: users with 0-14 "build completed"
|
|
249
|
+
* - Event: "deployment completed"
|
|
250
|
+
* - Measure: Total per user
|
|
251
|
+
* - Expected: A ~ 1.3x B
|
|
252
|
+
*
|
|
253
|
+
* Report 2: Deploys per User on Heavy Builders
|
|
254
|
+
* - Report type: Insights (with cohort)
|
|
255
|
+
* - Cohort C: users with >= 31 "build completed"
|
|
256
|
+
* - Cohort A: users with 15-30
|
|
257
|
+
* - Event: "deployment completed"
|
|
258
|
+
* - Measure: Total per user
|
|
259
|
+
* - Expected: C ~ 25% fewer deploys per user vs A
|
|
260
|
+
*
|
|
261
|
+
* REAL-WORLD ANALOGUE: Healthy CI cadence drives reliable deploys;
|
|
262
|
+
* runaway builds signal a flaky pipeline that scares teams off ships.
|
|
237
263
|
*
|
|
238
264
|
* ===============================================================
|
|
239
265
|
* EXPECTED METRICS SUMMARY
|
|
@@ -245,20 +271,26 @@ const repoIds = v.range(1, 150).map(() => `REPO_${v.uid(6)}`);
|
|
|
245
271
|
* Night Deploy Risk | deploy failure rate | 15% | 40% | 2.7x
|
|
246
272
|
* Copilot PR Velocity | PRs/user | 3 | 4.5 | 1.5x
|
|
247
273
|
* On-Call Fatigue | response_time_min | 30min | 90min | 3x
|
|
248
|
-
* OSS
|
|
274
|
+
* OSS Power Usage | builds/user (active)| 1x | ~ 1.3x | 1.3x
|
|
249
275
|
* Post-Outage Recovery | deploys/day | 50 | 100+ | 2x+
|
|
250
276
|
* DevOps Lead Profiles | team_size | 10 | 30 | 3x
|
|
251
|
-
* Enterprise Funnel Lift | funnel conversion | 40% | 60% | ~1.5x
|
|
277
|
+
* Enterprise Funnel Lift | funnel conversion | 40% | 60% | ~ 1.5x
|
|
278
|
+
* Build-Count Magic Number | sweet deploys/user | 1x | 1.3x | 1.3x
|
|
279
|
+
* Build-Count Magic Number | over deploys/user | 1x | 0.75x | -25%
|
|
252
280
|
*/
|
|
253
281
|
|
|
254
282
|
/** @type {Config} */
|
|
255
283
|
const config = {
|
|
284
|
+
version: 2,
|
|
256
285
|
token,
|
|
257
286
|
seed: SEED,
|
|
258
|
-
|
|
287
|
+
datasetStart: "2026-01-01T00:00:00Z",
|
|
288
|
+
datasetEnd: "2026-05-01T23:59:59Z",
|
|
289
|
+
// numDays: num_days,
|
|
259
290
|
avgEventsPerUserPerDay: avg_events_per_user_per_day,
|
|
260
291
|
numUsers: num_users,
|
|
261
|
-
hasAnonIds:
|
|
292
|
+
hasAnonIds: true,
|
|
293
|
+
avgDevicePerUser: 2,
|
|
262
294
|
hasSessionIds: true,
|
|
263
295
|
format: "json",
|
|
264
296
|
gzip: true,
|
|
@@ -291,6 +323,7 @@ const config = {
|
|
|
291
323
|
event: "account created",
|
|
292
324
|
weight: 1,
|
|
293
325
|
isFirstEvent: true,
|
|
326
|
+
isAuthEvent: true,
|
|
294
327
|
properties: {
|
|
295
328
|
referral_source: ["organic", "github", "conference", "blog_post", "colleague", "search"],
|
|
296
329
|
},
|
|
@@ -317,7 +350,6 @@ const config = {
|
|
|
317
350
|
deploy_status: ["success", "success", "success", "failed", "rolled_back"],
|
|
318
351
|
environment: ["production", "production", "staging", "staging", "dev", "preview"],
|
|
319
352
|
deploy_duration_sec: u.weighNumRange(15, 300, 0.4, 90),
|
|
320
|
-
is_night_deploy: [false],
|
|
321
353
|
preview_enabled: [false],
|
|
322
354
|
},
|
|
323
355
|
},
|
|
@@ -717,6 +749,27 @@ const config = {
|
|
|
717
749
|
|
|
718
750
|
// -- Hook Function ----------------------------------------
|
|
719
751
|
hook: function (record, type, meta) {
|
|
752
|
+
// HOOK 10 (T2C): BUILD-DEPLOY TIME-TO-CONVERT (funnel-post)
|
|
753
|
+
// Enterprise tier completes Build-Deploy Pipeline funnel 1.5x faster
|
|
754
|
+
// (factor 0.67); free tier 1.33x slower (factor 1.33).
|
|
755
|
+
if (type === "funnel-post") {
|
|
756
|
+
const segment = meta?.profile?.subscription_tier;
|
|
757
|
+
if (Array.isArray(record) && record.length > 1) {
|
|
758
|
+
const factor = (
|
|
759
|
+
segment === "enterprise" || segment === "business" ? 0.67 :
|
|
760
|
+
segment === "free" ? 1.33 :
|
|
761
|
+
1.0
|
|
762
|
+
);
|
|
763
|
+
if (factor !== 1.0) {
|
|
764
|
+
for (let i = 1; i < record.length; i++) {
|
|
765
|
+
const prev = dayjs(record[i - 1].time);
|
|
766
|
+
const newGap = Math.round(dayjs(record[i].time).diff(prev) * factor);
|
|
767
|
+
record[i].time = prev.add(newGap, "milliseconds").toISOString();
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
720
773
|
// -- HOOK 7: DEVOPS LEAD PROFILE ENRICHMENT (user) --------
|
|
721
774
|
// DevOps leads get team_size 10-50 and repos_connected 5-20.
|
|
722
775
|
// Platform engineers get moderate boosts. Others stay at defaults.
|
|
@@ -747,21 +800,13 @@ const config = {
|
|
|
747
800
|
record.build_duration_sec = Math.floor((record.build_duration_sec || 240) * 2);
|
|
748
801
|
}
|
|
749
802
|
|
|
750
|
-
//
|
|
751
|
-
//
|
|
752
|
-
if (record.event === "deployment completed") {
|
|
753
|
-
const hour = dayjs(record.time).hour();
|
|
754
|
-
if (hour >= 22 || hour < 6) {
|
|
755
|
-
record.is_night_deploy = true;
|
|
756
|
-
if (chance.bool({ likelihood: 40 })) {
|
|
757
|
-
record.deploy_status = "failed";
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
}
|
|
803
|
+
// (HOOK 2: NIGHT DEPLOY RISK moved to everything hook — hour checks
|
|
804
|
+
// must run after bunchIntoSessions redistributes timestamps)
|
|
761
805
|
}
|
|
762
806
|
|
|
763
807
|
// -- EVERYTHING HOOKS -------------------------------------
|
|
764
808
|
if (type === "everything") {
|
|
809
|
+
const datasetStart = dayjs.unix(meta.datasetStart);
|
|
765
810
|
let events = record;
|
|
766
811
|
if (!events.length) return record;
|
|
767
812
|
const profile = meta && meta.profile ? meta.profile : {};
|
|
@@ -775,6 +820,19 @@ const config = {
|
|
|
775
820
|
if (profile.language) e.language = profile.language;
|
|
776
821
|
});
|
|
777
822
|
|
|
823
|
+
// -- HOOK 2: NIGHT DEPLOY RISK -------------------------
|
|
824
|
+
// Deployments between 10PM-6AM get deploy_status forced to
|
|
825
|
+
// "failed" 40% of the time. No flag — analyst breaks down by
|
|
826
|
+
// hour-of-day on deployment completed events.
|
|
827
|
+
events.forEach(e => {
|
|
828
|
+
if (e.event === "deployment completed") {
|
|
829
|
+
const hour = new Date(e.time).getUTCHours();
|
|
830
|
+
if ((hour >= 22 || hour < 6) && chance.bool({ likelihood: 40 })) {
|
|
831
|
+
e.deploy_status = "failed";
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
|
|
778
836
|
// -- HOOK 8: ENTERPRISE BUILD-DEPLOY FUNNEL LIFT ------
|
|
779
837
|
// Free-tier users drop 35% of final funnel step events to
|
|
780
838
|
// create visible conversion gap vs paid subscribers.
|
|
@@ -786,11 +844,16 @@ const config = {
|
|
|
786
844
|
}
|
|
787
845
|
|
|
788
846
|
// -- HOOK 3: COPILOT PR VELOCITY ----------------------
|
|
789
|
-
//
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
);
|
|
793
|
-
if (
|
|
847
|
+
// ~30% of users are copilot adopters (hash-based cohort).
|
|
848
|
+
// Copilot users get ai_assist="copilot" stamped and 1.5x more PRs.
|
|
849
|
+
const uid = events[0]?.user_id || "";
|
|
850
|
+
const isCopilotUser = (typeof uid === "string" ? uid.charCodeAt(0) : uid) % 10 < 3;
|
|
851
|
+
if (isCopilotUser) {
|
|
852
|
+
events.forEach(e => {
|
|
853
|
+
if (e.event === "pull request created" || e.event === "code review completed") {
|
|
854
|
+
e.ai_assist = "copilot";
|
|
855
|
+
}
|
|
856
|
+
});
|
|
794
857
|
const prEvents = events.filter(e => e.event === "pull request created");
|
|
795
858
|
const extraCount = Math.floor(prEvents.length * 0.5);
|
|
796
859
|
for (let i = 0; i < extraCount; i++) {
|
|
@@ -823,12 +886,58 @@ const config = {
|
|
|
823
886
|
});
|
|
824
887
|
}
|
|
825
888
|
|
|
826
|
-
// -- HOOK 5: OPEN SOURCE
|
|
827
|
-
// OSS users with >15 events get
|
|
889
|
+
// -- HOOK 5: OPEN SOURCE POWER USAGE ------------------
|
|
890
|
+
// OSS users with >15 events get extra cloned build + deploy events
|
|
891
|
+
// in their later activity (representing power usage that pushes them
|
|
892
|
+
// toward limits). No flag — discover via cohort by segment + event count.
|
|
828
893
|
if (profile.segment === "oss_user" && events.length > 15) {
|
|
829
|
-
const
|
|
830
|
-
|
|
831
|
-
|
|
894
|
+
const buildTemplate = events.find(e => e.event === "build completed");
|
|
895
|
+
const deployTemplate = events.find(e => e.event === "deployment completed");
|
|
896
|
+
if (buildTemplate || deployTemplate) {
|
|
897
|
+
const conversionPoint = Math.floor(events.length * 0.7);
|
|
898
|
+
const tail = events.slice(conversionPoint);
|
|
899
|
+
tail.forEach(e => {
|
|
900
|
+
const tBase = dayjs(e.time);
|
|
901
|
+
if (buildTemplate && chance.bool({ likelihood: 30 })) {
|
|
902
|
+
events.push({
|
|
903
|
+
...buildTemplate,
|
|
904
|
+
time: tBase.add(chance.integer({ min: 5, max: 240 }), "minutes").toISOString(),
|
|
905
|
+
user_id: e.user_id,
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
if (deployTemplate && chance.bool({ likelihood: 20 })) {
|
|
909
|
+
events.push({
|
|
910
|
+
...deployTemplate,
|
|
911
|
+
time: tBase.add(chance.integer({ min: 10, max: 240 }), "minutes").toISOString(),
|
|
912
|
+
user_id: e.user_id,
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
// -- HOOK 9: BUILD-COUNT MAGIC NUMBER (no flags) ------
|
|
920
|
+
// Sweet 15-30 builds → +50% deploys (clone with unique offset).
|
|
921
|
+
// Over 31+ → drop 40% of deploys (flaky CI burnout).
|
|
922
|
+
const buildCount = events.filter(e => e.event === "build completed").length;
|
|
923
|
+
if (buildCount >= 15 && buildCount <= 30) {
|
|
924
|
+
const deploys = events.filter(e => e.event === "deployment completed");
|
|
925
|
+
const extras = Math.max(Math.floor(deploys.length * 0.5), 1);
|
|
926
|
+
for (let k = 0; k < extras; k++) {
|
|
927
|
+
const tpl = deploys[k % deploys.length];
|
|
928
|
+
if (tpl) {
|
|
929
|
+
events.push({
|
|
930
|
+
...tpl,
|
|
931
|
+
time: dayjs(tpl.time).add(chance.integer({ min: 5, max: 360 }), "minutes").toISOString(),
|
|
932
|
+
user_id: tpl.user_id,
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
} else if (buildCount >= 31) {
|
|
937
|
+
for (let i = events.length - 1; i >= 0; i--) {
|
|
938
|
+
if (events[i].event === "deployment completed" && chance.bool({ likelihood: 40 })) {
|
|
939
|
+
events.splice(i, 1);
|
|
940
|
+
}
|
|
832
941
|
}
|
|
833
942
|
}
|
|
834
943
|
|
|
@@ -837,8 +946,8 @@ const config = {
|
|
|
837
946
|
// aggressively cloned to produce a visible spike above baseline.
|
|
838
947
|
// Shifted later than outage end (d42.25) so natural volume has
|
|
839
948
|
// recovered from the 0.05x suppression before cloning kicks in.
|
|
840
|
-
const RECOVERY_START =
|
|
841
|
-
const RECOVERY_END =
|
|
949
|
+
const RECOVERY_START = datasetStart.add(44, "days");
|
|
950
|
+
const RECOVERY_END = datasetStart.add(48, "days");
|
|
842
951
|
const deployEvents = events.filter(e => {
|
|
843
952
|
if (e.event !== "deployment completed") return false;
|
|
844
953
|
const t = dayjs(e.time);
|