Skip to content

feat: error tracking source maps#475

Merged
ablaszkiewicz merged 12 commits into
mainfrom
feat/error-tracking-source-maps
Jun 3, 2026
Merged

feat: error tracking source maps#475
ablaszkiewicz merged 12 commits into
mainfrom
feat/error-tracking-source-maps

Conversation

@ablaszkiewicz
Copy link
Copy Markdown
Contributor

@ablaszkiewicz ablaszkiewicz commented May 25, 2026

Context mill PR - PostHog/context-mill#162
Workbench PR - PostHog/wizard-workbench#1685

What it does

It adds pretty good wizard which works for all supported js-like technologies. It one shots the implementation which ends with a fully working demo.

What it doesn't do

  • we are unable to give oauth permissions with personal_api_key:write permissions. User has to manually create the key and paste it.
  • we are unable to run build command from within wizard. It conflicts with some rust (our ET CLI is rust) stuff and basically sandbox environment blocks us. We have to tell user to run build.
  • it doesn't add support for react-native, flutter, ios and android platforms. This is planned!

Full demo

CleanShot.2026-06-02.at.10.42.33.mp4

Added that outro screen later:
image

Flow

  • does the oauth flow,
  • creates a todo list
image
  • asks for the key and stores it in a secret storage so it doesn't leak to LLM conversation
image
  • does all the magic including writing to the .env from the secret storage
  • asks user if he wants to test it locally
image
  • if yes, it adds minimal example and explains to user how to run it
image

Positive cases

Node raw

This is a raw version of node without any framework and without any sort of API inside the file. It is just a raw single index.ts script. Wizard correctly sets up raw CLI upload, appends to env. Enriches default build command with CLI specific stuff:

    "build": "tsc && posthog-cli --env-file .env sourcemap inject --directory ./dist && posthog-cli --env-file .env sourcemap upload --directory ./dist --release-name node-raw",
image

Node rollup

This ones tricky. I've intentionally left a setup where no dotenv is installed and rollup config is unable to access the env file. Workflow correctly recognizes all of that, install dotenv, sets everything up, life is great.

image

Node rollup with typescript plugin

This ones also tricky. We had to adjust the docs because this one requires changes to the tsconfig.json

image

Nuxt 3.6-

This ones simple.

image

Nuxt 3.7+

This ones pretty simple and straight forward. No tricks.

image

React vite

Veeeery simple one

image

Deny cases

No posthog installed ✅

next-no-posthog- doesn't have posthog installed.

image

Unsupported technology ✅

rust - unsupported technology

image

@github-actions
Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci misc
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci misc/quack-quack
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

@ablaszkiewicz ablaszkiewicz force-pushed the feat/error-tracking-source-maps branch from ef61eb1 to bd3a030 Compare June 1, 2026 14:53
@ablaszkiewicz ablaszkiewicz requested review from a team, cat-ph and hpouillot June 2, 2026 08:37
@ablaszkiewicz ablaszkiewicz marked this pull request as ready for review June 2, 2026 10:31
Copilot AI review requested due to automatic review settings June 2, 2026 10:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “upload source maps” wizard program for PostHog Error Tracking, including prerequisite detection + a dedicated intro screen, and introduces a session-scoped secret vault to keep sensitive values (e.g. API keys) out of the LLM conversation while still allowing local tools (like .env writes) to use them.

Changes:

  • Register a new error-tracking-upload-source-maps program with detection → intro → auth → run → outro flow and a custom agent prompt.
  • Add a Source Maps intro TUI screen and wire it into the screen registry/sequence.
  • Add a SecretVault and extend wizard_ask + set_env_values to support vaulted secret references.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tsdown.config.ts Allows build-time NODE_ENV to be set from the environment (defaulting to production).
src/ui/tui/screens/SourceMapsIntroScreen.tsx New intro screen rendering source-map detection results or a structured detection error.
src/ui/tui/screen-sequences.ts Adds SourceMapsIntro screen ID to the shared screen taxonomy.
src/ui/tui/screen-registry.tsx Registers the new SourceMapsIntroScreen in the screen map.
src/lib/wizard-tools.ts Adds secret-vault support; updates wizard_ask and set_env_values to handle sensitive values via secret refs.
src/lib/wizard-session.ts Extends AskQuestion with sensitive?: boolean for secret handling.
src/lib/secret-vault.ts Implements a session-scoped in-memory vault for secrets referenced as secret:<uuid>.
src/lib/programs/program-registry.ts Registers the new source-maps program in the central program registry.
src/lib/programs/error-tracking-upload-source-maps/steps.ts Defines the step list for the new program (detect → intro → auth → run → outro → skills).
src/lib/programs/error-tracking-upload-source-maps/index.ts Defines program config, run behavior, agent prompt, and outro summary data.
src/lib/programs/error-tracking-upload-source-maps/detect.ts Implements prerequisite detection and variant selection for the source-maps flow.
src/lib/programs/error-tracking-upload-source-maps/content/index.tsx Reuses the generic agent-skill learn-deck content for this program.
src/lib/tests/secret-vault.test.ts Adds unit tests for the new secret vault behavior and helpers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ui/tui/screens/SourceMapsIntroScreen.tsx
Comment thread src/lib/programs/error-tracking-upload-source-maps/detect.ts
Comment thread src/lib/programs/error-tracking-upload-source-maps/detect.ts
Copy link
Copy Markdown
Collaborator

@gewenyu99 gewenyu99 left a comment

Choose a reason for hiding this comment

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

This is great. I have a few comments that needs addressing, but the flow works really well

I would also consider creating your own slide show to display as this runs. Educate them about what this will do, why its' important, that they should set up CI to do source map uploads for every build, etc etc;.

Comment thread src/ui/tui/screens/SourceMapsIntroScreen.tsx Outdated
Comment thread src/lib/programs/error-tracking-upload-source-maps/index.ts Outdated
Comment thread src/lib/programs/error-tracking-upload-source-maps/steps.ts
Comment thread src/lib/programs/error-tracking-upload-source-maps/index.ts Outdated
Comment thread src/lib/programs/error-tracking-upload-source-maps/index.ts Outdated
Comment thread src/lib/secret-vault.ts
Comment thread src/ui/tui/screens/SourceMapsIntroScreen.tsx
Comment thread src/lib/programs/error-tracking-upload-source-maps/index.ts Outdated
@ablaszkiewicz
Copy link
Copy Markdown
Contributor Author

ablaszkiewicz commented Jun 2, 2026

@gewenyu99 I agree on the slideshow. Will do it right now but I'll omit the CI part because actually that's my plan for the next version of our program. To add full CI support :)

@ablaszkiewicz ablaszkiewicz force-pushed the feat/error-tracking-source-maps branch from 23e2b9a to a059cb4 Compare June 2, 2026 21:00
Copy link
Copy Markdown
Collaborator

@gewenyu99 gewenyu99 left a comment

Choose a reason for hiding this comment

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

Nice. I'm happy to ship this. I think it's fine to release and tweak based on feedback.

Thanks for pushing through on this PR, I know it's tough. The code base will #soonTM be much nicer to work in 🤞

ablaszkiewicz and others added 12 commits June 3, 2026 14:34
Adds the upload-sourcemaps program: detects the project's platform/build
system, picks the matching context-mill skill variant, and runs an agent
that wires up source map upload to PostHog Error Tracking. Introduces a
session secret vault so the user's personal API key (collected via
wizard_ask) is stored as an opaque ref and never enters the LLM
conversation; set_env_values and wizard_ask gain sensitive-value handling.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ablaszkiewicz ablaszkiewicz force-pushed the feat/error-tracking-source-maps branch from 5afcad6 to 79c1200 Compare June 3, 2026 12:44
@ablaszkiewicz ablaszkiewicz merged commit c25b7b8 into main Jun 3, 2026
17 checks passed
@ablaszkiewicz ablaszkiewicz deleted the feat/error-tracking-source-maps branch June 3, 2026 12:52
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.

3 participants