Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(devex): route interaction changes to feature reels (#112337)

Julian Bez79aedfe722df
diff --git a/.agents/skills/qa-frontend/SKILL.md b/.agents/skills/qa-frontend/SKILL.md
index b9c2b45fad0a..725aff4f99d6 100644
--- a/.agents/skills/qa-frontend/SKILL.md
+++ b/.agents/skills/qa-frontend/SKILL.md
@@ -4,14 +4,16 @@ description: >
Internal PostHog developer frontend/browser QA skill. Use only when a PostHog
developer explicitly asks to run frontend QA, browser-test a PR, verify a UI
flow against the local PostHog stack, use qa-frontend, or QA current frontend
- changes with browser/runtime evidence. Do not use for generic code review, PR
- review, "check my changes", CI debugging, or security audit; use qa-team,
+ changes with browser/runtime evidence, or to make a feature reel (see reel
+ mode below). Do not use for generic code review, PR review, "check my
+ changes", CI debugging, or security audit; use qa-team,
debugging-ci-failures, or security-audit instead. QA runs in PR mode or local
mode, plans adaptive browser and visual checks, drives browser MCP/tooling
such as Playwright MCP or Chrome DevTools MCP, captures evidence, and applies
only approved/narrow fixes. Reel mode makes a feature reel instead: a short,
- sharp animated WebP of a new UI flow from Storybook stills, for a PR
- description. Use it when asked for a reel, GIF, or animated demo of a flow.
+ sharp animated WebP of one UI flow for a PR description. Use it when asked
+ for a reel, GIF, or animated demo, or when writing-pr-descriptions calls for
+ a reel: a new action and its effect that one screenshot cannot show.
allowed-tools: Bash, Read, Edit, Write, Glob, Grep, Agent, mcp__playwright__*, mcp__chrome-devtools__*, mcp__phrocs__*
---
@@ -21,7 +23,7 @@ Run the code, not just the diff. This is a repo-local skill for PostHog develope
- **PR mode** - user references a specific PR (URL, number, or branch). The skill checks out the PR, runs QA, optionally uploads final evidence after approval, and posts a single PR comment after approval. Requires a clean working tree.
- **Local mode** - user asks to QA their current work with no PR reference. The skill QAs the current checkout against the repo's default branch (`origin/HEAD`) by default, or an explicit local base ref when the user provides one, plus staged, unstaged, and untracked changes. It writes a report locally and does **not** upload evidence or touch GitHub. A dirty working tree is fine in this mode.
-- **Reel mode** - user asks for a reel, GIF, or animated demo of a UI flow for a PR description. The skill skips the QA loop and follows `references/feature-reel.md`: Storybook stills become an animated WebP with a cursor and zoom. It needs Storybook, not the local stack.
+- **Reel mode** - user asks for a reel, GIF, or animated demo of a UI flow for a PR description, or "Screenshots and reels" in `/writing-pr-descriptions` calls for one. The skill skips the QA loop and follows `references/feature-reel.md`: stills from a Storybook story or a test workspace in the running app become an animated WebP with a cursor and zoom.
Use this skill only for explicit frontend/browser/runtime QA or a feature reel. If the prompt is a generic review, code-review, "check my changes", CI-debugging, or security-audit request, use the more specific repo skill instead.
@@ -73,7 +75,7 @@ Load these files only when the matching phase starts:
- `references/evidence-and-output.md` - evidence upload, verdict artifacts, and PR/local report rendering.
- `references/pr-comment-template.md` - final PR comment structure.
- `references/cleanup.md` - checkout, browser session, stack, and generated-file cleanup after the report is written.
-- `references/feature-reel.md` - reel mode: shot list, Storybook capture, render, and upload of a feature reel.
+- `references/feature-reel.md` - reel mode: when a reel earns its place, shot list, capture, render, and upload of a feature reel.
Skill scripts live next to this file (under `scripts/`). When Claude Code activates this skill, it emits a line at the top of the prompt:
diff --git a/.agents/skills/qa-frontend/references/feature-reel.md b/.agents/skills/qa-frontend/references/feature-reel.md
index 92c9b9d1d409..9730a4df9f7b 100644
--- a/.agents/skills/qa-frontend/references/feature-reel.md
+++ b/.agents/skills/qa-frontend/references/feature-reel.md
@@ -1,27 +1,38 @@
# Feature reel
A feature reel is a short animated WebP of one UI flow, for a PR description.
-Use it when one still cannot show the change, for example a menu that opens on right-click, or a flow across two screens.
-When one still can show the change, take the still instead (see "Screenshots" in `/writing-pr-descriptions`).
+It is for a new action and its effect, when a screenshot of the end state hides the action, for example a menu that opens on right-click.
+When the user asked for this reel, make it.
+Otherwise, read `references/screenshots-and-reels.md` in `/writing-pr-descriptions` first. It has the test and worked examples.
+When a screenshot can show the change, take the screenshot and stop here.
-The reel is made from Storybook stills, not from a screen recording.
+The reel is made from stills, not from a screen recording.
The camera zooms to the target of each step, a cursor glides there and clicks, and the next state fades in.
The motion is a pure function of the stills, so it is the same on every run, and the reel stays sharp on high-density screens.
The scripts need only the repo's Playwright and Pillow. Do not install ffmpeg or other packages for this mode.
Run every command below from the root of the PostHog checkout.
-## 1. Start Storybook
+## 1. Pick the source
+Use a Storybook story when one shows the start of the flow, or when a scratch story can.
Reuse a Storybook that runs. Otherwise, start one with `pnpm storybook` (port 6006).
Story ids are in `http://localhost:6006/index.json`.
On a cold dev server the first load of a story can take minutes, because Vite compiles each lazy chunk on its first request.
`reel-capture.mjs` waits up to five minutes for it.
+Use the running app when the local stack is up and the flow needs real routing or data that a story does not mock.
+Set `"testWorkspace": true` in the shot list.
+`reel-capture.mjs` then creates a new workspace with generated demo data through `/api/setup_test/organization_with_team/`, logs in to it, and puts its id where the `url` says `{team_id}`.
+This works only on a local dev stack, because that endpoint needs `DEBUG`.
+Never capture the developer's own workspace: its data can hold names that must not be public.
+
## 2. Write the shot list
-Start from a story that shows the first state of the flow, usually a story without a `play` function.
-When no story shows that state, write a scratch story and keep it out of the commit.
+Start in the state just before the new interaction, and make every step show something the PR changed.
+When the PR adds a right-click menu to session rows, start on the list. Do not click through the sidebar to get there.
+For Storybook, that is usually a story without a `play` function. When no story shows that state, write a scratch story and keep it out of the commit.
+For the running app, that is a `url` that opens the right screen.
Write each step of the flow as one entry in `steps`.
The `play` function of the story that shows the end state is often the best source: one `userEvent` or `fireEvent` call becomes one step.
@@ -48,7 +59,8 @@ The reel drives the steps itself, because a `play` function cannot be paused bet
| Field | Meaning |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `url` | The iframe URL of the story: `http://localhost:6006/iframe.html?id=<story-id>&viewMode=story` |
+| `url` | The iframe URL of the story: `http://localhost:6006/iframe.html?id=<story-id>&viewMode=story`. With `testWorkspace`, an app URL such as `http://localhost:8010/project/{team_id}/replay` |
+| `testWorkspace` | Optional. `true` creates a demo workspace on the local stack and logs in to it before the first load |
| `viewport` | Size in CSS pixels. The default is 1280×800 |
| `steps[].caption` | Text on screen while the cursor moves to the target |
| `steps[].action` | `click`, `rightclick` or `hover` |
@@ -58,7 +70,7 @@ The reel drives the steps itself, because a `play` function cannot be paused bet
| `steps[].focus` | Optional target that the last step shows, such as a menu. The camera frames it in the final shot. Earlier steps ignore it |
| `finalCaption` | Text on screen at the end |
-Keep a reel to two to four steps. Each step adds about 1.4 seconds.
+Keep a reel to one to four steps. Each step adds about 1.4 seconds.
Captions are user-facing copy, so `/writing-user-facing-copy` applies: sentence case, a few words, no em dashes.
## 3. Capture, render and encode
@@ -82,12 +94,15 @@ A two-step reel is about 3 MB and a three-step reel about 5 MB. The upload limit
## 4. Add it to the PR
-The upload gate in `references/safety-rules.md` applies: show the developer the reel and get approval before the upload.
-Storybook renders mock data, but a scratch story or a caption can still carry names that must not be public.
+Before the upload, read the first frame, one frame at each step, and the last frame.
+Look for names, emails, tokens, and internal text in the pixels and in the captions.
+
+- A reel from Storybook stills follows the screenshot rule in `/writing-pr-descriptions`: when the frames are clean, upload it without a separate approval. Storybook renders mock data, but a scratch story or a caption can still carry names that must not be public.
+- A reel from the running app follows the upload gate in `references/safety-rules.md`: show the developer the reel and get approval before the upload, also for a test workspace.
```bash
-# --yes only after the developer approves this exact file
+# --yes only after the check above, and for a running-app reel only after the developer approves this exact file
hogli pr:upload-image --yes --alt "<what the flow shows>" "$RUN_DIR/feature-reel.webp"
```
-Paste the markdown line that the command prints as the "after" of the change. For the "before", follow "Screenshots" in `/writing-pr-descriptions`.
+Paste the markdown line that the command prints as the "after" of the change. For the "before", follow `references/screenshots-and-reels.md` in `/writing-pr-descriptions`.
diff --git a/.agents/skills/qa-frontend/references/safety-rules.md b/.agents/skills/qa-frontend/references/safety-rules.md
index 9b3777af2dd6..268ffa5fb1ec 100644
--- a/.agents/skills/qa-frontend/references/safety-rules.md
+++ b/.agents/skills/qa-frontend/references/safety-rules.md
@@ -76,6 +76,8 @@ Evidence upload publishes local-stack screenshots, demo reels, and demo videos t
Get explicit approval for the upload set in the same gate as the PR comment. Show the user the list of files about to be uploaded and what each one shows. Do not upload first and ask later; the upload is the disclosure. The command's `--yes` flag exists as a speed bump for exactly this reason - passing it is a statement that the user approved this exact upload set.
+One exception: a feature reel made only from Storybook stills follows the screenshot rule in `/writing-pr-descriptions`, because Storybook renders mock data. `references/feature-reel.md` has the check to run before that upload. A reel from the running app keeps this gate.
+
## Autonomous Fix Bounds
Autonomous fixes may only modify files that were already changed in the PR. Downgrade to comment-only if a plausible fix needs a new file or a file outside the original PR diff.
diff --git a/.agents/skills/qa-frontend/scripts/reel-capture.mjs b/.agents/skills/qa-frontend/scripts/reel-capture.mjs
index 1325eb635695..5885bed41f22 100644
--- a/.agents/skills/qa-frontend/scripts/reel-capture.mjs
+++ b/.agents/skills/qa-frontend/scripts/reel-capture.mjs
@@ -1,5 +1,5 @@
// Captures the stills of a UI flow for reel-render.mjs.
-// Drives a Storybook story (or any page that needs no login) with real mouse input,
+// Drives a Storybook story, or a page of the local app in a new demo workspace, with real mouse input,
// takes a screenshot before each step and one at the end, and records where each step points.
//
// Usage: node reel-capture.mjs <shot-list.json> <out-dir>
@@ -29,6 +29,10 @@ const FIRST_LOAD_TIMEOUT_MS = 300_000
const STEP_TIMEOUT_MS = 20_000
const QUIET_MS = 1500
const SETTLE_MS = 600
+// Workspace setup generates demo data, which takes seconds on a healthy stack.
+const SETUP_TIMEOUT_MS = 120_000
+// setup_test creates users and a full-scope API key, so it must never reach another instance.
+const LOOPBACK_HOSTS = ['localhost', '127.0.0.1', '[::1]']
function locate(page, target) {
let scope = page.locator('body')
@@ -88,6 +92,49 @@ async function act(page, action, point) {
}
}
+// The run-posthog recipe: create a workspace with generated demo data, then log in from the page,
+// so Django's CSRF check sees the page's cookies. Works only on a local stack with DEBUG.
+async function logInToTestWorkspace(page, origin) {
+ await page.goto(`${origin}/login`, { timeout: FIRST_LOAD_TIMEOUT_MS })
+ const result = await page.evaluate(async (timeoutMs) => {
+ const post = (path, body) =>
+ fetch(path, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(body),
+ signal: AbortSignal.timeout(timeoutMs),
+ })
+ let setup
+ try {
+ // Current time keeps the demo data inside the default date ranges of scenes such as replay.
+ setup = await post('/api/setup_test/organization_with_team/', {
+ skip_onboarding: true,
+ use_current_time: true,
+ })
+ } catch (error) {
+ return { error: `setup_test failed: ${error.name}` }
+ }
+ if (!setup.ok) {
+ return { error: `setup_test returned ${setup.status}` }
+ }
+ const workspace = (await setup.json()).result
+ let login
+ try {
+ login = await post('/api/login/', { email: workspace.user_email, password: '12345678' })
+ } catch (error) {
+ return { error: `login failed: ${error.name}` }
+ }
+ if (!login.ok) {
+ return { error: `login returned ${login.status}` }
+ }
+ return { teamId: workspace.team_id }
+ }, SETUP_TIMEOUT_MS)
+ if (result.error) {
+ throw new Error(`Could not create the test workspace: ${result.error}. Is this a local stack with DEBUG?`)
+ }
+ return result.teamId
+}
+
async function main() {
const [shotListPath, outDir] = process.argv.slice(2)
if (!shotListPath || !outDir) {
@@ -101,13 +148,26 @@ async function main() {
throw new Error(`Unknown action "${step.action}". Use ${ACTIONS.join(', ')}.`)
}
}
+ if (shotList.testWorkspace) {
+ if (!LOOPBACK_HOSTS.includes(new URL(shotList.url).hostname)) {
+ throw new Error('testWorkspace needs a url on localhost, so setup never reaches another instance.')
+ }
+ if (!shotList.url.includes('{team_id}')) {
+ throw new Error('testWorkspace needs {team_id} in the url, so the reel opens the demo workspace.')
+ }
+ }
mkdirSync(outDir, { recursive: true })
const browser = await chromium.launch()
const context = await browser.newContext({ viewport, deviceScaleFactor: CAPTURE_SCALE, reducedMotion: 'reduce' })
const page = await context.newPage()
+ let url = shotList.url
+ if (shotList.testWorkspace) {
+ const teamId = await logInToTestWorkspace(page, new URL(url).origin)
+ url = url.replace('{team_id}', String(teamId))
+ }
// A cold Vite dev server compiles each lazy chunk on its first request, which can take minutes.
- await page.goto(shotList.url, { timeout: FIRST_LOAD_TIMEOUT_MS })
+ await page.goto(url, { timeout: FIRST_LOAD_TIMEOUT_MS })
await settle(page, FIRST_LOAD_TIMEOUT_MS)
const frames = []
diff --git a/.agents/skills/run-posthog/SKILL.md b/.agents/skills/run-posthog/SKILL.md
index 8410fa5b76a8..d11379e1fc54 100644
--- a/.agents/skills/run-posthog/SKILL.md
+++ b/.agents/skills/run-posthog/SKILL.md
@@ -79,7 +79,7 @@ The full browser-MCP recipe:
const r = await fetch('/api/setup_test/organization_with_team/', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ data: { skip_onboarding: true } }),
+ body: JSON.stringify({ skip_onboarding: true, use_current_time: true }),
})
const { result } = await r.json()
// result: { user_email, team_id, personal_api_key, organization_id, ... }
diff --git a/.agents/skills/writing-pr-descriptions/SKILL.md b/.agents/skills/writing-pr-descriptions/SKILL.md
index 4503def3db45..a3cea7c9baa8 100644
--- a/.agents/skills/writing-pr-descriptions/SKILL.md
+++ b/.agents/skills/writing-pr-descriptions/SKILL.md
@@ -82,6 +82,7 @@ Prose is the slowest form on the page. Before writing a sentence, ask what carri
| The fact you have | The form that carries it |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------- |
| A visual change (any UI a person sees) | Screenshot, before and after. Mandatory, not optional |
+| A new action and its effect, which one screenshot cannot show | A feature reel in place of the "after" screenshot |
| A change to a flow or topology (CI wiring, pipelines, state machines, request paths) | Two branded `flowchart` blocks, before first |
| Several values compared across the same dimensions | A markdown table |
| A config or setting change | A fenced `diff` block |
@@ -92,13 +93,19 @@ Prose is the slowest form on the page. Before writing a sentence, ask what carri
No PR needs every form. Reach for one because it makes review faster, never as decoration. An empty section gets one bullet or "None".
-### Screenshots
+### Screenshots and reels
+
+A screenshot is the default for every visual change.
+A feature reel is an animated WebP of one UI flow, made with reel mode of `/qa-frontend`.
+Use a reel only for a new action and its effect, when a screenshot of the end state hides the action.
+Examples are a right-click menu on an element that had none, or a bar that appears when rows are selected.
+A new item in an existing menu, a new column, or new copy gets a screenshot, because the reviewer already knows how a person gets there.
+Before you make a reel, read `references/screenshots-and-reels.md`. It has the test, worked examples, and what a reel leaves out.
Take each screenshot from the first source that can show the change:
1. The running app, when one is up.
2. Storybook, through a headless browser. Use the story that covers the surface. When no story does, write a scratch story for the screenshot and keep it out of the commit.
-3. A feature reel, when one still cannot show a new flow. Reel mode of `/qa-frontend` turns Storybook stills into an animated WebP.
Capture at `deviceScaleFactor: 2`. A 1x image looks soft on a high-density screen, and GitHub shrinks a wider image to fit the column. Take the before from the base branch the same way. A new surface has no before, so say that in one line.
diff --git a/.agents/skills/writing-pr-descriptions/references/screenshots-and-reels.md b/.agents/skills/writing-pr-descriptions/references/screenshots-and-reels.md
new file mode 100644
index 000000000000..da6c04aee474
--- /dev/null
+++ b/.agents/skills/writing-pr-descriptions/references/screenshots-and-reels.md
@@ -0,0 +1,47 @@
+# Screenshots and reels
+
+A screenshot is the default for every visual change.
+A feature reel costs minutes to make, megabytes to load, and seconds to watch.
+A screenshot is faster on all three, so a reel must show something a screenshot cannot.
+
+## The test
+
+Write the sentence that tells the reviewer what changed.
+
+- The sentence names one state, or a screenshot makes clear how a person gets there. Take a screenshot.
+ "The project menu has an Export item." "Click Export, and a modal opens."
+- The sentence names an action and its effect, and a screenshot of the end state hides the action. A reel can carry it.
+ "Right-click a session row, and a menu opens." "Select two rows, and a bulk-action bar appears."
+
+Most UI changes fit the first case.
+When the user asks for a reel, make it.
+
+## Examples
+
+| Change | Form | Why |
+| -------------------------------------------------- | ----------------------------- | ----------------------------------------------------------------------------- |
+| A new item in an existing menu | Screenshot of the open menu | The item is the change. The reviewer already knows how the menu opens. |
+| A new column, badge, button, or empty state | Screenshot | One state shows all of it |
+| New styles, spacing, or copy | Screenshots, before and after | The difference is between two states, not inside a sequence |
+| A new hover card on an existing element | Screenshot with the card open | Hover is a familiar trigger, so the content is the change |
+| A new step in an existing wizard | Screenshot of the new step | The order of the other steps did not change |
+| A new loading or skeleton state | Screenshot of that state | The state is the change, not the motion |
+| A new right-click menu on an element that had none | Reel, one step | The trigger is new. A screenshot of a menu does not show where it opens from. |
+| Selecting rows shows a new bulk-action bar | Reel, one or two steps | A screenshot of the bar does not show what makes it appear |
+| An undo toast that brings back a deleted row | Reel, two steps | The cause and its effect are on screen at different times |
+| A flow across screens whose order is new | Reel, two to four steps | The reviewer must see which action leads to which screen |
+
+## What a reel leaves out
+
+A reel shows the new part of a flow, not the path to it.
+Each step must show something the PR changed.
+When the PR adds a right-click menu to session rows, start on the list and right-click a row.
+Do not first open the sidebar and click through to the list.
+Do not show the cursor travel to a menu and open it when the menu is not what changed.
+
+Show at most one reel per PR.
+When a PR seems to need two, show the main flow and use screenshots for the rest.
+
+A reel replaces the "after" screenshot of the flow, not the "before".
+For the "before" of a changed interaction, a screenshot or one line that says how it worked is enough.
+A new flow has no before, so say that in one line.
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index f20e7614feae..c24690b2260a 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -12,7 +12,7 @@
<!-- For each change a person can notice, say what they will now see or do differently, not only the code path that does it. Mark the rest as mechanical so a reviewer knows nothing user-visible is hiding in it. -->
-<!-- If there are frontend changes, please include screenshots. -->
+<!-- If there are frontend changes, please include screenshots. For a new interaction that one screenshot cannot show, a short GIF or animated WebP of the flow can replace the after screenshot. -->
<!-- PostHog employees: `hogli pr:upload-image <file>` uploads to the public PostHog/pr-assets repo and prints markdown to paste here. Never upload customer data, secrets, or internal info. -->
<!-- If a reference design was involved, include a link to the relevant Figma frame! -->
diff --git a/AGENTS.md b/AGENTS.md
index 9e8eb164ac43..43fa9877ad5f 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -66,7 +66,7 @@ Invoke `/writing-pr-descriptions` before writing the body — it carries the sha
Always fill the `## 🤖 Agent context` section, including the exact model that wrote the code.
NEVER put sensitive information in a PR description or comment. A user may share sensitive data in an agent session; none of it belongs on the PR.
-**Screenshots:** Upload frontend/visual changes with `hogli pr:upload-image <file>` and embed the printed markdown. The first run only warns and uploads nothing; re-run with `--yes` to confirm. Only PostHog employees can upload, but the public can permanently view these assets, so only upload the image if you're certain it doesn't contain customer data (including customer names), secrets, or sensitive internal info.
+**Screenshots:** Show frontend/visual changes with a screenshot, or with a feature reel when `/writing-pr-descriptions` calls for one. Upload with `hogli pr:upload-image <file>` and embed the printed markdown. The first run only warns and uploads nothing; re-run with `--yes` to confirm. Only PostHog employees can upload, but the public can permanently view these assets, so only upload the image if you're certain it doesn't contain customer data (including customer names), secrets, or sensitive internal info.
### Rules