Repository navigation
fix: batch and retry telemetry, keep id properties, show sign-in errors - #12
Merged
Merged
Conversation
…ties Each capture and log line was its own request, aborted after 2 seconds with no retry, so bursts or a slow network silently dropped events (25% of requests in a SendLit test run). Queue them and send batches (PostHog /batch/, one OTLP request per batch) every second or 50 items, with a 10-second timeout and two retries on network errors, 429 and 5xx, and a bounded queue. The long-token mask also hid every UUID property such as team_id. Add contextPolicy.identifierKeys for allowlisted keys that hold opaque ids.
…in page post() threw a fixed 'Sign-in failed. Please try again.' for every non-2xx response, so product refusals (disposable email, signup caps) and Better Auth errors never reached the person. Use the response's message when it has one; showError already sets textContent, so it isn't parsed as HTML. Closes #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11.
@codelitdev/observability: batch and retry telemetry, keep identifier propertiesDropped events. Every capture and every log line was its own HTTP request, aborted after 2 seconds with no retry. From one test host a request took about 0.75 s on its own and over 2 s under a burst. In a SendLit run, 8 of 32 requests were dropped silently, including abuse-control events. Now:
/batch/(each event keeps its owntimestamp), and one OTLP request per batch of log records.shutdown()sends what's queued and waits for it, still bounded by the caller's timeout.The flush timer is
unref'd, so a CLI or test process isn't kept alive by pending telemetry. It still has to callshutdown()to send its last batch.Masked ids.
pickAllowlistedran every string value through the long-token mask, so any UUID property (team_id,organization_id) arrived as[redacted-token].ContextPolicynow has an optionalidentifierKeysset. Allowlisted keys on that list skip only the long-token mask; email and secret masking still apply. It's opt-in, so a key likesession_idis never exposed by accident.@codelitdev/oauth-server-kit: show the auth API's error on the sign-in pagepost()in the hosted sign-in page threw "Sign-in failed. Please try again." for every non-2xx response. Product refusals, such as SendLit's disposable-email and per-IP signup limits, and Better Auth errors never reached the person. The page now shows the response'smessageand falls back to the generic text when there is none.showErrorsetstextContent, so the message isn't parsed as HTML.Testing
transport.test.tscovers batching a burst (120 items → 50/50/20), the interval flush, retries on network errors and 5xx, giving up after retries, no retry on 400, the request timeout and the bounded queue.create.test.tscoversidentifierKeys(UUID kept, email in an id key still masked, non-id token still masked) and the default client posting one/batch/request with timestamps.fetch. A 403 with a message shows that message, and a 502 HTML page shows the generic text. The test fails on the old code.bun run verifypasses in a clean checkout: lint, preset check, typecheck, drift, all tests, build and packed-package checks.Changesets: patch for both packages; the fixed group releases them all together.