mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: resolve analytics data gaps and resize validation failures
- Fix resize 20% failure rate: add Zod refine requiring at least one dimension, enforce integer/max constraints, clamp percentage scaling to minimum 1px, and guard against missing metadata in withoutEnlargement - Fix PostHog init race condition: move consent check before async import so frontend events (search, pageview) are no longer silently dropped - Fix identify() passing nested $set/$set_once wrappers instead of flat properties, so version person property now appears on PostHog profiles - Add error_code and error_message to failed tool_used analytics events for debugging tool failures from PostHog
This commit is contained in:
@@ -319,7 +319,7 @@ describe("analytics lib", () => {
|
||||
setAnalyticsConsent(true);
|
||||
await initAnalytics(enabledConfig);
|
||||
identify("inst-1", { version: "1.0" });
|
||||
expect(mockIdentify).toHaveBeenCalledWith("inst-1", { version: "1.0" });
|
||||
expect(mockIdentify).toHaveBeenCalledWith("inst-1", { version: "1.0" }, undefined);
|
||||
});
|
||||
|
||||
it("does not throw before initialization", () => {
|
||||
@@ -382,7 +382,7 @@ describe("analytics lib", () => {
|
||||
track("phase1_event");
|
||||
expect(mockCapture).toHaveBeenCalledWith("phase1_event", undefined);
|
||||
identify("inst-1", { phase: 1 });
|
||||
expect(mockIdentify).toHaveBeenCalledWith("inst-1", { phase: 1 });
|
||||
expect(mockIdentify).toHaveBeenCalledWith("inst-1", { phase: 1 }, undefined);
|
||||
|
||||
// Phase 2: Revoke consent mid-session
|
||||
setAnalyticsConsent(false);
|
||||
|
||||
Reference in New Issue
Block a user