Pass gift through the page hit pipeline#742
Conversation
|
Warning Review limit reached
More reviews will be available in 51 minutes and 54 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughThe page-hit request, raw, and processed payload schemas now include an optional nullable Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
c4b255c to
9b85789
Compare
9b85789 to
a1e6503
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1e6503b9d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ref https://linear.app/ghost/issue/BER-3746/integrate-gift-link-usage-tracking-with-analytics Ghost is moving gift-link usage tracking onto the existing web-analytics pipeline. Gift reads now carry a `gift` field (the gift-link token) on the page_hit payload so the data can segment gift traffic and count per-link usage. The proxy rebuilds the payload field-by-field, so an un-threaded field is silently dropped before it reaches Tinybird. This threads `gift` (optional, nullable) through the raw schema, the raw-payload transform, the processed schema, and the request schema/defaults — covering both the inline and batch worker paths. Absent on non-gift hits, where it defaults to null.
a1e6503 to
95c51f3
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95c51f3892
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ref https://linear.app/ghost/issue/BER-3746/integrate-gift-link-usage-tracking-with-analytics
Ghost's Gift Links feature is moving usage tracking off a bespoke DB counter and onto the existing web-analytics pipeline, so gift numbers are measured the same way as every other page view. Gift reads carry one new dimension —
gift(the gift-link token) — on thepage_hitpayload, so the data can:Why this PR is needed
The proxy rebuilds the payload field-by-field (
pageHitRawPayloadFromRequest→transformPageHitRawToProcessed), so any field not explicitly threaded is silently dropped before it reaches Tinybird. This wiresgiftthrough end-to-end:schemas/v1/page-hit-raw.ts—giftonPayloadSchema(optional, nullable).transformations/page-hit-transformations.ts— copied inpageHitRawPayloadFromRequest(), defaulting tonull.schemas/v1/page-hit-processed.ts— onPageHitProcessedSchemaand the payload rebuilt intransformPageHitRawToProcessed().schemas/v1/page-hit-request.ts— declared explicitly (validation already admits it viaadditionalProperties: true) + anulldefault.Covers both the inline and batch worker paths, since both run through these transforms. Absent on non-gift hits, where it defaults to
null.Notes for review
giftis the gift-link token, a bearer credential — but first-party data the site owner already minted and shareable by design, so storing it in their own analytics is acceptable. Worth a thought on error-log / retention.ghost_head) and the Tinybird data-files (_mv_hitscolumn, segment, per-link endpoint) are separate PRs on the Ghost repo. This PR is a safe no-op until those land.Tests
tscclean.page-hit-transformations.test.ts: the "all fields present" case now assertsgiftpassthrough, plus a new case for the absent →nulldefault. (The 2 pre-existingSaltStoreFactoryfailures are unrelated Firestore/GCP-env tests.)