@scalebun/react-native 1.0.3 → 1.0.4

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.
Files changed (223) hide show
  1. package/android/src/main/java/com/scalebun/core/crash/CrashStorage.kt +115 -1
  2. package/android/src/main/java/com/scalebun/core/crash/NativeCrashHandler.kt +14 -0
  3. package/android/src/main/java/com/scalebun/replaysdk/ReplaySdkModule.kt +25 -9
  4. package/android/src/main/java/com/scalebun/replaysdk/voice/VoiceTranscriber.kt +68 -2
  5. package/android/src/main/java/com/scalebun/rn/crash/ScaleBunCrashModule.kt +66 -2
  6. package/ios/Crash/ScaleBunCrashBridge.mm +6 -0
  7. package/ios/Crash/ScaleBunCrashHandler.swift +14 -1
  8. package/ios/Crash/ScaleBunCrashModule.swift +14 -0
  9. package/ios/Crash/ScaleBunCrashSignalBridge.h +32 -1
  10. package/ios/Crash/ScaleBunCrashSignalBridge.m +172 -7
  11. package/ios/Crash/ScaleBunCrashSignalStress.c +137 -0
  12. package/ios/Crash/ScaleBunCrashStorage.swift +75 -0
  13. package/lib/commonjs/analytics/EventTracker.js +30 -2
  14. package/lib/commonjs/analytics/EventTracker.js.map +1 -1
  15. package/lib/commonjs/bootstrap/SDKBootstrapper.js +19 -14
  16. package/lib/commonjs/bootstrap/SDKBootstrapper.js.map +1 -1
  17. package/lib/commonjs/core/config/schema.js +13 -5
  18. package/lib/commonjs/core/config/schema.js.map +1 -1
  19. package/lib/commonjs/core/context/device.js +130 -0
  20. package/lib/commonjs/core/context/device.js.map +1 -1
  21. package/lib/commonjs/debug/replayWiring.js +2 -1
  22. package/lib/commonjs/debug/replayWiring.js.map +1 -1
  23. package/lib/commonjs/features/bugreport/BugReportFeature.js +112 -0
  24. package/lib/commonjs/features/bugreport/BugReportFeature.js.map +1 -0
  25. package/lib/commonjs/features/bugreport/buildPayload.js +97 -0
  26. package/lib/commonjs/features/bugreport/buildPayload.js.map +1 -0
  27. package/lib/commonjs/features/crash/CrashReporter.js +25 -1
  28. package/lib/commonjs/features/crash/CrashReporter.js.map +1 -1
  29. package/lib/commonjs/features/crash/capture.js +27 -9
  30. package/lib/commonjs/features/crash/capture.js.map +1 -1
  31. package/lib/commonjs/features/crash/nativeCrashBridge.js +163 -28
  32. package/lib/commonjs/features/crash/nativeCrashBridge.js.map +1 -1
  33. package/lib/commonjs/features/engage/EngagePromptProvider.js +36 -2
  34. package/lib/commonjs/features/engage/EngagePromptProvider.js.map +1 -1
  35. package/lib/commonjs/features/engage/EngagePromptView.js +47 -14
  36. package/lib/commonjs/features/engage/EngagePromptView.js.map +1 -1
  37. package/lib/commonjs/features/engage/engageTriggerEngine.js +10 -0
  38. package/lib/commonjs/features/engage/engageTriggerEngine.js.map +1 -1
  39. package/lib/commonjs/features/engage/engageTypes.js.map +1 -1
  40. package/lib/commonjs/features/journey/ScaleBunDebugRoot.js +2 -1
  41. package/lib/commonjs/features/journey/ScaleBunDebugRoot.js.map +1 -1
  42. package/lib/commonjs/features/ota/OtaOrchestrator.js +63 -5
  43. package/lib/commonjs/features/ota/OtaOrchestrator.js.map +1 -1
  44. package/lib/commonjs/features/ota/deviceAttributes.js +48 -0
  45. package/lib/commonjs/features/ota/deviceAttributes.js.map +1 -0
  46. package/lib/commonjs/features/ota/geoCountry.js +93 -0
  47. package/lib/commonjs/features/ota/geoCountry.js.map +1 -0
  48. package/lib/commonjs/features/ota/useOtaUpdate.js +4 -1
  49. package/lib/commonjs/features/ota/useOtaUpdate.js.map +1 -1
  50. package/lib/commonjs/features/performance/PerformanceFeature.js +23 -9
  51. package/lib/commonjs/features/performance/PerformanceFeature.js.map +1 -1
  52. package/lib/commonjs/features/performance/collectors/FrameMetricsCollector.js +69 -9
  53. package/lib/commonjs/features/performance/collectors/FrameMetricsCollector.js.map +1 -1
  54. package/lib/commonjs/features/performance/transport/PerformanceTransport.js +25 -0
  55. package/lib/commonjs/features/performance/transport/PerformanceTransport.js.map +1 -1
  56. package/lib/commonjs/features/session/BackendSessionAdapter.js +128 -11
  57. package/lib/commonjs/features/session/BackendSessionAdapter.js.map +1 -1
  58. package/lib/commonjs/features/session/JourneyEventPipeline.js +1 -0
  59. package/lib/commonjs/features/session/JourneyEventPipeline.js.map +1 -1
  60. package/lib/commonjs/features/session/ReplayCaptureManager.js +46 -0
  61. package/lib/commonjs/features/session/ReplayCaptureManager.js.map +1 -1
  62. package/lib/commonjs/features/session/SessionManager.js +42 -12
  63. package/lib/commonjs/features/session/SessionManager.js.map +1 -1
  64. package/lib/commonjs/features/session/nativeCapture.js +4 -4
  65. package/lib/commonjs/features/session/nativeCapture.js.map +1 -1
  66. package/lib/commonjs/features/session/outboxFrameCapture.js +3 -2
  67. package/lib/commonjs/features/session/outboxFrameCapture.js.map +1 -1
  68. package/lib/commonjs/features/session/sessionTypes.js.map +1 -1
  69. package/lib/commonjs/index.js +13 -0
  70. package/lib/commonjs/index.js.map +1 -1
  71. package/lib/commonjs/public/ScaleBunFacade.js +150 -2
  72. package/lib/commonjs/public/ScaleBunFacade.js.map +1 -1
  73. package/lib/commonjs/specs/NativeScaleBunCrash.js.map +1 -1
  74. package/lib/module/analytics/EventTracker.js +29 -1
  75. package/lib/module/analytics/EventTracker.js.map +1 -1
  76. package/lib/module/bootstrap/SDKBootstrapper.js +17 -12
  77. package/lib/module/bootstrap/SDKBootstrapper.js.map +1 -1
  78. package/lib/module/core/config/schema.js +13 -5
  79. package/lib/module/core/config/schema.js.map +1 -1
  80. package/lib/module/core/context/device.js +119 -0
  81. package/lib/module/core/context/device.js.map +1 -1
  82. package/lib/module/debug/replayWiring.js +2 -1
  83. package/lib/module/debug/replayWiring.js.map +1 -1
  84. package/lib/module/features/bugreport/BugReportFeature.js +105 -0
  85. package/lib/module/features/bugreport/BugReportFeature.js.map +1 -0
  86. package/lib/module/features/bugreport/buildPayload.js +91 -0
  87. package/lib/module/features/bugreport/buildPayload.js.map +1 -0
  88. package/lib/module/features/crash/CrashReporter.js +25 -1
  89. package/lib/module/features/crash/CrashReporter.js.map +1 -1
  90. package/lib/module/features/crash/capture.js +28 -9
  91. package/lib/module/features/crash/capture.js.map +1 -1
  92. package/lib/module/features/crash/nativeCrashBridge.js +161 -28
  93. package/lib/module/features/crash/nativeCrashBridge.js.map +1 -1
  94. package/lib/module/features/engage/EngagePromptProvider.js +36 -2
  95. package/lib/module/features/engage/EngagePromptProvider.js.map +1 -1
  96. package/lib/module/features/engage/EngagePromptView.js +47 -14
  97. package/lib/module/features/engage/EngagePromptView.js.map +1 -1
  98. package/lib/module/features/engage/engageTriggerEngine.js +10 -0
  99. package/lib/module/features/engage/engageTriggerEngine.js.map +1 -1
  100. package/lib/module/features/engage/engageTypes.js.map +1 -1
  101. package/lib/module/features/journey/ScaleBunDebugRoot.js +2 -1
  102. package/lib/module/features/journey/ScaleBunDebugRoot.js.map +1 -1
  103. package/lib/module/features/ota/OtaOrchestrator.js +63 -5
  104. package/lib/module/features/ota/OtaOrchestrator.js.map +1 -1
  105. package/lib/module/features/ota/deviceAttributes.js +43 -0
  106. package/lib/module/features/ota/deviceAttributes.js.map +1 -0
  107. package/lib/module/features/ota/geoCountry.js +86 -0
  108. package/lib/module/features/ota/geoCountry.js.map +1 -0
  109. package/lib/module/features/ota/useOtaUpdate.js +4 -1
  110. package/lib/module/features/ota/useOtaUpdate.js.map +1 -1
  111. package/lib/module/features/performance/PerformanceFeature.js +23 -9
  112. package/lib/module/features/performance/PerformanceFeature.js.map +1 -1
  113. package/lib/module/features/performance/collectors/FrameMetricsCollector.js +70 -10
  114. package/lib/module/features/performance/collectors/FrameMetricsCollector.js.map +1 -1
  115. package/lib/module/features/performance/transport/PerformanceTransport.js +25 -0
  116. package/lib/module/features/performance/transport/PerformanceTransport.js.map +1 -1
  117. package/lib/module/features/session/BackendSessionAdapter.js +128 -11
  118. package/lib/module/features/session/BackendSessionAdapter.js.map +1 -1
  119. package/lib/module/features/session/JourneyEventPipeline.js +1 -0
  120. package/lib/module/features/session/JourneyEventPipeline.js.map +1 -1
  121. package/lib/module/features/session/ReplayCaptureManager.js +46 -0
  122. package/lib/module/features/session/ReplayCaptureManager.js.map +1 -1
  123. package/lib/module/features/session/SessionManager.js +42 -12
  124. package/lib/module/features/session/SessionManager.js.map +1 -1
  125. package/lib/module/features/session/nativeCapture.js +4 -5
  126. package/lib/module/features/session/nativeCapture.js.map +1 -1
  127. package/lib/module/features/session/outboxFrameCapture.js +3 -2
  128. package/lib/module/features/session/outboxFrameCapture.js.map +1 -1
  129. package/lib/module/features/session/sessionTypes.js.map +1 -1
  130. package/lib/module/index.js +3 -0
  131. package/lib/module/index.js.map +1 -1
  132. package/lib/module/public/ScaleBunFacade.js +150 -2
  133. package/lib/module/public/ScaleBunFacade.js.map +1 -1
  134. package/lib/module/specs/NativeScaleBunCrash.js.map +1 -1
  135. package/lib/typescript/analytics/EventTracker.d.ts +20 -0
  136. package/lib/typescript/analytics/EventTracker.d.ts.map +1 -1
  137. package/lib/typescript/bootstrap/SDKBootstrapper.d.ts.map +1 -1
  138. package/lib/typescript/core/config/schema.d.ts +1 -1
  139. package/lib/typescript/core/config/schema.d.ts.map +1 -1
  140. package/lib/typescript/core/context/device.d.ts +46 -0
  141. package/lib/typescript/core/context/device.d.ts.map +1 -1
  142. package/lib/typescript/debug/replayWiring.d.ts.map +1 -1
  143. package/lib/typescript/features/bugreport/BugReportFeature.d.ts +59 -0
  144. package/lib/typescript/features/bugreport/BugReportFeature.d.ts.map +1 -0
  145. package/lib/typescript/features/bugreport/buildPayload.d.ts +51 -0
  146. package/lib/typescript/features/bugreport/buildPayload.d.ts.map +1 -0
  147. package/lib/typescript/features/crash/CrashReporter.d.ts +20 -1
  148. package/lib/typescript/features/crash/CrashReporter.d.ts.map +1 -1
  149. package/lib/typescript/features/crash/capture.d.ts +21 -2
  150. package/lib/typescript/features/crash/capture.d.ts.map +1 -1
  151. package/lib/typescript/features/crash/nativeCrashBridge.d.ts +16 -3
  152. package/lib/typescript/features/crash/nativeCrashBridge.d.ts.map +1 -1
  153. package/lib/typescript/features/engage/EngagePromptProvider.d.ts.map +1 -1
  154. package/lib/typescript/features/engage/EngagePromptView.d.ts.map +1 -1
  155. package/lib/typescript/features/engage/engageTriggerEngine.d.ts.map +1 -1
  156. package/lib/typescript/features/engage/engageTypes.d.ts +15 -0
  157. package/lib/typescript/features/engage/engageTypes.d.ts.map +1 -1
  158. package/lib/typescript/features/journey/ScaleBunDebugRoot.d.ts.map +1 -1
  159. package/lib/typescript/features/ota/OtaOrchestrator.d.ts +8 -2
  160. package/lib/typescript/features/ota/OtaOrchestrator.d.ts.map +1 -1
  161. package/lib/typescript/features/ota/deviceAttributes.d.ts +18 -0
  162. package/lib/typescript/features/ota/deviceAttributes.d.ts.map +1 -0
  163. package/lib/typescript/features/ota/geoCountry.d.ts +14 -0
  164. package/lib/typescript/features/ota/geoCountry.d.ts.map +1 -0
  165. package/lib/typescript/features/ota/useOtaUpdate.d.ts +20 -2
  166. package/lib/typescript/features/ota/useOtaUpdate.d.ts.map +1 -1
  167. package/lib/typescript/features/performance/PerformanceFeature.d.ts +0 -1
  168. package/lib/typescript/features/performance/PerformanceFeature.d.ts.map +1 -1
  169. package/lib/typescript/features/performance/collectors/FrameMetricsCollector.d.ts +33 -0
  170. package/lib/typescript/features/performance/collectors/FrameMetricsCollector.d.ts.map +1 -1
  171. package/lib/typescript/features/performance/transport/PerformanceTransport.d.ts.map +1 -1
  172. package/lib/typescript/features/session/BackendSessionAdapter.d.ts +42 -2
  173. package/lib/typescript/features/session/BackendSessionAdapter.d.ts.map +1 -1
  174. package/lib/typescript/features/session/JourneyEventPipeline.d.ts +2 -0
  175. package/lib/typescript/features/session/JourneyEventPipeline.d.ts.map +1 -1
  176. package/lib/typescript/features/session/ReplayCaptureManager.d.ts +38 -1
  177. package/lib/typescript/features/session/ReplayCaptureManager.d.ts.map +1 -1
  178. package/lib/typescript/features/session/SessionManager.d.ts.map +1 -1
  179. package/lib/typescript/features/session/nativeCapture.d.ts +2 -1
  180. package/lib/typescript/features/session/nativeCapture.d.ts.map +1 -1
  181. package/lib/typescript/features/session/outboxFrameCapture.d.ts.map +1 -1
  182. package/lib/typescript/features/session/sessionTypes.d.ts +20 -3
  183. package/lib/typescript/features/session/sessionTypes.d.ts.map +1 -1
  184. package/lib/typescript/index.d.ts +1 -0
  185. package/lib/typescript/index.d.ts.map +1 -1
  186. package/lib/typescript/public/ScaleBunFacade.d.ts +58 -0
  187. package/lib/typescript/public/ScaleBunFacade.d.ts.map +1 -1
  188. package/lib/typescript/specs/NativeScaleBunCrash.d.ts +14 -0
  189. package/lib/typescript/specs/NativeScaleBunCrash.d.ts.map +1 -1
  190. package/lib/typescript/vendor/protocol/index.d.ts +17 -17
  191. package/package.json +1 -1
  192. package/src/analytics/EventTracker.ts +28 -1
  193. package/src/bootstrap/SDKBootstrapper.ts +15 -14
  194. package/src/core/config/schema.ts +13 -5
  195. package/src/core/context/device.ts +146 -0
  196. package/src/debug/replayWiring.ts +2 -1
  197. package/src/features/bugreport/BugReportFeature.ts +128 -0
  198. package/src/features/bugreport/buildPayload.ts +116 -0
  199. package/src/features/crash/CrashReporter.ts +40 -1
  200. package/src/features/crash/capture.ts +36 -9
  201. package/src/features/crash/nativeCrashBridge.ts +156 -22
  202. package/src/features/engage/EngagePromptProvider.tsx +48 -2
  203. package/src/features/engage/EngagePromptView.tsx +51 -15
  204. package/src/features/engage/engageTriggerEngine.ts +15 -0
  205. package/src/features/engage/engageTypes.ts +15 -0
  206. package/src/features/journey/ScaleBunDebugRoot.tsx +2 -1
  207. package/src/features/ota/OtaOrchestrator.ts +75 -6
  208. package/src/features/ota/deviceAttributes.ts +46 -0
  209. package/src/features/ota/geoCountry.ts +85 -0
  210. package/src/features/ota/useOtaUpdate.ts +20 -2
  211. package/src/features/performance/PerformanceFeature.ts +22 -9
  212. package/src/features/performance/collectors/FrameMetricsCollector.ts +72 -10
  213. package/src/features/performance/transport/PerformanceTransport.ts +18 -0
  214. package/src/features/session/BackendSessionAdapter.ts +137 -10
  215. package/src/features/session/JourneyEventPipeline.ts +3 -0
  216. package/src/features/session/ReplayCaptureManager.ts +53 -1
  217. package/src/features/session/SessionManager.ts +46 -7
  218. package/src/features/session/nativeCapture.ts +3 -2
  219. package/src/features/session/outboxFrameCapture.ts +3 -2
  220. package/src/features/session/sessionTypes.ts +26 -3
  221. package/src/index.ts +3 -0
  222. package/src/public/ScaleBunFacade.ts +153 -2
  223. package/src/specs/NativeScaleBunCrash.ts +16 -0
@@ -17,11 +17,59 @@
17
17
  #include <unistd.h>
18
18
  #include <string.h>
19
19
  #include <time.h>
20
+ #include <stdlib.h>
20
21
 
21
22
  // ─── Statics (set once at install time, read-only after) ────────────────────
22
23
 
23
24
  static const char *scalebun_crash_path = NULL;
24
25
 
26
+ /**
27
+ * The active session id, published as a FILE and read back through the filesystem.
28
+ *
29
+ * ── WHY NOT A SHARED BUFFER ────────────────────────────────────────────────────────────────────
30
+ *
31
+ * The previous version of this file kept the id in a static char array and published its length
32
+ * last through a `volatile sig_atomic_t`, arguing that a handler therefore saw either the old id or
33
+ * the new one. THAT ARGUMENT WAS WRONG, and the counter-example is short:
34
+ *
35
+ * published: "sess-AAAAAAAAAAAAAAAA" len = 21
36
+ * setter begins overwriting IN PLACE with "sess-BBBBBBBBBBBBBBBB" (same length)
37
+ * signal arrives after 3 bytes buffer = "sess-BBBAAAAAAAAAAAAA"
38
+ * len is UNCHANGED and still valid → handler emits the torn id
39
+ *
40
+ * Publishing the length last only orders the length against the bytes. It does nothing when the new
41
+ * id is the same length as the old one — which is the normal case, since every session id here is
42
+ * `sess-` plus a UUID. Modelled over every interrupt point, 15 of 22 tore.
43
+ *
44
+ * `volatile sig_atomic_t` guarantees atomic access to THAT SCALAR. It says nothing about the
45
+ * ordinary `char[]` beside it. C11 7.14.1.1p5 is stricter still: inside a handler, the only objects
46
+ * a program may access are lock-free atomics and objects of type `volatile sig_atomic_t`. Reading a
47
+ * concurrently-modified ordinary array is undefined behaviour regardless of how it is ordered.
48
+ *
49
+ * A double buffer does not fix this either: with two slots, the third publication overwrites the
50
+ * slot a handler may still be reading. More slots widen the window without closing it, because
51
+ * nothing tells the publisher when a handler has finished.
52
+ *
53
+ * ── WHY A FILE IS ACTUALLY SAFE ────────────────────────────────────────────────────────────────
54
+ *
55
+ * The publisher writes a temp file and `rename(2)`s it over the marker. POSIX requires rename to be
56
+ * ATOMIC: a concurrent `open(2)` resolves to either the old inode or the new one, and each contains
57
+ * one complete id. There is no state shared between publisher and handler at all — no buffer, no
58
+ * length, no flag — so there is nothing to tear.
59
+ *
60
+ * That property is also what makes it correct ACROSS THREADS. A buffer scheme only reasons about a
61
+ * signal interrupting the publishing thread; this one holds even when the signal is delivered to a
62
+ * different thread while another is mid-publication, because the two never touch the same memory.
63
+ *
64
+ * The handler pays one extra open/read/close. It already performs open/write/close for the crash
65
+ * record itself, so this adds no new class of operation — see the safety table in the header.
66
+ */
67
+ #define SCALEBUN_SESSION_MAX 128
68
+
69
+ /* Set once at install, read-only afterwards — never mutated while a handler could run. */
70
+ static const char *scalebun_session_marker_path = NULL;
71
+ static const char *scalebun_session_tmp_path = NULL;
72
+
25
73
  static struct sigaction scalebun_prev_sigabrt;
26
74
  static struct sigaction scalebun_prev_sigbus;
27
75
  static struct sigaction scalebun_prev_sigsegv;
@@ -63,15 +111,61 @@ static void scalebun_write_signal_crash(int sig) {
63
111
  char tsbuf[24];
64
112
  int tslen = scalebun_itoa(tsbuf, ms);
65
113
 
66
- const char *prefix = "{\"name\":\"crash.native\",\"signal\":";
67
- const char *mid = ",\"platform\":\"ios\",\"timestamp\":";
68
- const char *suffix = "}";
114
+ /*
115
+ * Literal lengths computed at COMPILE time, not by strlen.
116
+ *
117
+ * strlen is not on the POSIX async-signal-safe list. Calling it only on string literals is
118
+ * defensible in practice — it is a pure read of immutable memory — but "defensible in practice"
119
+ * is exactly the kind of reasoning that produced the torn buffer this file used to have. sizeof
120
+ * on a char array removes the call and the argument along with it.
121
+ */
122
+ static const char prefix[] = "{\"name\":\"crash.native\",\"signal\":";
123
+ static const char mid[] = ",\"platform\":\"ios\",\"timestamp\":";
124
+ static const char sidkey[] = ",\"sessionId\":\"";
125
+ static const char cidkey[] = ",\"crashId\":\"sig-";
126
+ static const char quote[] = "\"";
127
+ static const char suffix[] = "}";
69
128
 
70
- write(fd, prefix, strlen(prefix));
129
+ write(fd, prefix, sizeof(prefix) - 1);
71
130
  write(fd, sigbuf, (size_t)siglen);
72
- write(fd, mid, strlen(mid));
131
+ write(fd, mid, sizeof(mid) - 1);
73
132
  write(fd, tsbuf, (size_t)tslen);
74
- write(fd, suffix, strlen(suffix));
133
+
134
+ /*
135
+ * Session id — read from the marker file into a STACK buffer.
136
+ *
137
+ * open/read/close are async-signal-safe, the buffer is automatic storage (no allocation), and
138
+ * no mutable global is touched. Because the publisher installs the marker with rename(2), this
139
+ * open resolves to a single complete id: either the previous one or the new one, never a mix.
140
+ *
141
+ * The publisher guarantees the bytes are already JSON-safe, so nothing is escaped here —
142
+ * escaping arbitrary input inside a signal handler would be solving a problem we can avoid
143
+ * having.
144
+ */
145
+ if (scalebun_session_marker_path) {
146
+ char sidbuf[SCALEBUN_SESSION_MAX];
147
+ int sfd = open(scalebun_session_marker_path, O_RDONLY);
148
+ if (sfd >= 0) {
149
+ ssize_t n = read(sfd, sidbuf, sizeof(sidbuf));
150
+ close(sfd);
151
+ if (n > 0) {
152
+ write(fd, sidkey, sizeof(sidkey) - 1);
153
+ write(fd, sidbuf, (size_t)n);
154
+ write(fd, quote, sizeof(quote) - 1);
155
+ }
156
+ }
157
+ }
158
+
159
+ /*
160
+ * A STABLE crash id, so a signal crash gets the same at-least-once retry protection as every
161
+ * other crash. Derived from the timestamp already computed above — no allocation, no RNG, and
162
+ * identical on every read of this file, which is what the backend dedupes on.
163
+ */
164
+ write(fd, cidkey, sizeof(cidkey) - 1);
165
+ write(fd, tsbuf, (size_t)tslen);
166
+ write(fd, quote, sizeof(quote) - 1);
167
+
168
+ write(fd, suffix, sizeof(suffix) - 1);
75
169
  close(fd);
76
170
  }
77
171
 
@@ -109,8 +203,79 @@ static void scalebun_handle_sigfpe(int sig) {
109
203
 
110
204
  // ─── Install ─────────────────────────────────────────────────────────────────
111
205
 
112
- void ScaleBunCrashSignalBridgeInstall(const char *crashFilePath) {
206
+ /**
207
+ * Publish the active session id for the signal handler to read.
208
+ *
209
+ * Called from normal code (the main thread, once per session) — NOT from a signal handler. All the
210
+ * unsafe work happens here, where it is safe, so the handler is left with a read and a write.
211
+ *
212
+ * SANITISED HERE, ON PURPOSE. Anything that is not `[A-Za-z0-9_.:-]` is dropped, which makes the
213
+ * stored bytes valid inside a JSON string with no escaping. That is what lets the handler emit them
214
+ * directly: escaping in a signal handler would mean branching over arbitrary input to solve a
215
+ * problem we can simply not have. Session ids are `sess-<uuid>`, so nothing legitimate is lost.
216
+ *
217
+ * Over-long ids are TRUNCATED rather than rejected — a truncated id is still a strong hint for a
218
+ * human, and refusing to publish would silently return to the un-attributed behaviour.
219
+ */
220
+ void ScaleBunCrashSignalBridgeSetSessionId(const char *sessionId) {
221
+ if (!scalebun_session_marker_path || !scalebun_session_tmp_path) return;
222
+
223
+ if (sessionId == NULL) {
224
+ unlink(scalebun_session_marker_path);
225
+ return;
226
+ }
227
+
228
+ /*
229
+ * Sanitise into a local buffer. Restricted to [A-Za-z0-9_.:-] so the stored bytes are valid
230
+ * inside a JSON string with no escaping — which is what lets the handler emit them directly.
231
+ * Session ids are `sess-<uuid>`, so nothing legitimate is lost. Over-long ids are truncated
232
+ * rather than rejected: a truncated id still identifies the session to a human, whereas
233
+ * refusing to publish would silently return to unattributed crashes.
234
+ */
235
+ char clean[SCALEBUN_SESSION_MAX];
236
+ int out = 0;
237
+ for (int i = 0; sessionId[i] != '\0' && out < SCALEBUN_SESSION_MAX; i++) {
238
+ char c = sessionId[i];
239
+ int ok = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
240
+ (c >= '0' && c <= '9') || c == '-' || c == '_' || c == '.' || c == ':';
241
+ if (ok) clean[out++] = c;
242
+ }
243
+ if (out == 0) {
244
+ unlink(scalebun_session_marker_path);
245
+ return;
246
+ }
247
+
248
+ /*
249
+ * WRITE THEN RENAME — this is the whole safety argument.
250
+ *
251
+ * The temp file is written and closed completely before it is visible under the marker name.
252
+ * `rename(2)` is required by POSIX to be atomic, so a handler's `open` of the marker resolves
253
+ * to exactly one inode: the previous complete id, or the new complete id. A partially written
254
+ * file is never reachable under that name.
255
+ *
256
+ * Runs on a normal thread, so none of this needs to be async-signal-safe — only the READ side
257
+ * does. That asymmetry is the point: all the delicate work happens where delicacy is allowed.
258
+ */
259
+ int fd = open(scalebun_session_tmp_path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
260
+ if (fd < 0) return;
261
+ ssize_t written = write(fd, clean, (size_t)out);
262
+ close(fd);
263
+ if (written != (ssize_t)out) {
264
+ // A short or failed write must not be promoted to the marker — the old id is better than a
265
+ // truncated new one, and leaving the marker untouched keeps it.
266
+ unlink(scalebun_session_tmp_path);
267
+ return;
268
+ }
269
+ rename(scalebun_session_tmp_path, scalebun_session_marker_path);
270
+ }
271
+
272
+ void ScaleBunCrashSignalBridgeInstall(const char *crashFilePath,
273
+ const char *sessionMarkerPath,
274
+ const char *sessionTmpPath) {
113
275
  scalebun_crash_path = crashFilePath;
276
+ // Captured once and read-only afterwards, so the handler never dereferences changing state.
277
+ scalebun_session_marker_path = sessionMarkerPath;
278
+ scalebun_session_tmp_path = sessionTmpPath;
114
279
 
115
280
  struct sigaction sa;
116
281
  memset(&sa, 0, sizeof(sa));
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Stress test for the session-id publication primitive.
3
+ *
4
+ * clang -o /tmp/sbstress ScaleBunCrashSignalStress.c ScaleBunCrashSignalBridge.c && /tmp/sbstress
5
+ *
6
+ * (ScaleBunCrashSignalBridge.m compiles as C — it contains no Objective-C. Copy or symlink it to a
7
+ * .c name, or build with `clang -x c`.)
8
+ *
9
+ * WHAT THIS DOES AND DOES NOT PROVE.
10
+ *
11
+ * It does NOT replace the safety argument. Async-signal-safety is a property of which operations are
12
+ * permitted in a handler, and no amount of passing runs establishes it — the previous design passed
13
+ * every casual test and was still wrong.
14
+ *
15
+ * What it DOES catch is implementation error: an off-by-one, a missing terminator, a truncation bug,
16
+ * or a publication that is not in fact atomic on this filesystem. It runs a publisher thread
17
+ * alternating two known ids as fast as it can, while a reader thread performs exactly the read the
18
+ * signal handler performs. The only acceptable observations are complete known ids.
19
+ *
20
+ * A single torn or truncated observation fails the run.
21
+ */
22
+
23
+ #include <pthread.h>
24
+ #include <stdio.h>
25
+ #include <string.h>
26
+ #include <fcntl.h>
27
+ #include <unistd.h>
28
+ #include <stdlib.h>
29
+
30
+ #include "ScaleBunCrashSignalBridge.h"
31
+
32
+ #define ITERATIONS 200000
33
+ #define SESSION_MAX 128
34
+
35
+ static const char *MARKER = "/tmp/scalebun_stress_session";
36
+ static const char *TMPP = "/tmp/scalebun_stress_session.tmp";
37
+
38
+ static const char *ID_A = "sess-AAAAAAAAAAAAAAAA";
39
+ static const char *ID_B = "sess-BBBBBBBBBBBBBBBB";
40
+
41
+ static volatile int running = 1;
42
+ static volatile long torn = 0;
43
+ static volatile long reads = 0;
44
+
45
+ /* Byte-for-byte what scalebun_write_signal_crash does to read the id. */
46
+ static int read_marker(char *out, size_t cap) {
47
+ int fd = open(MARKER, O_RDONLY);
48
+ if (fd < 0) return 0;
49
+ ssize_t n = read(fd, out, cap);
50
+ close(fd);
51
+ return n > 0 ? (int)n : 0;
52
+ }
53
+
54
+ static void *publisher(void *arg) {
55
+ (void)arg;
56
+ for (long i = 0; i < ITERATIONS && running; i++) {
57
+ ScaleBunCrashSignalBridgeSetSessionId((i & 1) ? ID_A : ID_B);
58
+ }
59
+ running = 0;
60
+ return NULL;
61
+ }
62
+
63
+ static void *reader(void *arg) {
64
+ (void)arg;
65
+ char buf[SESSION_MAX];
66
+ while (running) {
67
+ int n = read_marker(buf, sizeof(buf));
68
+ if (n == 0) continue; /* marker briefly absent is fine — never a torn value */
69
+ reads++;
70
+ int okA = (n == (int)strlen(ID_A)) && memcmp(buf, ID_A, (size_t)n) == 0;
71
+ int okB = (n == (int)strlen(ID_B)) && memcmp(buf, ID_B, (size_t)n) == 0;
72
+ if (!okA && !okB) {
73
+ torn++;
74
+ if (torn <= 5) {
75
+ buf[n < SESSION_MAX ? n : SESSION_MAX - 1] = '\0';
76
+ fprintf(stderr, "TORN OBSERVATION: \"%s\" (%d bytes)\n", buf, n);
77
+ }
78
+ }
79
+ }
80
+ return NULL;
81
+ }
82
+
83
+ int main(void) {
84
+ unlink(MARKER);
85
+ unlink(TMPP);
86
+ ScaleBunCrashSignalBridgeInstall("/tmp/scalebun_stress_crash.json", MARKER, TMPP);
87
+
88
+ /* Boundary cases first — these are deterministic and do not need the race. */
89
+ char buf[SESSION_MAX];
90
+
91
+ char maxId[SESSION_MAX + 40];
92
+ memset(maxId, 'a', sizeof(maxId) - 1);
93
+ maxId[sizeof(maxId) - 1] = '\0';
94
+ memcpy(maxId, "sess-", 5);
95
+ ScaleBunCrashSignalBridgeSetSessionId(maxId);
96
+ int n = read_marker(buf, sizeof(buf));
97
+ if (n != SESSION_MAX) {
98
+ fprintf(stderr, "FAIL: over-long id stored %d bytes, expected %d\n", n, SESSION_MAX);
99
+ return 1;
100
+ }
101
+
102
+ ScaleBunCrashSignalBridgeSetSessionId("sess-\"drop\\these/chars");
103
+ n = read_marker(buf, sizeof(buf));
104
+ for (int i = 0; i < n; i++) {
105
+ char c = buf[i];
106
+ int ok = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
107
+ (c >= '0' && c <= '9') || c == '-' || c == '_' || c == '.' || c == ':';
108
+ if (!ok) {
109
+ fprintf(stderr, "FAIL: unsanitised byte 0x%02x survived publication\n", (unsigned char)c);
110
+ return 1;
111
+ }
112
+ }
113
+
114
+ ScaleBunCrashSignalBridgeSetSessionId(NULL);
115
+ if (read_marker(buf, sizeof(buf)) != 0) {
116
+ fprintf(stderr, "FAIL: NULL did not clear the marker\n");
117
+ return 1;
118
+ }
119
+
120
+ /* Now the race. */
121
+ pthread_t p, r;
122
+ pthread_create(&p, NULL, publisher, NULL);
123
+ pthread_create(&r, NULL, reader, NULL);
124
+ pthread_join(p, NULL);
125
+ pthread_join(r, NULL);
126
+
127
+ printf("boundary cases: PASS\n");
128
+ printf("reads observed : %ld\n", reads);
129
+ printf("torn : %ld\n", torn);
130
+ if (reads < 1000) {
131
+ fprintf(stderr, "FAIL: too few reads (%ld) for the result to mean anything\n", reads);
132
+ return 1;
133
+ }
134
+ if (torn != 0) return 1;
135
+ printf("RESULT: PASS — every observation was a complete known id\n");
136
+ return 0;
137
+ }
@@ -25,10 +25,85 @@ import Foundation
25
25
  return UnsafePointer(buf)
26
26
  }()
27
27
 
28
+ /**
29
+ * Session marker paths, in the SAME directory as the crash file.
30
+ *
31
+ * Same directory is a correctness requirement, not tidiness: `rename(2)` is only atomic within
32
+ * one filesystem, and a cross-device rename fails outright — which would leave the marker
33
+ * holding a stale session while the app believed it had published a new one.
34
+ */
35
+ private static let sessionMarkerName = "scalebun_active_session"
36
+ private static let sessionTmpName = "scalebun_active_session.tmp"
37
+
38
+ private static func cString(_ path: String) -> UnsafePointer<CChar> {
39
+ let buf = UnsafeMutablePointer<CChar>.allocate(capacity: path.utf8.count + 1)
40
+ path.withCString { _ = strcpy(buf, $0) }
41
+ return UnsafePointer(buf)
42
+ }
43
+
44
+ /// Pre-computed C strings — allocated once at startup so the signal path never allocates.
45
+ static let sessionMarkerPathCString: UnsafePointer<CChar> = {
46
+ let dir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first ?? ""
47
+ return cString((dir as NSString).appendingPathComponent(sessionMarkerName))
48
+ }()
49
+
50
+ static let sessionTmpPathCString: UnsafePointer<CChar> = {
51
+ let dir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first ?? ""
52
+ return cString((dir as NSString).appendingPathComponent(sessionTmpName))
53
+ }()
54
+
28
55
  @objc static func write(_ jsonString: String) {
29
56
  try? jsonString.write(toFile: crashFilePath, atomically: true, encoding: .utf8)
30
57
  }
31
58
 
59
+ /**
60
+ * The session that is live RIGHT NOW.
61
+ *
62
+ * WHY IT IS STORED AHEAD OF THE CRASH. A crash record outlives the process; the JS session id
63
+ * did not, because it only ever existed in JS memory. So the next launch had nothing to
64
+ * attribute a recovered crash to except whichever session had just been created — the crash
65
+ * from session A landed on session B.
66
+ *
67
+ * `UserDefaults`, not a file, on purpose: reads are served from an in-memory cache once the
68
+ * domain is loaded, so the NSException handler does no filesystem work on the crash path.
69
+ *
70
+ * ⚠️ THIS IS **NOT** ASYNC-SIGNAL-SAFE, and is deliberately not used from the signal handler.
71
+ * `UserDefaults` takes locks and may allocate; calling it from a signal handler risks a
72
+ * deadlock inside an already-dying process. The signal path keeps its existing minimal,
73
+ * syscall-only record and therefore stays unattributed — see the note in the handler.
74
+ */
75
+ private static let activeSessionKey = "scalebun.activeSessionId"
76
+
77
+ @objc static func setActiveSessionId(_ sessionId: String?) {
78
+ if let id = sessionId, !id.isEmpty {
79
+ UserDefaults.standard.set(id, forKey: activeSessionKey)
80
+ } else {
81
+ UserDefaults.standard.removeObject(forKey: activeSessionKey)
82
+ }
83
+
84
+ /*
85
+ * ALSO publish into the signal handler's static buffer.
86
+ *
87
+ * The NSException path can read UserDefaults; the SIGNAL path cannot — UserDefaults takes
88
+ * locks and may allocate, and a lock held by the thread we just interrupted would deadlock a
89
+ * dying process. So the id is pushed into preallocated C storage here, in normal code, and
90
+ * the handler only ever reads it.
91
+ *
92
+ * Both sinks are written from this one place so the two iOS crash paths can never disagree
93
+ * about which session is live.
94
+ */
95
+ if let id = sessionId, !id.isEmpty {
96
+ id.withCString { ScaleBunCrashSignalBridgeSetSessionId($0) }
97
+ } else {
98
+ ScaleBunCrashSignalBridgeSetSessionId(nil)
99
+ }
100
+ }
101
+
102
+ @objc static func activeSessionId() -> String? {
103
+ let id = UserDefaults.standard.string(forKey: activeSessionKey)
104
+ return (id?.isEmpty ?? true) ? nil : id
105
+ }
106
+
32
107
  @objc static func read() -> [String: Any]? {
33
108
  guard let data = try? Data(contentsOf: URL(fileURLWithPath: crashFilePath)),
34
109
  let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any]
@@ -3,10 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.EventTracker = void 0;
6
+ exports.K_INSTALLATION_ID = exports.EventTracker = void 0;
7
7
  var _StorageBackend = require("../storage/StorageBackend");
8
8
  var _deviceId = require("../core/id/deviceId");
9
9
  var _internalLogger = require("../core/logger/internalLogger");
10
+ var _nativeCrashBridge = require("../features/crash/nativeCrashBridge");
10
11
  var _hmacSha = require("../crypto/hmacSha256");
11
12
  var _batching = require("./batching");
12
13
  var _automaticEvents = require("./automaticEvents");
@@ -33,7 +34,15 @@ var _automaticEvents = require("./automaticEvents");
33
34
  // Phase 5.4: signing-scheme version. The backend tamper-checks signed batches and
34
35
  // treats an unsigned/invalid batch from a signing-capable SDK as a fraud signal.
35
36
  const SDK_SIGNING_VERSION = '1';
36
- const K_INSTALLATION_ID = 'scalebun_installation_id';
37
+
38
+ /**
39
+ * Exported because this is THE canonical per-install identity key for the whole
40
+ * SDK. The OTA lane used to demand a caller-supplied installationId instead of
41
+ * reading this one, which put OTA telemetry in its own id namespace — every
42
+ * join from OTA to CDP (blast radius, MRR-at-risk, churn) matched by luck.
43
+ * One install, one id, every lane.
44
+ */
45
+ const K_INSTALLATION_ID = exports.K_INSTALLATION_ID = 'scalebun_installation_id';
37
46
  const K_ANONYMOUS_ID = 'scalebun_anonymous_id';
38
47
  const K_FIRST_OPEN = 'scalebun_first_open_done';
39
48
  /** Last app version seen on this device — the baseline app_update compares against. */
@@ -73,6 +82,9 @@ class EventTracker {
73
82
  this.installationId = this.loadOrCreate(K_INSTALLATION_ID);
74
83
  this.anonymousId = this.loadOrCreate(K_ANONYMOUS_ID);
75
84
  this.sessionId = `sess-${uuid()}`;
85
+ // Published immediately, before anything else runs — a crash can happen on the very next
86
+ // line, and native must already know which session owns it.
87
+ this.publishSessionToNative();
76
88
  this.loadQueue();
77
89
  this.loadClickId();
78
90
  }
@@ -143,9 +155,25 @@ class EventTracker {
143
155
  /** Start a fresh session (e.g. after the app returns from a long background). */
144
156
  newSession() {
145
157
  this.sessionId = `sess-${uuid()}`;
158
+ this.publishSessionToNative();
146
159
  this.track('session_start');
147
160
  }
148
161
 
162
+ /**
163
+ * Hand the live session id to the native crash layer.
164
+ *
165
+ * Called at EVERY point the id changes — construction and rollover — because a crash-safe copy
166
+ * that is one session stale is worse than none: it would confidently attribute a crash to a
167
+ * session that had already ended.
168
+ *
169
+ * Fire-and-forget. Native persists it synchronously on its own side; a failure here degrades a
170
+ * recovered crash to unattributed, which is exactly the behaviour before this existed, and must
171
+ * never be able to fail a session start.
172
+ */
173
+ publishSessionToNative() {
174
+ void (0, _nativeCrashBridge.setNativeActiveSession)(this.sessionId);
175
+ }
176
+
149
177
  // ─── identity ────────────────────────────────────────────────────────────
150
178
 
151
179
  identify(userId, traits) {
@@ -1 +1 @@
1
- {"version":3,"names":["_StorageBackend","require","_deviceId","_internalLogger","_hmacSha","_batching","_automaticEvents","SDK_SIGNING_VERSION","K_INSTALLATION_ID","K_ANONYMOUS_ID","K_FIRST_OPEN","K_APP_VERSION","K_QUEUE","K_CLICK_ID","DEFAULT_FLUSH_MS","DEFAULT_BATCH","MAX_QUEUE","MAX_BACKOFF_MS","uuid","replace","c","r","Math","random","v","toString","EventTracker","identifiers","stamps","queue","timer","flushing","failureCount","started","automaticEventsUnsubscribe","constructor","config","storage","createStorageBackend","cfg","platform","flushIntervalMs","batchSize","autoLifecycleEvents","automaticEventTracking","installationId","loadOrCreate","anonymousId","sessionId","loadQueue","loadClickId","getInstallationId","start","subscribeAutomaticEvents","event","track","name","properties","isFirstOpen","get","set","maybeAppUpdate","scheduleFlush","current","appVersion","previous","previous_version","current_version","newSession","identify","userId","traits","clearIdentity","undefined","setIdentifiers","ids","stamp","key","value","setAttributionClickId","clickId","click_id","eventName","enqueue","buildEnvelope","onEvent","err","logger","warn","message","trackPurchase","input","revenue","currency","transactionId","rest","env","transaction_id","flush","length","effectiveBatch","clampBatchSize","batch","slice","payload","JSON","stringify","events","idempotencyKey","batchIdempotencyKey","map","e","event_id","res","fetch","apiBaseUrl","method","headers","clientKey","hmacSha256Hex","body","ok","splice","persistQueue","status","stop","clearTimeout","ctx","context","canonicalSessionId","sessionIdProvider","event_name","event_time","Date","now","app_id","appId","installation_id","anonymous_id","session_id","device_id","getDeviceId","sdk_version","user_id","app_version","osVersion","os_version","country","Object","keys","push","catch","base","backlogRemaining","MAX_BATCH_EVENTS","delay","min","pow","setTimeout","existing","id","raw","parsed","parse","Array","isArray","cid","exports"],"sourceRoot":"../../../src","sources":["analytics/EventTracker.ts"],"mappings":";;;;;;AAoBA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AAzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA,MAAMM,mBAAmB,GAAG,GAAG;AAE/B,MAAMC,iBAAiB,GAAG,0BAA0B;AACpD,MAAMC,cAAc,GAAG,uBAAuB;AAC9C,MAAMC,YAAY,GAAG,0BAA0B;AAC/C;AACA,MAAMC,aAAa,GAAG,2BAA2B;AACjD,MAAMC,OAAO,GAAG,yBAAyB;AACzC,MAAMC,UAAU,GAAG,+BAA+B;AAElD,MAAMC,gBAAgB,GAAG,IAAI;AAC7B,MAAMC,aAAa,GAAG,EAAE;AACxB,MAAMC,SAAS,GAAG,IAAI;AACtB,MAAMC,cAAc,GAAG,MAAM;AAkE7B,SAASC,IAAIA,CAAA,EAAW;E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AI,CAACA,cAAc;MACnCE,WAAW,EAAE,IAAI,CAACA,WAAW;MAC7BC,SAAS,EAAE,IAAI,CAACA,SAAS;MACzBsB,MAAM,EAAE,IAAI,CAACA;IACjB,CAAC;EACL;AACJ;AAACiG,OAAA,CAAA7I,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["_StorageBackend","require","_deviceId","_internalLogger","_nativeCrashBridge","_hmacSha","_batching","_automaticEvents","SDK_SIGNING_VERSION","K_INSTALLATION_ID","exports","K_ANONYMOUS_ID","K_FIRST_OPEN","K_APP_VERSION","K_QUEUE","K_CLICK_ID","DEFAULT_FLUSH_MS","DEFAULT_BATCH","MAX_QUEUE","MAX_BACKOFF_MS","uuid","replace","c","r","Math","random","v","toString","EventTracker","identifiers","stamps","queue","timer","flushing","failureCount","started","automaticEventsUnsubscribe","constructor","config","storage","createStorageBackend","cfg","platform","flushIntervalMs","batchSize","autoLifecycleEvents","automaticEventTracking","installationId","loadOrCreate","anonymousId","sessionId","publishSessionToNative","loadQueue","loadClickId","getInstallationId","start","subscribeAutomaticEvents","event","track","name","properties","isFirstOpen","get","set","maybeAppUpdate","scheduleFlush","current","appVersion","previous","previous_version","current_version","newSession","setNativeActiveSession","identify","userId","traits","clearIdentity","undefined","setIdentifiers","ids","stamp","key","value","setAttributionClickId","clickId","click_id","eventName","enqueue","buildEnvelope","onEvent","err","logger","warn","message","trackPurchase","input","revenue","currency","transactionId","rest","env","transaction_id","flush","length","effectiveBatch","clampBatchSize","batch","slice","payload","JSON","stringify","events","idempotencyKey","batchIdempotencyKey","map","e","event_id","res","fetch","apiBaseUrl","method","headers","clientKey","hmacSha256Hex","body","ok","splice","persistQueue","status","stop","clearTimeout","ctx","context","canonicalSessionId","sessionIdProvider","event_name","event_time","Date","now","app_id","appId","installation_id","anonymous_id","session_id","device_id","getDeviceId","sdk_version","user_id","app_version","osVersion","os_version","country","Object","keys","push","catch","base","backlogRemaining","MAX_BATCH_EVENTS","delay","min","pow","setTimeout","existing","id","raw","parsed","parse","Array","isArray","cid"],"sourceRoot":"../../../src","sources":["analytics/EventTracker.ts"],"mappings":";;;;;;AAoBA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AA1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA,MAAMO,mBAAmB,GAAG,GAAG;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,0BAA0B;AAC3D,MAAME,cAAc,GAAG,uBAAuB;AAC9C,MAAMC,YAAY,GAAG,0BAA0B;AAC/C;AACA,MAAMC,aAAa,GAAG,2BAA2B;AACjD,MAAMC,OAAO,GAAG,yBAAyB;AACzC,MAAMC,UAAU,GAAG,+BAA+B;AAElD,MAAMC,gBAAgB,GAAG,IAAI;AAC7B,MAAMC,aAAa,GAAG,EAAE;AACxB,MAAMC,SAAS,GAAG,IAAI;AACtB,MAAMC,cAAc,GAAG,MAAM;AAkE7B,SAASC,IAAIA,CAAA,EAAW;EACpB,OAAO,sCAAsC,CAACC,OAAO,CAAC,OAAO,EAAGC,CAAC,IAAK;IAClE,MAAMC,CAAC,GAAIC,IAAI,CAACC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAI,CAAC;IAClC,MAAMC,CAAC,GAAGJ,CAAC,KAAK,GAAG,GAAGC,CAAC,GAAIA,CAAC,GAAG,GAAG,GAAI,GAAG;IACzC,OAAOG,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC;EACzB,CAAC,CAAC;AACN;AAEO,MAAMC,YAAY,CAAC;EAOd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B,MAAM,EAAE,IAAI,CAACA;IACjB,CAAC;EACL;AACJ;AAAChE,OAAA,CAAAkB,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.SDKBootstrapper = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  var _schema = require("../core/config/schema");
9
+ var _endpoints = require("../core/constants/endpoints");
9
10
  var _internalLogger = require("../core/logger/internalLogger");
10
11
  var _container = require("../core/di/container");
11
12
  var _httpClient = require("../transport/http/httpClient");
12
- var _endpoints = require("../transport/http/endpoints");
13
+ var _endpoints2 = require("../transport/http/endpoints");
13
14
  var _sdkSession = require("../transport/auth/sdkSession");
14
15
  var _deviceId = require("../core/id/deviceId");
15
16
  var _flushScheduler = require("../pipeline/scheduler/flushScheduler");
16
- var _dispatcher = require("../pipeline/dispatcher/dispatcher");
17
17
  var _appLifecycle = require("../core/lifecycle/appLifecycle");
18
18
  var _FeatureRegistry = require("./FeatureRegistry");
19
19
  var _NetworkFeature = require("../features/network/NetworkFeature");
@@ -77,6 +77,10 @@ class SDKBootstrapper {
77
77
  return null;
78
78
  }
79
79
  this.config = result.data;
80
+ // apiBaseUrl is LOCKED: whatever an integrator passed (or the schema default) is
81
+ // discarded here so the SDK can never be repointed away from the ScaleBun cloud.
82
+ // Change DEFAULT_API_BASE_URL at build time to target a different backend.
83
+ this.config.apiBaseUrl = _endpoints.DEFAULT_API_BASE_URL;
80
84
  // Explicit logLevel wins; otherwise debug:true implies verbose 'debug'.
81
85
  if (this.config.logLevel) {
82
86
  _internalLogger.logger.setLevelByName(this.config.logLevel);
@@ -102,17 +106,18 @@ class SDKBootstrapper {
102
106
  }
103
107
  }
104
108
  const httpClient = _container.coreContainer.register('HttpClient', new _httpClient.HttpClient(this.config.apiBaseUrl));
105
- const clientKey = this.config.clientKey;
106
- _container.coreContainer.register('Dispatcher', new _dispatcher.Dispatcher(async batch => {
107
- const headers = {};
108
- if (clientKey) {
109
- headers['x-scalebun-client-key'] = clientKey;
110
- }
111
- await httpClient.post(_endpoints.ENDPOINTS.EVENTS, {
112
- deviceId: (0, _deviceId.getDeviceId)(),
113
- events: batch
114
- }, headers);
115
- }));
109
+
110
+ // D1: a `Dispatcher` used to be registered here, draining `memoryQueue`
111
+ // to ENDPOINTS.EVENTS ('/sdk/events'). Removed on two grounds, both
112
+ // verified: nothing anywhere resolved 'Dispatcher' from the container
113
+ // (so its flush never ran and the queue was a black hole), and no
114
+ // backend controller has ever served '/sdk/events' — even a wired
115
+ // dispatcher would have 404'd forever. Every producer that wrote into
116
+ // that pipeline now rides a live lane instead (captureException
117
+ // CrashReporter, native-crash detail → report metadata, metrics →
118
+ // queuePerformanceMetric). A decoy pipeline is worse than none: it
119
+ // makes the real path look redundant.
120
+
116
121
  const scheduler = _container.coreContainer.register('FlushScheduler', new _flushScheduler.FlushScheduler(flushFn));
117
122
 
118
123
  // ── Backend handshake ──────────────────────────────────
@@ -121,7 +126,7 @@ class SDKBootstrapper {
121
126
  _internalLogger.logger.info('[Bootstrap] SaaS mode: clientKey auth active, skipping legacy handshake');
122
127
  } else {
123
128
  _internalLogger.logger.debug('Starting handshake...');
124
- const response = await httpClient.post(_endpoints.ENDPOINTS.SESSIONS, {
129
+ const response = await httpClient.post(_endpoints2.ENDPOINTS.SESSIONS, {
125
130
  projectId: this.config.projectId,
126
131
  publishableKey: this.config.publishableKey,
127
132
  deviceId: (0, _deviceId.getDeviceId)(),