: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(games): add Ship It, a game about landing a pull request (#99999)
Jovan Sakovic83af027d0cce
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex a0a66d15f6a7..b2aad9de62c7 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -2996,6 +2996,14 @@ snapshots:hash: v1.k794b7964.8f6c315b7c7c7ef951d6b8c66e6321474b1cf2fe786159e9684a7f9404ce43c1._sDXSD6yIJczScjuNBp-z_GZFmf47M7gX_f8dHtAw7wfilters-universal-filters--default--light:hash: v1.k794b7964.b87688fb509e1000ea84eb91c4521e928eb6b4cbb48695a8ccf86aabe0192fb4.wCCtZF4Z8RR02dra-V1H1MCHKJ_SBUnfYCL0yhc9vcE+ games-ship-it--default--dark:+ hash: v1.k794b7964.d213f9a2dd3a003c7e538c2fc54212df1f05d9f25155bd8da34b960298fe1130.xrboNqfa3nM87_jlGaHt10_Y1e-v52pnLbSR3kJLj-g+ games-ship-it--default--light:+ hash: v1.k794b7964.01d596e433280c72fdc6f7ecb1c7120359cd57b02b24495e0b1eaadea86ed22b.f46SiJ10EcThp-NB_Ka5XcaLs6qsr61tkYpiyLEhwW4+ games-ship-it--narrow-scene--dark:+ hash: v1.k794b7964.d001b46f5ebea3be693f77ddaf78123e6b61d6cdd5e1e795fe5b95bb2c53f12f.LxxyIUTeYHD3xFJ7QxUfj_K9cqePGvO2-H_ff2GYYYI+ games-ship-it--narrow-scene--light:+ hash: v1.k794b7964.214cd1e417ddd8cbbc06c6feea531a5f16fa4ab0df690fef884aa2c2069e3a7d.Rxlm9SIIIyFCPWA-29sRI0WSyeY_jJ_JpzoXQ2ZXYekhome-recordingrow--default--dark:hash: v1.k794b7964.d5df34bd174b111b01bb1c89c11eb0a468635657ffcf31c09f26113de622d437.5LMgLJxg6k8kPCHP5RVWZYhZOKoj5zEPCBelpe7TwIUhome-recordingrow--default--light:diff --git a/frontend/src/productScenes.tsx b/frontend/src/productScenes.tsxindex 2aa1158fe366..e0d490ee174e 100644--- a/frontend/src/productScenes.tsx+++ b/frontend/src/productScenes.tsx@@ -98,6 +98,7 @@ export const productScenes: Record<string, () => Promise<any>> = {FeatureFlagsStaffTools: () => import('../../products/feature_flags/frontend/staff/FeatureFlagsStaffToolsScene'),Game368Hedgehogs: () => import('../../products/games/368Hedgehogs/368Hedgehogs'),FlappyHog: () => import('../../products/games/FlappyHog/FlappyHog'),+ ShipIt: () => import('../../products/games/frontend/ShipIt/ShipIt'),Group: () => import('../../products/groups/frontend/pages/Group'),Groups: () => import('../../products/groups/frontend/pages/Groups'),GroupsNew: () => import('../../products/groups/frontend/pages/GroupsNew'),diff --git a/frontend/src/products.json b/frontend/src/products.jsonindex d77b07d7fec9..2d77b97c6697 100644--- a/frontend/src/products.json+++ b/frontend/src/products.json@@ -281,7 +281,8 @@],"games": [{ "path": "368 Hedgehogs", "category": null, "iconType": null, "type": null, "intents": [] },- { "path": "Flappy Hog", "category": null, "iconType": null, "type": null, "intents": [] }+ { "path": "Flappy Hog", "category": null, "iconType": null, "type": null, "intents": [] },+ { "path": "Ship It", "category": null, "iconType": null, "type": null, "intents": [] }],"metadata": [{ "path": "Actions", "category": "Schema", "iconType": null, "type": null, "intents": [] },diff --git a/frontend/src/products.tsx b/frontend/src/products.tsxindex 72dab55eb508..42cbc24a3b51 100644--- a/frontend/src/products.tsx+++ b/frontend/src/products.tsx@@ -177,6 +177,7 @@ export const productRoutes: Record<string, [string, string]> = {'/feature_flags/staff': ['FeatureFlagsStaffTools', 'featureFlagsStaffTools'],'/games/368hedgehogs': ['Game368Hedgehogs', 'game368Hedgehogs'],'/games/flappyhog': ['FlappyHog', 'flappyHog'],+ '/games/shipit': ['ShipIt', 'shipIt'],'/groups/:groupTypeIndex': ['Groups', 'groups'],'/groups/:groupTypeIndex/new': ['GroupsNew', 'groupsNew'],'/groups/:groupTypeIndex/:groupKey': ['Group', 'group'],@@ -759,6 +760,7 @@ export const productConfiguration: Record<string, any> = {FeatureFlagsStaffTools: { instanceLevel: true, name: 'Flags staff tools' },Game368Hedgehogs: { name: '368Hedgehogs', projectBased: true, activityScope: 'Games' },FlappyHog: { name: 'FlappyHog', projectBased: true, activityScope: 'Games' },+ ShipIt: { name: 'Ship It', projectBased: true, activityScope: 'Games' },Group: { name: 'People & groups', projectBased: true },Groups: { name: 'Groups', projectBased: true },GroupsNew: { projectBased: true },@@ -1373,6 +1375,7 @@ export const productUrls = {},game368hedgehogs: (): string => `/games/368hedgehogs`,flappyHog: (): string => `/games/flappyhog`,+ shipIt: (): string => `/games/shipit`,groups: (groupTypeIndex: string | number): string => `/groups/${groupTypeIndex}`,groupsNew: (groupTypeIndex: string | number): string => `/groups/${groupTypeIndex}/new`,group: (groupTypeIndex: string | number, groupKey: string, encode: boolean = true, tab?: string | null): string =>@@ -2765,6 +2768,7 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [export const getTreeItemsGames = (): FileSystemImport[] => [{ path: '368 Hedgehogs', href: urls.game368hedgehogs() },{ path: 'Flappy Hog', href: '/games/flappyhog' },+ { path: 'Ship It', href: urls.shipIt() },]/** This const is auto-generated, as is the whole file */diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 26c8e7410f33..b7cf827379a8 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -3544,6 +3544,10 @@ importers:react:specifier: 18.3.1version: 18.3.1+ devDependencies:+ '@testing-library/react':+ specifier: ^14.3.1+ version: 14.3.1(@types/[email protected])([email protected]([email protected]))([email protected])products/groups:dependencies:diff --git a/products/games/frontend/ShipIt/ShipIt.scss b/products/games/frontend/ShipIt/ShipIt.scssnew file mode 100644index 000000000000..e7527e247374--- /dev/null+++ b/products/games/frontend/ShipIt/ShipIt.scss@@ -0,0 +1,110 @@+.ShipIt {+ display: flex;+ flex-direction: column;+ gap: 0.75rem;+ max-width: 48rem;+ margin-inline: auto;++ &__board {+ position: relative;+ overflow: hidden;+ background: var(--color-bg-surface-primary);+ border: 1px solid var(--color-border-primary);+ border-radius: var(--radius);+ }++ &__board:focus-visible {+ outline: 2px solid var(--color-border-primary);+ outline-offset: 2px;+ }++ &__track {+ position: relative;+ height: 16rem;+ }++ &__lane {+ height: calc(100% / var(--ship-it-lanes));+ border-bottom: 1px dashed var(--color-border-primary);++ &:last-child {+ border-bottom: none;+ }+ }++ &__pr,+ &__item {+ position: absolute;+ padding: 0.125rem 0.5rem;+ font-size: 0.75rem;+ font-weight: 600;+ white-space: nowrap;+ border: 1px solid;+ border-radius: var(--radius);++ // Both are centred on their own coordinate, so a tile reaches the pull request exactly when+ // the rules collect it, at every board width rather than only at the widest one.+ transform: translate(-50%, -50%);+ }++ &__pr {+ left: calc(var(--ship-it-hit) * 100%);++ // An arriving tile overlaps the pull request all the way in, so it has to pass underneath.+ // Without this the tile paints last and the pull request is unreadable as it is collected.+ z-index: 1;+ color: var(--color-text-primary);+ background: var(--color-bg-fill-primary);+ border-color: var(--color-border-primary);+ }++ // The pull request only advances while it is mergeable, so the player needs to see that state at a glance.+ &__pr[data-mergeable='true'] {+ color: var(--success);+ background: var(--success-highlight);+ border-color: var(--success);+ }++ &__item[data-kind='good'] {+ color: var(--success);+ background: var(--success-highlight);+ border-color: var(--success);+ }++ &__item[data-kind='bad'] {+ color: var(--danger);+ background: var(--danger-highlight);+ border-color: var(--danger);+ }++ &__overlay {+ position: absolute;+ inset: 0;++ // The pull request is lifted above the track, so the overlay has to clear it as well.+ // Without this the pull request paints over the copy the overlay is there to show.+ z-index: 2;+ display: flex;+ flex-direction: column;+ gap: 0.5rem;+ align-items: center;+ justify-content: center;+ padding: 1.5rem;+ text-align: center;+ background: var(--color-bg-surface-primary);++ p {+ max-width: 28rem;+ margin: 0;+ }+ }++ &__hint {+ color: var(--color-text-secondary);+ }++ &__event {+ font-size: 0.875rem;+ color: var(--color-text-secondary);+ }+}diff --git a/products/games/frontend/ShipIt/ShipIt.stories.tsx b/products/games/frontend/ShipIt/ShipIt.stories.tsxnew file mode 100644index 000000000000..caea51682358--- /dev/null+++ b/products/games/frontend/ShipIt/ShipIt.stories.tsx@@ -0,0 +1,32 @@+import { Meta, StoryObj } from '@storybook/react'++import { ShipIt } from './ShipIt'++const meta: Meta<typeof ShipIt> = {+ title: 'Games/Ship It',+ component: ShipIt,+ parameters: {+ docs: {+ description: {+ component:+ 'Steer a pull request between three lanes to collect approvals and green CI, and to dodge conflicts, flaky tests and the stale bot. Progress toward the merge queue only accrues while CI is green and both approvals hold. Nothing moves until the player starts, so this renders the same every time.',+ },+ },+ },+ tags: ['autodocs'],+}+export default meta++type Story = StoryObj<typeof ShipIt>++export const Default: Story = {}++export const NarrowScene: Story = {+ decorators: [+ (Story) => (+ <div className="w-[520px]">+ <Story />+ </div>+ ),+ ],+}diff --git a/products/games/frontend/ShipIt/ShipIt.test.tsx b/products/games/frontend/ShipIt/ShipIt.test.tsxnew file mode 100644index 000000000000..1909fcc12a15--- /dev/null+++ b/products/games/frontend/ShipIt/ShipIt.test.tsx@@ -0,0 +1,116 @@+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'++import { ShipIt } from './ShipIt'++/**+ * The rules are covered by shipItGame.test.ts. These cover the wiring the rules+ * cannot see: that the animation frame loop feeds them the clock, that the keys+ * reach them, and that the loop stops when the run is over.+ */+describe('ShipIt', () => {+ /** Each spawn draws three times: hazard or not, which item, which lane. */+ function seedSpawns(draws: number[]): void {+ let index = 0+ jest.spyOn(Math, 'random').mockImplementation(() => draws[index++ % draws.length])+ }++ /** Fake timers drive requestAnimationFrame, so the loop runs on the test's clock. */+ function advance(ms: number): void {+ act(() => {+ jest.advanceTimersByTime(ms)+ })+ }++ function laneOf(container: HTMLElement): string | null {+ return container.querySelector<HTMLElement>('.ShipIt__pr')?.style.top ?? null+ }++ beforeEach(() => {+ jest.useFakeTimers()+ })++ afterEach(() => {+ jest.useRealTimers()+ jest.restoreAllMocks()+ cleanup()+ })++ it('does not run the track until the player starts', () => {+ seedSpawns([0.9, 0.9, 0.5])+ const { container } = render(<ShipIt />)++ advance(5000)++ expect(container.querySelectorAll('.ShipIt__item')).toHaveLength(0)+ expect(screen.getByText('Open a pull request')).toBeTruthy()+ })++ it('runs the track once the player starts', () => {+ seedSpawns([0.9, 0.9, 0.5])+ const { container } = render(<ShipIt />)++ fireEvent.click(screen.getByText('Open a pull request'))+ advance(2000)++ expect(container.querySelectorAll('.ShipIt__item').length).toBeGreaterThan(0)+ })++ it('steers the pull request with the arrow keys', () => {+ seedSpawns([0.9, 0.9, 0.5])+ const { container } = render(<ShipIt />)+ fireEvent.click(screen.getByText('Open a pull request'))+ const board = container.querySelector('.ShipIt__board') as HTMLElement++ const middle = laneOf(container)+ fireEvent.keyDown(board, { key: 'ArrowDown' })+ const lower = laneOf(container)+ fireEvent.keyDown(board, { key: 'ArrowUp' })++ expect(lower).not.toEqual(middle)+ expect(laneOf(container)).toEqual(middle)+ })++ it('holds the pull request in the track at the top lane', () => {+ seedSpawns([0.9, 0.9, 0.5])+ const { container } = render(<ShipIt />)+ fireEvent.click(screen.getByText('Open a pull request'))+ const board = container.querySelector('.ShipIt__board') as HTMLElement+ const middle = laneOf(container)++ fireEvent.keyDown(board, { key: 'ArrowUp' })+ const top = laneOf(container)+ for (let press = 0; press < 4; press++) {+ fireEvent.keyDown(board, { key: 'ArrowUp' })+ }++ expect(top).not.toEqual(middle)+ expect(laneOf(container)).toEqual(top)+ })++ it('closes the pull request after three stale bots', () => {+ // A hazard, the third hazard kind, and the middle lane: a stale bot where the player starts.+ seedSpawns([0.1, 0.9, 0.4])+ render(<ShipIt />)+ fireEvent.click(screen.getByText('Open a pull request'))++ advance(12000)++ expect(screen.getByText('Closed as stale', { selector: 'h2' })).toBeTruthy()+ })++ it('stops the track when the scene unmounts', () => {+ seedSpawns([0.9, 0.9, 0.5])+ // The loop is only observable here: React drops the state updater once unmounted,+ // so a leaked loop still schedules frames while doing no visible work.+ const frames = jest.spyOn(window, 'requestAnimationFrame')+ const { unmount } = render(<ShipIt />)+ fireEvent.click(screen.getByText('Open a pull request'))+ advance(1000)++ unmount()+ const scheduled = frames.mock.calls.length+ advance(5000)++ expect(frames.mock.calls.length).toEqual(scheduled)+ })+})diff --git a/products/games/frontend/ShipIt/ShipIt.tsx b/products/games/frontend/ShipIt/ShipIt.tsxnew file mode 100644index 000000000000..e5f45cbf77fa--- /dev/null+++ b/products/games/frontend/ShipIt/ShipIt.tsx@@ -0,0 +1,357 @@+import './ShipIt.scss'++import { useCallback, useEffect, useRef, useState } from 'react'++import { LemonButton, LemonTag } from '@posthog/lemon-ui'++import { IconArrowDown, IconArrowUp } from 'lib/lemon-ui/icons'+import { LemonProgress } from 'lib/lemon-ui/LemonProgress'+import { SceneExport } from 'scenes/sceneTypes'++import {+ advanceLevel,+ createInitialState,+ GameState,+ HIT_X,+ isAwaitingQueue,+ isMergeable,+ isOver,+ ITEMS,+ LANE_COUNT,+ LAST_LEVEL,+ levelOf,+ LEVELS,+ moveLane,+ QUEUE_HOLD_MS,+ REQUIRED_APPROVALS,+ STALENESS_LIMIT,+ step,+} from './shipItGame'++/** A frame longer than this means the tab was backgrounded, so the frame is dropped rather than played. */+const MAX_FRAME_MS = 100++const BEST_SCORE_KEY = 'ship-it-best-score'++function readBestScore(): number {+ try {+ return Number(localStorage.getItem(BEST_SCORE_KEY)) || 0+ } catch {+ return 0+ }+}++function writeBestScore(score: number): void {+ try {+ localStorage.setItem(BEST_SCORE_KEY, String(score))+ } catch {+ // A private window or a full store just costs the player their best score.+ }+}++/** The one thing between the pull request and the merge queue, which is what the player should chase next. */+function progressLabel(state: GameState): string {+ if (state.phase === 'queued') {+ return 'In the merge queue'+ }+ if (isAwaitingQueue(state)) {+ return 'Ready. Catch /trunk merge'+ }+ if (!state.ciGreen && state.approvals < REQUIRED_APPROVALS) {+ return 'Waiting on CI and reviews'+ }+ if (!state.ciGreen) {+ return 'Waiting on CI'+ }+ if (state.approvals < REQUIRED_APPROVALS) {+ return 'Waiting on reviews'+ }+ return 'Ready to merge'+}++function StatusBar({ state }: { state: GameState }): JSX.Element {+ const queueSecondsLeft = Math.max(0, Math.ceil((QUEUE_HOLD_MS - state.queueMs) / 1000))++ return (+ <div className="flex flex-wrap gap-2 items-center">+ <LemonTag type="option">+ <span translate="no">+ {state.level + 1}/{LEVELS.length}+ </span>+ <span> {levelOf(state).name}</span>+ </LemonTag>+ <LemonTag type={state.ciGreen ? 'success' : 'danger'}>{state.ciGreen ? 'CI green' : 'CI red'}</LemonTag>+ <LemonTag type={state.approvals >= REQUIRED_APPROVALS ? 'success' : 'default'}>+ <span>Approvals </span>+ <span translate="no">+ {state.approvals}/{REQUIRED_APPROVALS}+ </span>+ </LemonTag>+ <LemonTag type={state.staleness > 0 ? 'warning' : 'default'}>+ <span>Staleness </span>+ <span translate="no">+ {state.staleness}/{STALENESS_LIMIT}+ </span>+ </LemonTag>+ {state.phase === 'queued' && (+ <LemonTag type="primary">+ <span>Hold for </span>+ <span translate="no">{queueSecondsLeft}s</span>+ </LemonTag>+ )}+ </div>+ )+}++function Track({ state }: { state: GameState }): JSX.Element {+ return (+ <div+ className="ShipIt__track"+ aria-hidden="true"+ style={{ '--ship-it-lanes': LANE_COUNT, '--ship-it-hit': HIT_X } as React.CSSProperties}+ >+ {Array.from({ length: LANE_COUNT }, (_, lane) => (+ <div key={lane} className="ShipIt__lane" />+ ))}+ {/* The number is the pull request that added this game, which is why it is written out rather than scored. */}+ <div+ className="ShipIt__pr"+ data-mergeable={isMergeable(state)}+ style={{ top: `${(state.lane + 0.5) * (100 / LANE_COUNT)}%` }}+ >+ #99999+ </div>+ {state.items.map((item) => (+ <div+ key={item.id}+ className="ShipIt__item"+ data-kind={ITEMS[item.kind].good ? 'good' : 'bad'}+ style={{+ left: `${item.x * 100}%`,+ top: `${(item.lane + 0.5) * (100 / LANE_COUNT)}%`,+ }}+ >+ {ITEMS[item.kind].chip}+ </div>+ ))}+ </div>+ )+}++function Overlay({+ state,+ started,+ best,+ onStart,+ onAdvance,+}: {+ state: GameState+ started: boolean+ best: number+ onStart: () => void+ onAdvance: () => void+}): JSX.Element | null {+ if (!started) {+ return (+ <div className="ShipIt__overlay">+ <h2>Ship it</h2>+ <p>+ Steer your pull request between lanes to pick up approvals and green CI, and to dodge conflicts,+ flakes and the stale bot. It only moves toward the merge queue while CI is green and both approvals+ hold.+ </p>+ <p className="ShipIt__hint">+ Three levels, each one harder. Arrow keys, W and S, or the buttons below.+ </p>+ <LemonButton type="primary" onClick={onStart}>+ Open a pull request+ </LemonButton>+ </div>+ )+ }++ const score = Math.floor(state.score)++ if (state.phase === 'merged' && state.level < LAST_LEVEL) {+ const next = LEVELS[state.level + 1]+ return (+ <div className="ShipIt__overlay">+ <h2>Merged</h2>+ <p>+ <span>Next up: </span>+ <span>{next.name}</span>+ <span>. {next.goal}</span>+ </p>+ <p className="ShipIt__hint">+ <span>Score so far </span>+ <span translate="no">{score}</span>+ </p>+ <LemonButton type="primary" onClick={onAdvance}>+ Open the next one+ </LemonButton>+ </div>+ )+ }++ if (!isOver(state)) {+ return null+ }++ const merged = state.phase === 'merged'++ return (+ <div className="ShipIt__overlay">+ <h2>{merged ? 'Shipped' : 'Closed as stale'}</h2>+ <p>+ <span>{merged ? 'All three landed. You scored ' : 'The stale bot got there first. You scored '}</span>+ <span translate="no">{score}</span>+ <span>{score >= best ? ', your best yet.' : '.'}</span>+ </p>+ <LemonButton type="primary" onClick={onStart}>+ {merged ? 'Go again' : 'Try again'}+ </LemonButton>+ </div>+ )+}++export function ShipIt(): JSX.Element {+ const [state, setState] = useState<GameState>(createInitialState)+ const [started, setStarted] = useState(false)+ const [best, setBest] = useState(readBestScore)+ const boardRef = useRef<HTMLDivElement>(null)++ // The track runs only while the pull request is alive, so it also stops between levels.+ const running = started && (state.phase === 'coding' || state.phase === 'queued')+ const betweenLevels = state.phase === 'merged' && state.level < LAST_LEVEL++ const start = useCallback((): void => {+ setState(createInitialState())+ setStarted(true)+ boardRef.current?.focus()+ }, [])++ const advance = useCallback((): void => {+ setState((current) => advanceLevel(current))+ boardRef.current?.focus()+ }, [])++ const move = useCallback((delta: number): void => {+ setState((current) => moveLane(current, delta))+ // The lane buttons sit outside the board, so without this a click leaves focus on the button+ // and every later arrow key misses the board's handler.+ boardRef.current?.focus()+ }, [])++ useEffect(() => {+ if (!running) {+ return+ }+ let frame = 0+ let previous = performance.now()++ const tick = (now: number): void => {+ const dtMs = now - previous+ previous = now+ if (dtMs <= MAX_FRAME_MS) {+ setState((current) => step(current, dtMs, Math.random))+ }+ frame = requestAnimationFrame(tick)+ }++ frame = requestAnimationFrame(tick)+ return () => cancelAnimationFrame(frame)+ }, [running])++ useEffect(() => {+ if (!isOver(state)) {+ return+ }+ const score = Math.floor(state.score)+ if (score > best) {+ setBest(score)+ writeBestScore(score)+ }+ }, [state, best])++ const onKeyDown = (event: React.KeyboardEvent): void => {+ const key = event.key.toLowerCase()+ if (key === 'arrowup' || key === 'w') {+ event.preventDefault()+ move(-1)+ } else if (key === 'arrowdown' || key === 's') {+ event.preventDefault()+ move(1)+ } else if ((key === 'enter' || key === ' ') && !running) {+ event.preventDefault()+ betweenLevels ? advance() : start()+ }+ }++ return (+ <div className="ShipIt">+ <div className="flex flex-wrap gap-2 justify-between items-center">+ <StatusBar state={state} />+ <div className="flex gap-2 items-center">+ <LemonTag type="muted">+ <span>Score </span>+ <span translate="no">{Math.floor(state.score)}</span>+ </LemonTag>+ {best > 0 && (+ <LemonTag type="muted">+ <span>Best </span>+ <span translate="no">{best}</span>+ </LemonTag>+ )}+ </div>+ </div>++ <div>+ <div className="flex gap-2 justify-between items-center text-xs text-secondary mb-1">+ <span>{progressLabel(state)}</span>+ <span translate="no">{Math.floor(state.progress)}%</span>+ </div>+ <LemonProgress percent={state.progress} smoothing={false} size="large" />+ </div>++ <div+ className="ShipIt__board"+ ref={boardRef}+ tabIndex={0}+ role="application"+ aria-label="Ship it, a game about landing a pull request"+ onKeyDown={onKeyDown}+ >+ <Track state={state} />+ <Overlay state={state} started={started} best={best} onStart={start} onAdvance={advance} />+ </div>++ <div className="sr-only" aria-live="polite">+ {`Lane ${state.lane + 1} of ${LANE_COUNT}`}+ </div>++ <div className="flex flex-wrap gap-2 justify-between items-center">+ <div className="ShipIt__event" aria-live="polite">+ {state.lastEvent ?? 'Waiting for review'}+ </div>+ <div className="flex gap-2">+ <LemonButton+ icon={<IconArrowUp />}+ onClick={() => move(-1)}+ disabledReason={running ? undefined : 'Open a pull request first'}+ aria-label="Move up a lane"+ />+ <LemonButton+ icon={<IconArrowDown />}+ onClick={() => move(1)}+ disabledReason={running ? undefined : 'Open a pull request first'}+ aria-label="Move down a lane"+ />+ </div>+ </div>+ </div>+ )+}++export const scene: SceneExport = {+ component: ShipIt,+}diff --git a/products/games/frontend/ShipIt/shipItGame.test.ts b/products/games/frontend/ShipIt/shipItGame.test.tsnew file mode 100644index 000000000000..effa62c489ff--- /dev/null+++ b/products/games/frontend/ShipIt/shipItGame.test.ts@@ -0,0 +1,186 @@+import {+ advanceLevel,+ createInitialState,+ GameState,+ isAwaitingQueue,+ isOver,+ Item,+ ItemKind,+ LAST_LEVEL,+ QUEUE_HOLD_MS,+ QUEUE_KICK_PROGRESS,+ REQUIRED_APPROVALS,+ STALENESS_LIMIT,+ step,+} from './shipItGame'++/** Spawns a helpful item in the last lane, so a player in lane 0 is never touched by a spawn. */+const noHits = (): number => 0.99++function stateWith(overrides: Partial<GameState>): GameState {+ return { ...createInitialState(), ...overrides }+}++function itemAt(kind: ItemKind, lane: number): Item {+ return { id: 1, kind, lane, x: 0.09 }+}++/** Long enough that an item from itemAt travels past the hit line in a single step. */+const FRAME_MS = 100++function run(state: GameState, steps: number, random: () => number = noHits): GameState {+ let current = state+ for (let i = 0; i < steps && !isOver(current); i++) {+ current = step(current, 16, random)+ }+ return current+}++describe('shipItGame', () => {+ it.each([+ ['CI green and enough approvals', true, REQUIRED_APPROVALS, true],+ ['CI red but enough approvals', false, REQUIRED_APPROVALS, false],+ ['CI green but too few approvals', true, REQUIRED_APPROVALS - 1, false],+ ['CI red and too few approvals', false, 0, false],+ ])('progresses only with %s', (_label, ciGreen, approvals, expectedToProgress) => {+ const after = run(stateWith({ lane: 0, ciGreen, approvals }), 60)++ expect(after.progress > 0).toBe(expectedToProgress)+ })++ it('reaches merged on an uninterrupted run', () => {+ const after = run(stateWith({ lane: 0, ciGreen: true, approvals: REQUIRED_APPROVALS }), 2000)++ expect(after.phase).toBe('merged')+ })++ it('closes the pull request once the stale bot hits its limit', () => {+ const state = stateWith({ lane: 1, staleness: STALENESS_LIMIT - 1, items: [itemAt('stale', 1)] })++ expect(step(state, 100, noHits).phase).toBe('closed')+ })++ it('kicks a queued pull request back to coding instead of merging it', () => {+ const state = stateWith({ phase: 'queued', progress: 100, lane: 1, ciGreen: true, items: [itemAt('flake', 1)] })++ const after = step(state, 100, noHits)++ expect(after.phase).toBe('coding')+ expect(after.progress).toBe(QUEUE_KICK_PROGRESS)+ })++ // The frame the hold completes on is the only one where the two outcomes compete, so it is the+ // frame that pins the order: a hazard has to be collected before the timer is read.+ it.each([+ ['a hazard arrives on the completing frame', [itemAt('flake', 1)], 'coding'],+ ['the lane is clear on the completing frame', [], 'merged'],+ ])('%s', (_label, items, expectedPhase) => {+ const state = stateWith({+ phase: 'queued',+ progress: 100,+ lane: 1,+ ciGreen: true,+ approvals: REQUIRED_APPROVALS,+ queueMs: QUEUE_HOLD_MS - FRAME_MS,+ items,+ })++ expect(step(state, FRAME_MS, noHits).phase).toBe(expectedPhase)+ })++ it('stays queued on the frame before the hold completes', () => {+ const state = stateWith({+ phase: 'queued',+ progress: 100,+ lane: 1,+ ciGreen: true,+ approvals: REQUIRED_APPROVALS,+ queueMs: QUEUE_HOLD_MS - FRAME_MS * 2,+ })++ expect(step(state, FRAME_MS, noHits).phase).toBe('queued')+ })++ it('ignores an item in another lane', () => {+ const state = stateWith({ lane: 0, items: [itemAt('approval', 2)] })++ expect(step(state, 100, noHits).approvals).toBe(0)+ })++ it.each([+ ['a middle level', 0, false],+ ['the last level', LAST_LEVEL, true],+ ])('merging ends the run only on %s', (_label, level, expectedToEnd) => {+ const merged = stateWith({ level, phase: 'merged' })++ expect(isOver(merged)).toBe(expectedToEnd)+ })++ it('carries the score into the next level and resets the board', () => {+ const merged = stateWith({+ level: 0,+ phase: 'merged',+ score: 900,+ ciGreen: true,+ approvals: REQUIRED_APPROVALS,+ progress: 100,+ staleness: 2,+ items: [itemAt('stale', 1)],+ })++ const next = advanceLevel(merged)++ expect(next.level).toBe(1)+ expect(next.score).toBe(900)+ expect(next.phase).toBe('coding')+ expect(next.ciGreen).toBe(false)+ expect(next.approvals).toBe(0)+ expect(next.progress).toBe(0)+ expect(next.staleness).toBe(0)+ expect(next.items).toEqual([])+ })++ it('holds the last level at full progress until a /trunk merge arrives', () => {+ const ready = stateWith({ level: LAST_LEVEL, lane: 0, ciGreen: true, approvals: REQUIRED_APPROVALS })++ const waiting = run(ready, 2000)+ expect(waiting.progress).toBe(100)+ expect(waiting.phase).toBe('coding')++ const held = run(waiting, 500)+ expect(held.score).toBe(waiting.score)++ const enqueued = step({ ...waiting, lane: 1, items: [itemAt('trunk_merge', 1)] }, 100, noHits)+ expect(enqueued.phase).toBe('queued')+ })++ it('stops forcing /trunk merge tiles while CI is red, so the level cannot stall', () => {+ const ready = stateWith({+ level: LAST_LEVEL,+ progress: 100,+ ciGreen: true,+ approvals: REQUIRED_APPROVALS,+ })++ expect(isAwaitingQueue(ready)).toBe(true)+ expect(isAwaitingQueue({ ...ready, ciGreen: false })).toBe(false)+ })++ it.each([+ ['stamphog fills the approvals a missing review left', 'stamphog' as ItemKind, 0, REQUIRED_APPROVALS],+ ['changes requested takes them all back', 'changes_requested' as ItemKind, REQUIRED_APPROVALS, 0],+ ])('%s', (_label, kind, approvals, expected) => {+ const state = stateWith({ level: 1, lane: 1, approvals, items: [itemAt(kind, 1)] })++ expect(step(state, 100, noHits).approvals).toBe(expected)+ })++ it('clears staleness on a rebase but sends CI back to red', () => {+ const state = stateWith({ level: 1, lane: 1, staleness: 2, ciGreen: true, items: [itemAt('rebase', 1)] })++ const after = step(state, 100, noHits)++ expect(after.staleness).toBe(0)+ expect(after.ciGreen).toBe(false)+ })+})diff --git a/products/games/frontend/ShipIt/shipItGame.ts b/products/games/frontend/ShipIt/shipItGame.tsnew file mode 100644index 000000000000..57f52df1d16a--- /dev/null+++ b/products/games/frontend/ShipIt/shipItGame.ts@@ -0,0 +1,354 @@+export const LANE_COUNT = 3+export const REQUIRED_APPROVALS = 2+export const STALENESS_LIMIT = 3+export const QUEUE_HOLD_MS = 8000+export const CONFLICT_PROGRESS_COST = 25+export const QUEUE_KICK_PROGRESS = 80++/** Items are hit when they reach the PR, which sits a little in from the left edge of the track. */+export const HIT_X = 0.08+const TRACK_SPEED_START = 0.28+const TRACK_SPEED_MAX = 0.58+const TRACK_SPEED_RAMP_MS = 60000+const SPAWN_INTERVAL_START_MS = 900+const SPAWN_INTERVAL_MIN_MS = 420+const SPAWN_RAMP_MS = 50000+const PROGRESS_MS_TO_FULL = 14000++export type ItemKind =+ | 'approval'+ | 'ci_green'+ | 'stamphog'+ | 'rebase'+ | 'trunk_merge'+ | 'conflict'+ | 'flake'+ | 'stale'+ | 'changes_requested'++export type Phase = 'coding' | 'queued' | 'merged' | 'closed'++export interface Item {+ id: number+ kind: ItemKind+ lane: number+ /** Position along the track, 1 at the spawn edge down to 0 at the PR. */+ x: number+}++export interface GameState {+ phase: Phase+ /** Index into LEVELS. Carries the score forward; everything else resets between levels. */+ level: number+ lane: number+ items: Item[]+ approvals: number+ ciGreen: boolean+ progress: number+ staleness: number+ queueMs: number+ elapsedMs: number+ score: number+ spawnTimerMs: number+ nextItemId: number+ /** Last thing that happened to the PR, shown as a status line. */+ lastEvent: string | null+}++/** One entry per item: the short name on the moving tile, the long one for the status line. */+export const ITEMS: Record<ItemKind, { chip: string; label: string; good: boolean }> = {+ approval: { chip: 'Approve', label: 'Approved', good: true },+ ci_green: { chip: 'CI pass', label: 'CI green', good: true },+ stamphog: { chip: 'stamphog', label: 'Stamped by stamphog', good: true },+ rebase: { chip: 'Rebase', label: 'Rebased onto master', good: true },+ trunk_merge: { chip: '/trunk merge', label: 'Enqueued with /trunk merge', good: true },+ conflict: { chip: 'Conflict', label: 'Merge conflict', good: false },+ flake: { chip: 'Flake', label: 'Flaky test', good: false },+ stale: { chip: 'Stale', label: 'Stale bot', good: false },+ changes_requested: { chip: 'Changes', label: 'Changes requested', good: false },+}++export interface Level {+ name: string+ /** One line under the level name, telling the player what changed. */+ goal: string+ kinds: ItemKind[]+ /** Multipliers on the base track speed and spawn interval. */+ speed: number+ spawn: number+ /** Whether reaching full progress enqueues on its own, or waits for a /trunk merge tile. */+ needsTrunkMerge: boolean+}++export const LEVELS: Level[] = [+ {+ name: 'Draft',+ goal: 'Get CI green and two approvals, then hold the queue.',+ kinds: ['approval', 'ci_green', 'conflict', 'flake', 'stale'],+ speed: 1,+ spawn: 1,+ needsTrunkMerge: false,+ },+ {+ name: 'Ready for review',+ goal: 'Reviewers can take approvals back, and a rebase costs you CI.',+ kinds: ['approval', 'ci_green', 'stamphog', 'rebase', 'conflict', 'flake', 'stale', 'changes_requested'],+ speed: 1.25,+ spawn: 0.8,+ needsTrunkMerge: false,+ },+ {+ name: 'Merge queue',+ goal: 'Nothing enqueues on its own. Catch a /trunk merge tile once you are ready.',+ kinds: [+ 'approval',+ 'ci_green',+ 'stamphog',+ 'rebase',+ 'trunk_merge',+ 'conflict',+ 'flake',+ 'stale',+ 'changes_requested',+ ],+ speed: 1.5,+ spawn: 0.65,+ needsTrunkMerge: true,+ },+]++export const LAST_LEVEL = LEVELS.length - 1++const LANES = Array.from({ length: LANE_COUNT }, (_, index) => index)++export function levelOf(state: GameState): Level {+ return LEVELS[Math.min(LAST_LEVEL, state.level)]+}++function freshBoard(level: number, score: number): GameState {+ return {+ phase: 'coding',+ level,+ lane: 1,+ items: [],+ approvals: 0,+ ciGreen: false,+ progress: 0,+ staleness: 0,+ queueMs: 0,+ elapsedMs: 0,+ score,+ spawnTimerMs: 0,+ nextItemId: 1,+ lastEvent: null,+ }+}++export function createInitialState(): GameState {+ return freshBoard(0, 0)+}++/** Called after a merge on any level but the last. The score is the only thing that carries. */+export function advanceLevel(state: GameState): GameState {+ if (state.phase !== 'merged' || state.level >= LAST_LEVEL) {+ return state+ }+ return freshBoard(state.level + 1, state.score)+}++export function isMergeable(state: GameState): boolean {+ return state.ciGreen && state.approvals >= REQUIRED_APPROVALS+}++/**+ * True once the PR is only waiting for a /trunk merge tile to reach it. Mergeability is part of the+ * test because a flake can turn CI red at full progress, and the queue would refuse the pull request:+ * without this the spawner would keep offering the one tile that cannot help.+ */+export function isAwaitingQueue(state: GameState): boolean {+ return state.phase === 'coding' && state.progress >= 100 && levelOf(state).needsTrunkMerge && isMergeable(state)+}++export function isOver(state: GameState): boolean {+ return state.phase === 'closed' || (state.phase === 'merged' && state.level >= LAST_LEVEL)+}++function lerp(from: number, to: number, t: number): number {+ return from + (to - from) * Math.min(1, Math.max(0, t))+}++function trackSpeed(state: GameState): number {+ return lerp(TRACK_SPEED_START, TRACK_SPEED_MAX, state.elapsedMs / TRACK_SPEED_RAMP_MS) * levelOf(state).speed+}++function spawnInterval(state: GameState): number {+ return lerp(SPAWN_INTERVAL_START_MS, SPAWN_INTERVAL_MIN_MS, state.elapsedMs / SPAWN_RAMP_MS) * levelOf(state).spawn+}++/** Hazards crowd out the helpful items as the run goes on, and the merge queue is hazards only. */+function hazardShare(state: GameState): number {+ if (state.phase === 'queued') {+ return 1+ }+ return lerp(0.4, 0.7, state.elapsedMs / SPAWN_RAMP_MS)+}++function pick<T>(options: T[], random: number): T {+ return options[Math.min(options.length - 1, Math.floor(random * options.length))]+}++export function moveLane(state: GameState, delta: number): GameState {+ if (isOver(state) || state.phase === 'merged') {+ return state+ }+ const lane = Math.min(LANE_COUNT - 1, Math.max(0, state.lane + delta))+ return lane === state.lane ? state : { ...state, lane }+}++function applyItem(state: GameState, kind: ItemKind): GameState {+ if (state.phase === 'queued') {+ if (ITEMS[kind].good) {+ return { ...state, score: state.score + 25, lastEvent: `${ITEMS[kind].label} while queued` }+ }+ return {+ ...state,+ phase: 'coding',+ progress: QUEUE_KICK_PROGRESS,+ queueMs: 0,+ ciGreen: false,+ lastEvent: `Kicked out of the merge queue by ${ITEMS[kind].label.toLowerCase()}`,+ }+ }++ switch (kind) {+ case 'approval':+ return {+ ...state,+ approvals: Math.min(REQUIRED_APPROVALS, state.approvals + 1),+ score: state.score + 25,+ lastEvent: 'Approved',+ }+ // The label exists to stand in for a missing required review, so it fills the whole bar at once.+ case 'stamphog':+ return {+ ...state,+ approvals: REQUIRED_APPROVALS,+ score: state.score + 75,+ lastEvent: 'Stamped by stamphog',+ }+ case 'ci_green':+ return { ...state, ciGreen: true, score: state.score + 25, lastEvent: 'CI passed' }+ case 'rebase':+ return {+ ...state,+ staleness: 0,+ ciGreen: false,+ score: state.score + 25,+ lastEvent: 'Rebased onto master, CI has to run again',+ }+ case 'trunk_merge':+ if (isMergeable(state) && state.progress >= 100) {+ return { ...state, phase: 'queued', queueMs: 0, score: state.score + 50, lastEvent: 'Enqueued' }+ }+ return {+ ...state,+ score: state.score + 10,+ lastEvent: 'The queue refused a pull request that is not ready',+ }+ case 'conflict':+ return {+ ...state,+ progress: Math.max(0, state.progress - CONFLICT_PROGRESS_COST),+ ciGreen: false,+ lastEvent: 'Merge conflict, rebase and rerun CI',+ }+ case 'flake':+ return { ...state, ciGreen: false, lastEvent: 'A flaky test went red' }+ case 'stale':+ return {+ ...state,+ staleness: state.staleness + 1,+ approvals: Math.max(0, state.approvals - 1),+ lastEvent: 'Stale bot dismissed a review',+ }+ case 'changes_requested':+ return { ...state, approvals: 0, lastEvent: 'A reviewer requested changes' }+ }+}++/**+ * Advance the game by one frame. Pure, so the caller owns both the clock and the randomness:+ * the scene passes real deltas and `Math.random`, tests pass fixed ones.+ */+export function step(state: GameState, dtMs: number, random: () => number): GameState {+ if (isOver(state) || state.phase === 'merged' || dtMs <= 0) {+ return state+ }++ let next: GameState = { ...state, elapsedMs: state.elapsedMs + dtMs }++ const speed = trackSpeed(next)+ const moved: Item[] = []+ for (const item of next.items) {+ const x = item.x - speed * (dtMs / 1000)+ if (x <= HIT_X) {+ if (item.lane === next.lane) {+ next = applyItem(next, item.kind)+ }+ continue+ }+ moved.push({ ...item, x })+ }+ next.items = moved++ next.spawnTimerMs += dtMs+ const interval = spawnInterval(next)+ if (next.spawnTimerMs >= interval) {+ next.spawnTimerMs -= interval+ const kinds = levelOf(next).kinds+ const bad = random() < hazardShare(next)+ // Once the PR is only waiting to be enqueued, every helpful tile is the command that enqueues it.+ // Leaving it to chance would make the last stretch a wait rather than a run.+ const pool =+ isAwaitingQueue(next) && !bad+ ? ['trunk_merge' as ItemKind]+ : kinds.filter((kind) => ITEMS[kind].good !== bad)+ next.items = [+ ...next.items,+ {+ id: next.nextItemId,+ kind: pick(pool, random()),+ lane: pick(LANES, random()),+ x: 1,+ },+ ]+ next.nextItemId += 1+ }++ if (next.staleness >= STALENESS_LIMIT) {+ return { ...next, phase: 'closed', lastEvent: 'Closed as stale' }+ }++ if (next.phase === 'coding') {+ // The last level holds at full progress until a /trunk merge tile arrives, so the score stops+ // with the bar. Otherwise a player could wait there and collect for as long as they dodge.+ if (isMergeable(next) && next.progress < 100) {+ next.progress = Math.min(100, next.progress + (dtMs / PROGRESS_MS_TO_FULL) * 100)+ next.score += dtMs / 100+ }+ if (next.progress >= 100 && !levelOf(next).needsTrunkMerge) {+ next.phase = 'queued'+ next.queueMs = 0+ next.lastEvent = 'Enqueued'+ }+ } else if (next.phase === 'queued') {+ next.queueMs += dtMs+ if (next.queueMs >= QUEUE_HOLD_MS) {+ next.phase = 'merged'+ next.score += 500+ next.lastEvent = 'Merged'+ }+ }++ return next+}diff --git a/products/games/manifest.tsx b/products/games/manifest.tsxindex 4a1a4dafed2c..1606456724c0 100644--- a/products/games/manifest.tsx+++ b/products/games/manifest.tsx@@ -17,14 +17,22 @@ export const manifest: ProductManifest = {projectBased: true,activityScope: 'Games',},+ ShipIt: {+ name: 'Ship It',+ import: () => import('./frontend/ShipIt/ShipIt'),+ projectBased: true,+ activityScope: 'Games',+ },},routes: {'/games/368hedgehogs': ['Game368Hedgehogs', 'game368Hedgehogs'],'/games/flappyhog': ['FlappyHog', 'flappyHog'],+ '/games/shipit': ['ShipIt', 'shipIt'],},urls: {game368hedgehogs: (): string => `/games/368hedgehogs`,flappyHog: (): string => `/games/flappyhog`,+ shipIt: (): string => `/games/shipit`,},treeItemsGames: [{@@ -35,5 +43,9 @@ export const manifest: ProductManifest = {path: 'Flappy Hog',href: '/games/flappyhog',},+ {+ path: 'Ship It',+ href: urls.shipIt(),+ },],}diff --git a/products/games/package.json b/products/games/package.jsonindex 4736f4300ca8..35930d3746af 100644--- a/products/games/package.json+++ b/products/games/package.json@@ -5,8 +5,12 @@"kea-loaders": "catalog:","kea-router": "catalog:"},+ "devDependencies": {+ "@testing-library/react": "^14.3.1"+ },"peerDependencies": {"@posthog/icons": "catalog:",+ "@testing-library/react": "*","@types/react": "*","clsx": "*","fuse.js": "*",diff --git a/services/mcp/src/tools/links/app-url-manifest.json b/services/mcp/src/tools/links/app-url-manifest.jsonindex 6a7946d69b70..7641ef1e5f03 100644--- a/services/mcp/src/tools/links/app-url-manifest.json+++ b/services/mcp/src/tools/links/app-url-manifest.json@@ -1429,6 +1429,11 @@"params": ["shareToken"],"scope": "project"},+ "shipIt": {+ "template": "/games/shipit",+ "params": [],+ "scope": "project"+ },"signup": {"template": "/signup","params": [],diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.jsonindex 019a53ea0fd2..758b7ee570ff 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json@@ -13,7 +13,7 @@"type": "object"},"url": {- "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-gateway\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/billing/authorization_status\n/business-knowledge\n/business-knowledge/settings\n/canvas\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/loop/{loopId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/customer_analytics/tasks\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/tiles/{tileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors/{handle}\n/engineering-analytics/health\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/test-health\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/error_tracking/{id}/fingerprints\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/link/{id}\n/links\n/live-debugger\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-registry\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/overview\n/replay-vision/{id}/self-driving\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/organization-authentication/{feature}/{configId}\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/themes/custom-css\n/toolbar\n/tracing\n/unsubscribe\n/user_research\n/user_research/{id}\n/user_research/{topicId}/response/{responseId}\n/verify_email\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/content-autopilot\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard/runs\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",+ "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-gateway\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/billing/authorization_status\n/business-knowledge\n/business-knowledge/settings\n/canvas\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/loop/{loopId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/customer_analytics/tasks\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/tiles/{tileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors/{handle}\n/engineering-analytics/health\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/test-health\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/error_tracking/{id}/fingerprints\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/games/shipit\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/link/{id}\n/links\n/live-debugger\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-registry\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/overview\n/replay-vision/{id}/self-driving\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/organization-authentication/{feature}/{configId}\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/themes/custom-css\n/toolbar\n/tracing\n/unsubscribe\n/user_research\n/user_research/{id}\n/user_research/{topicId}/response/{responseId}\n/verify_email\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/content-autopilot\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard/runs\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}","type": "string"}},