Skip to content

chore(wizard): snapshot cloud worker commands - #97061

Merged
trunk-io[bot] merged 1 commit into
masterfrom
posthog/wizard-command-snapshots
Sep 9, 2026
Merged

trunk-io[bot] merged 1 commit into
masterfrom
posthog/wizard-command-snapshots

Conversation

@fercgomes

Copy link
Copy Markdown
Contributor

Problem

Reviewers need readable snapshots to check changes to the cloud Wizard command.

Why: This addresses the command review request. It follows the Wizard UI layer.

Refs #85854

Changes

  • Adds text snapshots for default, audit, debug, and local-source commands.
  • Shows the exact command and its decoded script, including paths with spaces and quotes.
  • Changes no runtime behavior.

How did you test this code?

Ran hogli test products/wizard/backend/tests/runs/test_wizard_command.py and hogli ci:preflight --fix.

Automatic notifications

  • Publish to changelog?

Docs update

None. This change adds tests only.

🤖 Agent context

Autonomy: Human-driven (agent-assisted).

Codex used GitHub, shell tools, and PostHog MCP. Skills: /writing-tests, /stacking-prs, /writing-pr-descriptions, and /asd-ste100.


Created with PostHog Desktop

@fercgomes fercgomes self-assigned this Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane (py:product:wizard)

This PR is assigned to the backend Python lane (py:product:wizard). It runs backend Python tests and may merge in parallel with PRs in other lanes.

⚠️ Complexity (TypeScript) — 10 functions above the limit (max 31)

Cyclomatic complexity above the limit in changed typescript files (10 for production files, 15 for test files). Warn only: worth simplifying when you next touch these functions.

Function Location Complexity Limit
onFailure frontend/src/initKea.ts:139 31 10
WizardRunDetailsDrawer products/wizard/frontend/runs/WizardRunDetailsDrawer.tsx:32 29 10
SceneTitleSection frontend/src/layout/scenes/components/SceneTitleSection.tsx:233 28 10
LemonTag frontend/src/lib/lemon-ui/LemonTag/LemonTag.tsx:49 26 10
SceneName frontend/src/layout/scenes/components/SceneTitleSection.tsx:445 22 10
WizardProgramDetails products/wizard/frontend/library/WizardProgramDetails.tsx:9 22 10
SceneDescription frontend/src/layout/scenes/components/SceneTitleSection.tsx:659 21 10
WizardRepositoryPicker products/wizard/frontend/library/WizardRepositoryPicker.tsx:8 13 10
WizardRunsScene products/wizard/frontend/WizardRunsScene.tsx:27 11 10
wizardRunCurrentState products/wizard/frontend/wizardRunDisplay.ts:81 11 10
✅ Bundle size — no change

Uncompressed size of every built .js bundle, compared against the base branch.

Total: 68.38 MiB · no change

No file changed by more than 1000 B.

Posted automatically by build-bundle-size-report · uncompressed bytes from dist-report

✅ Eager graph — within budget

How much code each root ships on the eager path — downloaded and parsed before the surface is interactive. Measured from the esbuild output chunks (post-tree-shake, static imports only); lazy import() / React.lazy chunks are not counted.

Root Eager (shipped) Δ vs base Budget
entry (logged-out pages, app bootstrap)
src/index.tsx
1.50 MiB · 22 files no change ███░░░░░░░ 33.3% of 4.51 MiB
logged-out boot: index + App + bootApp (preloaded by every page, including /login)
src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
5.25 MiB · 668 files no change █████████░ 93.2% of 5.63 MiB
authenticated shell (every logged-in page)
src/scenes/AuthenticatedShell.tsx
7.68 MiB · 2,680 files no change █████████░ 87.5% of 8.77 MiB

🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 node_modules/monaco-editor/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/layout/navigation-3000/navigationLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/scenes/dashboard/dashboardLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 node_modules/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx

Largest files eagerly shipped from src/index.tsx
Size File
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
24.6 KiB ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
6.3 KiB ../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
4.5 KiB ../node_modules/.pnpm/@jspm+core@2.1.0/node_modules/@jspm/core/nodelibs/browser/process.js
3.9 KiB ../node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/cjs/scheduler.production.min.js
1.4 KiB ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
1.3 KiB src/RootErrorBoundary.tsx
1.0 KiB src/index.tsx
912 B ../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
854 B src/scenes/ChunkLoadErrorBoundary.tsx
Largest files eagerly shipped from src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
Size File
281.8 KiB ../node_modules/.pnpm/posthog-js@1.428.6_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
267.7 KiB ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
255.4 KiB src/taxonomy/core-filter-definitions-by-group.json
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
104.2 KiB src/lib/api.ts
79.3 KiB src/products.tsx
68.8 KiB src/lib/lemon-ui/icons/icons.tsx
62.8 KiB src/lib/utils/eventUsageLogic.ts
38.8 KiB ../node_modules/.pnpm/@dnd-kit+core@6.0.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@dnd-kit/core/dist/core.esm.js
33.9 KiB ../node_modules/.pnpm/kea@4.0.0-pre.6_patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5_react@18.3.1/node_modules/kea/lib/index.cjs.js
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
Size File
281.8 KiB ../node_modules/.pnpm/posthog-js@1.428.6_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
267.7 KiB ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
255.4 KiB src/taxonomy/core-filter-definitions-by-group.json
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
104.2 KiB src/lib/api.ts
95.8 KiB ../packages/quill/packages/quill/dist/index.js
93.3 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
90.6 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
79.3 KiB src/products.tsx

Posted automatically by check-eager-graph · sizes are eager output bytes (shipped, post-tree-shake) from the esbuild metafile · part of #32479

✅ Toolbar bundle — eager 2.29 MiB within budget

What the toolbar ships to customer pages, measured from the esbuild output (minified, post-tree-shake). The eager set is the entry plus everything statically imported from it — fetched before any feature runs; deferred chunks load lazily. The eager guardrail is 5.72 MiB. Each output file must also stay below 10 MB, where CloudFront stops compressing it. The module boundary is enforced separately by check-toolbar-graph.

Metric Size Δ vs base Budget
Eager (shipped)
entry + static imports
2.29 MiB · 18 files no change ████░░░░░░ 40.1% of 5.72 MiB
Deferred (lazy) 2.11 MiB · 45 files no change n/a — loads on demand
Loader dist/toolbar.js 1.1 KiB no change █░░░░░░░░░ 5.8% of 19.5 KiB
Largest eagerly-shipped chunks
Size File
759.5 KiB dist/toolbar/toolbar-app-YDVAPMJ7.css
608.9 KiB dist/toolbar/chunk-chunk-2OPWD7HV.js
484.7 KiB dist/toolbar/chunk-chunk-APDVCVEO.js
136.6 KiB dist/toolbar/chunk-chunk-4R573Y2N.js
131.8 KiB dist/toolbar/chunk-chunk-FDH2IBXT.js
72.2 KiB dist/toolbar/toolbar-app-I5RO4O5R.js
69.0 KiB dist/toolbar/chunk-chunk-TSAL54PB.js
35.6 KiB dist/toolbar/chunk-chunk-X2KTLKIH.js
21.0 KiB dist/toolbar/chunk-chunk-TAA54327.js
6.8 KiB dist/toolbar/chunk-chunk-DV7IWQNF.js

Posted automatically by check-toolbar-size · sizes are toolbar output bytes (shipped, post-tree-shake) from the esbuild metafile

✅ Dist folder size — no change

Total size of the built frontend/dist folder (all assets), compared against the base branch.

Total: 1464.08 MiB · no change

✅ Playwright — all passed

All tests passed.

View test results →

@fercgomes
fercgomes added this pull request to stack #91827 September 8, 2026 23:58
@fercgomes
fercgomes marked this pull request as ready for review September 9, 2026 00:01
@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

🦔 Hogbox preview · ❌ build failed

The preview didn't come up for commit c1cf30e. See the build log for the failing step. It'll retry on the next push.

Previews are optional and never block merging. A failure here is often a hogland or tailnet hiccup rather than anything in your PR, so the check stays green and this comment is the status.

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested review from a team, MattBro and rafaeelaudibert and removed request for a team September 9, 2026 00:03
@pr-assigner-resolver-posthog

Copy link
Copy Markdown

👀 Auto-assigned reviewers

These soft owners were skipped because they only have minor changes here. Nothing blocks merge, so self-assign if you'd like a look:

  • @PostHog/team-devex (owners.yaml)

Soft owners come from each directory's owners.yaml and each product's product.yaml (resolved nearest-file-wins). The locator after each owner is the file that decided it. Generated files and lockfiles are ignored when deciding ownership.

@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
### Issue 1
posthog/settings/web.py:496-497
**Deployment wiring is missing**

This adds the `WIZARD_RUN_CREATE_THROTTLE_RATE` and `WIZARD_RUN_READ_THROTTLE_RATE` environment overrides. Repository policy requires new environment variables to also be added to the PostHog charts repository and configured through PostHog secrets so they can take effect in production. `LOCAL_WIZARD_ROOT` in `posthog/settings/temporal.py` should be evaluated under the same requirement if it is intended outside local development. This requirement must be satisfied before merging.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "chore(wizard): snapshot cloud worker com..." | Re-trigger Greptile

Comment thread posthog/settings/web.py Resolved
if params.environment == WizardRunEnvironment.CLOUD:
self._validate_cloud_creation(request)
try:
result = wizard_facade.create_run_with_result(params)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Low: Cloud-run limits are not atomic

An authenticated project member can send parallel cloud-run requests with distinct idempotency keys; each transaction can observe no active run before any insert commits, allowing all of them to dispatch sandboxes. Add an atomic per-user reservation before creation, or enforce the single-active-run invariant with a database constraint or lock; the DRF throttle does not protect this concurrency boundary.

@veria-ai

veria-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

PR overview

This PR updates the Wizard cloud-run backend to snapshot cloud worker commands.

One concurrency issue remains: an authenticated project member can submit parallel requests with distinct idempotency keys to bypass the single-active-run limit and dispatch multiple sandboxes. This enables deliberate resource consumption within the affected project, and no issues have yet been addressed.

Open issues (1)

Fixed/addressed: 0 · PR risk: 5/10

@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
### Issue 1
products/wizard/backend/presentation/permissions.py:12
**Local agents are blocked**

The new class-level permission requires browser `SessionAuthentication` for every run action, including local run creation and updates. If the local Wizard agent uses the existing Bearer/PAK authentication path, these requests receive a 403, so the documented local-agent lifecycle cannot work. Keep the browser-session restriction for cloud creation while allowing the authenticated local-agent credential path for local lifecycle requests.

### Issue 2
products/wizard/backend/logic/reconciliation/service.py:147-175
**Cleanup rows lack claims**

The reconciliation sweep selects cleanup candidates without atomically claiming them before starting cleanup. Because periodic invocations can overlap, two workers can select the same `ACTIVE` or `PENDING` row, increment its cleanup attempts, measure usage, and destroy the same sandbox. This can duplicate usage reporting, consume the retry budget early, and leave cleanup status dependent on the last writer. Claim each worker with a conditional update or lock before the external operation; the dispatch and cancellation sweeps need the same serialization guarantee.

### Issue 3
products/wizard/frontend/wizardLibraryLogic.ts:200-205
**Registry results are truncated**

The registry loader requests only the first 100 programs and discards the pagination metadata. If the personalized registry exceeds one page, later programs and required-program entries silently disappear from search and selection even though the backend exposes a paginated collection. Follow `response.next` as the run loader does, or make the backend contract explicitly unpaginated.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (2): Last reviewed commit: "chore(wizard): snapshot cloud worker com..." | Re-trigger Greptile

@posthog

posthog Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

👋 Visual changes detected for this PR.

Review and approve in PostHog Visual Review

If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix.

@trunk-io

trunk-io Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

@fercgomes
fercgomes force-pushed the posthog/wizard-command-snapshots branch from c1cf30e to ab0bf3c Compare September 9, 2026 12:14
@fercgomes
fercgomes force-pushed the posthog/wizard-command-snapshots branch from ab0bf3c to 9e1cf4a Compare September 9, 2026 12:44
Base automatically changed from feat/wizard-run-ui to master September 9, 2026 15:04
@trunk-io

trunk-io Bot commented Sep 9, 2026

Copy link
Copy Markdown

Stacked PR 97062 was cancelled: a user cancelled it.

@trunk-io

trunk-io Bot commented Sep 9, 2026

Copy link
Copy Markdown

Stacked PR 97063 was cancelled: a user cancelled it.

@trunk-io

trunk-io Bot commented Sep 9, 2026

Copy link
Copy Markdown

Stacked PR 97063 failed testing in the merge queue. Please investigate the failure and re-submit the stack.

Generated-By: PostHog Desktop
Task-Id: db8d273e-cb3c-458f-a8b1-0a0029054305
@fercgomes
fercgomes force-pushed the posthog/wizard-command-snapshots branch from 9e1cf4a to d9d1184 Compare September 9, 2026 16:29
@trunk-io

trunk-io Bot commented Sep 9, 2026

Copy link
Copy Markdown

This pull request is queued for merge as part of 97063, which will merge 97061, 97062, 97063.

@trunk-io
trunk-io Bot merged commit 68c7ba4 into master Sep 9, 2026
193 checks passed
@trunk-io
trunk-io Bot deleted the posthog/wizard-command-snapshots branch September 9, 2026 18:05
@trunk-io

trunk-io Bot commented Sep 9, 2026

Copy link
Copy Markdown

This pull request was merged into master as part of stacked PR 97063.

@deployment-status-posthog

deployment-status-posthog Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-09-09 18:24 UTC Run
prod-us ✅ Deployed 2026-09-09 18:37 UTC Run
prod-eu ✅ Deployed 2026-09-09 18:41 UTC Run

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.

2 participants