crm: internal dashboard on Railway (PostHog traffic with AI-referral channel, bench and harness health, Dune) - #2540
Merged
Merged
Conversation
…eferral channel, bench and harness health, Dune credits); a fixed list of 11 HogQL queries per hourly refresh writes a snapshot the pages read, so the PostHog query budget stays under 1 % of the organisation's 2400/hour Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HJgbZCqjR4nvCfcJSzofbw
…t (the root typecheck pulled it into the Vercel build) with its own CI job; sessions are random, signed with a separate secret, listed on the volume and revoked on logout, login limited per client; snapshot cache, refresh mutex and PostHog budget on globalThis with mtime re-reads (instrumentation and routes are separate bundler layers); history append-only and tolerant of a torn line; bench health from index.json so expired chain RPC benches show instead of vanishing; exact AI/search 7 d uniques in the KPIs; page and referrer rows ranked on either week so losses survive the LIMIT Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HJgbZCqjR4nvCfcJSzofbw
… with a global cap and evicts idle keys; session writes serialised with unique temp files; one referrer rule for the SQL KPIs and the TS channel table (Google and Bing country hosts count as search on both sides); sitemap body parse guarded; Dune sub text keys on the recorded error Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HJgbZCqjR4nvCfcJSzofbw
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.
New
crm/app (own package, Next 16 standalone, Dockerfile), deployed as serviceocb-crmin the Railway projectDashboard OpenChainBenchwith a/datavolume: https://ocb-crm-production.up.railway.app (password in~/.ocb-secrets/crm.env).What it shows
PostHog rate limit
PostHog allows 2400 query requests per hour per organisation. The app never queries in the request path: a refresh runs a fixed list of 11 HogQL queries sequentially and writes a snapshot; the scheduler runs it every 60 min (11/hour, ~0.5 %); the Refresh button has a 10 min cooldown; a local rolling-hour budget (300) is a second guard; a 429 or an exhausted budget stops the batch and the untouched sections keep their previous values.
Every HogQL query was run against a real PostHog project (syntax and shapes verified; the OCB project is not wired yet, see below).
bun test(22 tests: channel and path classification, query scoping, budget, auth),tscclean,next buildclean, auth flow and redirects tested locally behind simulated proxy headers and on Railway.Not in this PR
The OCB PostHog project is not receiving data: production's bundle calls
posthog.init("[SENSITIVE]", …), i.e.NEXT_PUBLIC_POSTHOG_KEYon Vercel holds a redacted placeholder, and staging has no key at all. Until the real project token and a personal API key (query:read) are set, the traffic pages show "PostHog is not configured" and only data health is populated.🤖 Generated with Claude Code
https://claude.ai/code/session_01HJgbZCqjR4nvCfcJSzofbw