Repository navigation
Pass 1: W3, W10 (C7), W11 (C8), W12, W14, W15 - #5
Merged
Merged
Conversation
Per-event warnings (validation drops in track/identify/alias/group/trackPurchase and the max-flush-attempts drop) printed on every event and ignored debug. Log the first of each kind once per instance, repeats only with debug: true. onDrop/onError unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uses externalIds - One process-level beforeExit listener for all live clients (was one per instance); each client is still flushed once on exit; listener removed when the last client closes. - Key-prefix warning also accepts sk_ (server key). - examples/stripe-webhook.js: Stripe customer id goes in externalIds.stripe, not userId. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… context and version Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… for 1.1.0-1.2.1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
page() put the page name into properties.url when no url was passed, so a name like "Pricing" was recorded as the page URL. name now goes only in properties.name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
trackPurchase() options take externalIds (same shape and handling as track()) and send it on the envelope the same way, only when passed. The Stripe example passes the Stripe customer id this way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…inks provider ids only from the provider's own connection) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Reviews: A APPROVE (code; shared exit listener behaves as before in every traced case). B OK (server side: C8 externalIds on purchase is accepted and changes no revenue, dedup or postback; C7 changes only cosmetic page fields; Node |
…SDK (comments and changelog only) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Source resolutions: - src/index.ts TrackOptions.externalIds JSDoc: this PR's rewrite. - src/index.ts fields: main's retry/inFlight/drop-count fields kept; this PR's warnedKinds, exitFlushed and shared liveClients/exitListener kept; flushAttempts (gone in main) and exitHook (gone here) dropped. - src/index.ts registerExitHook: this PR's shared beforeExit listener, calling main's startDrain() instead of flush(), as main's per-client hook did. - src/index.ts _flush failure path: main's handleFailure; this PR's once-only "failed flush attempts" warning dropped in favour of main's per-cycle drop summary. - tests/test.ts W3: the 10-cycle drop no longer exists; now two final-400 drops in one flush must give one summary line. W14 network-recovery test waits out the first backoff before re-flushing. - CHANGELOG: one Unreleased; this PR's entries under main's Changed/Added, the warning entry no longer mentions failed-attempt drops. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Based on
main, not on #3 (FX-047), which edits the same file. Expect a small rebase conflict insrc/index.ts/tests/test.tsfor whichever merges second.W3: drop warnings log once per client
console.warns ignoreddebugand printed on every dropped event. Each kind (invalidtrack()name,identify()/alias()without id,group()without groupId,trackPurchase()without a finite value, drop after max flush attempts) now logs once per client, then only withdebug: true.onDrop/onErrorstill fire for every event.src/index.tsnewwarnOnce(); call sites intrack,identify,alias,group,trackPurchase,_flush(max attempts).tests/test.ts"W3" block: 2 events dropped after 10 failed cycles give 1 warning and 2onDropcalls; 11 invalid calls of 5 kinds give 5 warnings and 11onDropcalls; withdebug: trueevery repeat is logged.W12: shared exit listener,
sk_keys, Stripe examplebeforeExitlistener for all live clients (was one per instance, so 11+ clients triggeredMaxListenersExceededWarning). Each client is still flushed once on exit (same as the oldprocess.once), and the listener is removed when the last client closes. Uses aSet, notWeakRef: an unclosed client is already held by its flush timer, so a weak reference would not free anything, and it avoids atsconfiglib change.src/index.tsregisterExitHook/flushAllOnExit/unregisterExitHook.Test: "W12a" block: 20 clients add at most 1 listener; closing them removes it;
beforeExitflushes every live client's queue.sk_as well asdk_. Test: "W12b" block.examples/stripe-webhook.js: the Stripe customer id goes inexternalIds: { stripe }instead of being used asuserId;identify()runs only when the app's own user id is known. ThetrackPurchase()part of the example is in the C8 commit, because it needs C8.W14: tests
tests/test.ts"W14" blocks:page()with a url,group()success,externalIdsontrack()(present when passed, absent otherwise), a fetch that throws (reachesonError, re-queued, sent on recovery), a hung request aborted attimeout, the exactcontextshape, andcontext.version/User-Agentequal topackage.jsonversion.W15: CHANGELOG
Added 1.0.1–1.0.4 (from the registry; no source history exists for them, so the entries say so), 1.2.2 and 1.2.3 (from
git log v1.2.1..v1.2.3), all marked "(entry added later)". Dates of 1.2.1, 1.2.0 (2026-01-01) and 1.1.0 (2025-09-04) set to the registry dates. New behaviour is listed under "Unreleased".W10 / C7:
page()stops copyingnameintoproperties.urlpage()setproperties.url = name, recording a page name as its URL.namenow goes only inproperties.name.src/index.tspage().page('u', 'Checkout')sends nourlkey).W11 / C8:
trackPurchase()acceptsexternalIdsopts.externalIds(same type astrack()'s) is passed totrack(), so it is sent the same way, only when passed.src/index.tstrackPurchase()options type and call.Changes to what the SDK sends
3aac161SEND CHANGE C7:page()no longer sendsproperties.url= page name when no url is passed.f60a168SEND CHANGE C8:trackPurchase()sendsexternalIdswhen the caller passes it.Each is its own commit and can be reverted alone (C8 also carries the example's
trackPurchase()line).Not done
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.