Skip to content

Revert "feat: migrate analytics from Cloudflare Worker to SvelteKit hooks"#2819

Merged
TorstenDittmann merged 1 commit intomainfrom
revert-2809-feat/migrate-analytics-to-sveltekit
Mar 18, 2026
Merged

Revert "feat: migrate analytics from Cloudflare Worker to SvelteKit hooks"#2819
TorstenDittmann merged 1 commit intomainfrom
revert-2809-feat/migrate-analytics-to-sveltekit

Conversation

@TorstenDittmann
Copy link
Contributor

@TorstenDittmann TorstenDittmann commented Mar 18, 2026

Reverts #2809

Summary by CodeRabbit

Release Notes

  • Features Removed

    • Removed analytics tracking integration.
  • New Features

    • Added request and response logging service.
  • Configuration & Build Updates

    • Updated build scripts and prerendering settings across pages.
    • Refined environment variable configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 57fdd43b-d0aa-4d5b-9cff-d6556c256af5

📥 Commits

Reviewing files that changed from the base of the PR and between 0154be8 and a0d1232.

⛔ Files ignored due to path filters (1)
  • src/lib/generated/github-stars.json is excluded by !**/generated/**
📒 Files selected for processing (19)
  • .env.example
  • .github/workflows/tests.yml
  • .prettierignore
  • log-collector/.gitignore
  • log-collector/package.json
  • log-collector/src/index.ts
  • log-collector/tsconfig.json
  • log-collector/wrangler.json
  • package.json
  • src/hooks.server.ts
  • src/lib/server/profound-analytics.ts
  • src/routes/(init)/init/+page.server.ts
  • src/routes/(marketing)/+page.ts
  • src/routes/+layout.ts
  • src/routes/blog/[[page]]/+page.ts
  • src/routes/integrations/+page.ts
  • src/routes/llms-full.txt/+server.ts
  • src/routes/partners/catalog/+page.ts
  • src/routes/threads/+layout.ts

Walkthrough

This PR removes the server-side Profound Analytics SvelteKit integration and replaces it with a Cloudflare Workers edge handler. Environment variables for PROFOUND_API_URL and PROFOUND_API_KEY are removed from .env.example and CI workflows. A new log-collector directory is introduced with TypeScript configuration, Wrangler settings, and a worker implementation that forwards request/response logging to an external API. Prerender configurations are added or adjusted across multiple routes. The .prettierignore is updated to stop ignoring generated files. Minor package.json script modifications change the runtime for one task and add reinstall-after-cleanup behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-2809-feat/migrate-analytics-to-sveltekit
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@TorstenDittmann TorstenDittmann merged commit 03a0dd1 into main Mar 18, 2026
6 of 7 checks passed
@TorstenDittmann TorstenDittmann deleted the revert-2809-feat/migrate-analytics-to-sveltekit branch March 18, 2026 16:30
@greptile-apps
Copy link

greptile-apps bot commented Mar 18, 2026

Greptile Summary

This PR reverts #2809, moving Profound Analytics collection back from a SvelteKit server hook (profoundAnalytics) to the original Cloudflare Worker (log-collector/) approach. Because the global prerender = false that was added in #2809 is removed, individual routes that require dynamic rendering have been given their own explicit prerender = false declarations.

Key changes:

  • src/lib/server/profound-analytics.ts deleted and profoundAnalytics removed from the hook sequence in src/hooks.server.ts
  • log-collector/ Cloudflare Worker re-introduced with wrangler.json, package.json, tsconfig.json, and src/index.ts
  • Global export const prerender = false removed from src/routes/+layout.ts; per-route prerender = false added to init, blog, integrations, partners/catalog, and threads
  • src/routes/(marketing)/+page.ts added to make the homepage prerender explicit
  • PROFOUND_API_URL / PROFOUND_API_KEY removed from .env.example and CI workflows since credentials are now managed by Cloudflare Workers secrets
  • Minor housekeeping: fetch:stars reverted to node, src/lib/generated re-enabled for Prettier, and an unused request parameter was introduced in llms-full.txt/+server.ts

Confidence Score: 5/5

  • This PR is safe to merge; it is a clean revert with correct per-route prerender declarations and only a trivial unused-parameter nit.
  • The changes are a well-scoped revert. The Cloudflare Worker is identical in logic to the original, and the prerender settings across individual routes have been carefully re-added. The only issue found is an unused request parameter in llms-full.txt/+server.ts, which has no runtime impact.
  • src/routes/llms-full.txt/+server.ts has a trivial unused parameter; all other files are straightforward.

Important Files Changed

Filename Overview
log-collector/src/index.ts Restored Cloudflare Worker that proxies all requests and asynchronously ships log data to Profound Analytics via ctx.waitUntil. Logic is identical to the pre-#2809 implementation.
log-collector/wrangler.json Wrangler config re-added; PROFOUND_API_URL is correctly stored as a non-secret var while PROFOUND_API_KEY stays out of source control (set via wrangler secret put).
src/hooks.server.ts profoundAnalytics handler removed from the middleware sequence; the file is otherwise unchanged.
src/lib/server/profound-analytics.ts Deleted entirely as part of the revert; the LogBatcher class and profoundAnalytics Handle are no longer needed.
src/routes/+layout.ts Global prerender = false removed; individual routes now declare their own prerender settings where needed.
src/routes/llms-full.txt/+server.ts GET handler signature changed to destructure { request }, but the parameter is never used; should be removed.
src/routes/(init)/init/+page.server.ts Explicit prerender = false added to correctly opt this dynamic auth route out of prerendering now that the global setting is gone.
src/routes/blog/[[page]]/+page.ts Explicit prerender = false added to restore dynamic rendering for the paginated blog index.
src/routes/threads/+layout.ts New layout file added with prerender = false to keep the threads section dynamically rendered.
src/routes/(marketing)/+page.ts New file explicitly setting prerender = true for the marketing homepage — correct given the removal of the global layout setting.
package.json fetch:stars reverted to use node instead of bun; clean script now appends bun install for a one-shot clean-install workflow.
.prettierignore src/lib/generated exclusion removed; generated files will now be formatted by Prettier (visible in the reformatted github-stars.json).

Last reviewed commit: "Revert "feat: migrat..."

}

export const GET: RequestHandler = () => {
export const GET: RequestHandler = ({ request }) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unused request parameter

The { request } destructuring was added in this revert, but request is never referenced anywhere in the function body. Since this endpoint also has export const prerender = true (line 4), the handler is invoked with a mock request during build time anyway, making this even less useful. The parameter should be removed to avoid confusion.

Suggested change
export const GET: RequestHandler = ({ request }) => {
export const GET: RequestHandler = () => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant