Skip to content

feat(terminal): open folders from files menus - #106321

Merged
trunk-io[bot] merged 6 commits into
masterfrom
feat/terminal-folder-menu
Sep 25, 2026
Merged

trunk-io[bot] merged 6 commits into
masterfrom
feat/terminal-folder-menu

Conversation

@mariusandra

@mariusandra mariusandra commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Files users cannot send a folder to an already-open terminal from its menu.

Changes

  • Folder menus show Open in terminal while the terminal is docked or visible on its full page.
  • Selecting the action changes the terminal's working directory and focuses it after the menu closes.
  • Starred folders use their original path, and the existing busy-terminal protection prevents commands from interrupting running programs.
Menu without the action Menu with the action
Before After

How did you test this code?

  • Menu tests cover visibility and nested, starred, and root folder targets.
  • Chromium exercised the ellipsis menu against a running Linux guest, including pwd, keyboard focus, and three desktop widths.
  • Local validation included terminal lifecycle tests, TypeScript, lint, formatting, and CI preflight.
  • Native-JSON event-table coverage does not apply to this navigation change.

Release status

  • No feature flag controls this change
  • This change is behind a feature flag and is not available to users
  • This change makes a previously flagged feature available to everyone

The existing posthog-terminal flag controls access.

Automatic notifications

  • Publish to changelog?

Docs update

Updated the existing project structure guide.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Codex, GPT-6

Skills: debugging-ci-failures, writing-ui-components, writing-tests, writing-kea-logics, writing-user-facing-copy, writing-code-comments, setting-feature-flags-in-storybook, running-ci-preflight, writing-pr-descriptions, and reviewing-with-coderabbit.
Tools: shell, Playwright, and GitHub CLI. No shareable session link is available.

CodeRabbit CLI was signed out, so this PR opens without a local CodeRabbit pass.
Open-PR searches found no duplicate folder-menu action.
Screenshots contain synthetic project data.

CI follow-up: replaced menu role/name queries with focused visible-text queries to satisfy the Jest performance rule.

@mariusandra mariusandra self-assigned this Sep 24, 2026
@trunk-io

trunk-io Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

✅ Trunk lane — non-backend lane

This PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes.

⚠️ Complexity (TypeScript) — 3 functions above the limit (max 94)

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
MenuItems frontend/src/layout/panel-layout/ProjectTree/menus/MenuItems.tsx:68 94 10
followFolder frontend/src/scenes/terminal/terminalLogic.ts:286 14 10
start frontend/src/scenes/terminal/terminalLogic.ts:433 13 10
✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

⚠️ Bundle size — 🔺 +9.8 KiB (+0.0%)

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

Total: 68.43 MiB · 🔺 +9.8 KiB (+0.0%)

File Size Δ vs base
render-query/src/render-query/render-query.js 20.22 MiB 🔺 +2.1 KiB (+0.0%)

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.57 MiB · 22 files no change █████████░ 85.1% of 1.84 MiB
logged-out boot: index + App + bootApp (preloaded by every page, including /login)
src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
3.57 MiB · 628 files no change █████████░ 88.6% of 4.03 MiB
authenticated shell (every logged-in page)
src/scenes/AuthenticatedShell.tsx
7.52 MiB · 2,438 files 🔺 +809 B (+0.0%) ████████░░ 79.1% of 9.51 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
🟢 src/lib/lemon-ui/LemonMarkdown/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/RichContentEditor/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/CodeSnippet/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/taxonomy/core-filter-definitions-by-group.json 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
🟢 [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/index.tsx
1.3 KiB src/RootErrorBoundary.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
301.8 KiB ../node_modules/.pnpm/posthog-js@1.434.12_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
267.6 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
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
100.4 KiB src/lib/api.ts
84.8 KiB src/products.tsx
69.1 KiB src/lib/lemon-ui/icons/icons.tsx
63.9 KiB src/lib/utils/eventUsageLogic.ts
38.7 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
28.3 KiB src/scenes/scenes.ts
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
Size File
301.8 KiB ../node_modules/.pnpm/posthog-js@1.434.12_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
271.7 KiB src/taxonomy/core-filter-definitions-by-group.json
267.6 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
153.7 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
100.4 KiB src/lib/api.ts
98.5 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
84.8 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.37 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.37 MiB · 19 files no change ████░░░░░░ 41.4% of 5.72 MiB
Deferred (lazy) 2.10 MiB · 44 files no change n/a — loads on demand
Loader dist/toolbar.js 1.2 KiB no change █░░░░░░░░░ 6.0% of 19.5 KiB
Largest eagerly-shipped chunks
Size File
789.7 KiB dist/toolbar/toolbar-app-DOHPZZZY.css
650.6 KiB dist/toolbar/chunk-chunk-EFWVPDHD.js
483.6 KiB dist/toolbar/chunk-chunk-6HO2X7TC.js
138.3 KiB dist/toolbar/chunk-chunk-BP7N3IC6.js
131.8 KiB dist/toolbar/chunk-chunk-FDH2IBXT.js
75.2 KiB dist/toolbar/toolbar-app-RUTTRATA.js
69.0 KiB dist/toolbar/chunk-chunk-TSAL54PB.js
35.6 KiB dist/toolbar/chunk-chunk-D3MNVOY2.js
21.0 KiB dist/toolbar/chunk-chunk-3PHFUQAU.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 — 🔺 +41.8 KiB (+0.0%)

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

Total: 1554.78 MiB · 🔺 +41.8 KiB (+0.0%)

⚠️ Playwright — 1 flaky

🎭 Playwright report · View test results →

⚠️ 1 flaky test:

  • Add a new person property (chromium)

These issues are not necessarily caused by your changes.
Annoyed by this section? Help fix flakies and failures and it will go green!

@mariusandra
mariusandra marked this pull request as ready for review September 24, 2026 21:57
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦔 Hogbox preview · ❌ build failed

The preview didn't come up for commit a4a240a. 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.

@posthog

posthog Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦔 PostHog Review reviewed this pull request

Found 0 must fix, 2 should fix, 0 consider.

Published 2 findings (view the review).

Resolved comments: 2 fixed, 2 already settled

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: PostHog/posthog/.coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: 678e4ed5-2709-4fc4-bfb4-e730b8dda497

📥 Commits

Reviewing files that changed from the base of the PR and between fada6a4 and 1f3d1de.

📒 Files selected for processing (3)
  • frontend/src/scenes/terminal/terminalDockLogic.ts
  • frontend/src/scenes/terminal/terminalLogic.test.ts
  • frontend/src/scenes/terminal/terminalLogic.ts

Limit details: You’ve used all 12 included reviews currently available.


📝 Walkthrough

Walkthrough

Folder menus now offer Open in terminal for eligible folders when the terminal is enabled and the dock is open or the current route is the terminal route. Selecting the action requests the folder path in the terminal. Terminal logic follows non-null folder requests and focuses the terminal after a 100 ms delay when it remains enabled and the dock is open or the current route is the terminal route. Tests cover path selection, action visibility, and folder navigation. The handbook documents the action.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 1f3d1

Folder requests made while the terminal starts are retained and applied once it is ready. No actionable merge-blocking issue is established.

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description is complete and stand-alone. It covers the user problem, visible changes, screenshots, automated and manual testing, feature-flag release status, documentation, and agent context.
✨ Finishing Touches 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (1)
frontend/src/layout/panel-layout/ProjectTree/menus/MenuItems.tsx-173-173 (1)

173-173: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep the dock closed after opening a folder from /terminal.

The full-page terminal remains visible and receives focus. However, openInTerminal sets dockOpen to true even when the dock was closed. The dock is hidden only on /terminal, so it can appear after navigation to another route.

Add a /terminal branch that keeps dockOpen false, preserves the existing followFolder behavior through a non-dock trigger, and focuses the full-page terminal after the menu closes. Add a click test for this case. Do not only remove setDockOpen(true), because that action currently triggers folder handling.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: PostHog/posthog/.coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: 0dee3727-9e76-4297-a249-9bbece215413

📥 Commits

Reviewing files that changed from the base of the PR and between 7052550 and fada6a4.

📒 Files selected for processing (4)
  • docs/published/handbook/engineering/project-structure.md
  • frontend/src/layout/panel-layout/ProjectTree/menus/MenuItems.test.tsx
  • frontend/src/layout/panel-layout/ProjectTree/menus/MenuItems.tsx
  • frontend/src/scenes/terminal/terminalDockLogic.ts

Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@greptile-apps

greptile-apps Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Retrigger

The PR appears safe to merge, though the full-page action can unexpectedly reveal the dock on the next page.

Reviews (1) · Last reviewed commit: "feat(terminal): open folders from files ..."

@posthog

posthog Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

PostHog Review alpha 🦔 If you find any issues helpful - please reply "valid", "invalid", etc., for evaluation purposes 🙏

@posthog posthog Bot left a comment

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.

PostHog Review

Found 2 should fix.

@posthog posthog Bot removed the reviewhog label Sep 24, 2026
…ll page

A folder request now triggers the terminal's folder change directly, so openInTerminal no longer opens the dock to trigger it. On the full-page terminal the dock stays closed and does not appear on the next page. An already open dock is not reopened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: b46c2d82-d2f2-4a61-b0ae-8ab037c81181
The folder test now checks that the terminal gets focus after a folder request, both in the open dock and on the full-page terminal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: b46c2d82-d2f2-4a61-b0ae-8ab037c81181
@trunk-io

trunk-io Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

Failed Test Failure Summary Logs
personalAPIKeysLogic preserves the `*` (all access) scope regardless of flag state The test failed because it could not find the specified path 'layout.navigation-3000.themeLogic' in the store. Logs ↗︎

View Full Report ↗︎ ⋅ Docs

@mariusandra mariusandra added the stamphog Request AI approval (no full review) label Sep 24, 2026
stamphog[bot]

This comment was marked as outdated.

@posthog

posthog Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Visual changes approved by @mariusandra — baseline updated in a4a240a.

View this run in PostHog

2 changed.

2 updated
Run: 0baea095-8c7e-46ff-8540-7ba05fe0db44

Co-authored-by: mariusandra <53387+mariusandra@users.noreply.github.com>
@stamphog
stamphog Bot dismissed their stale review September 24, 2026 23:26

A new stamphog review started for this PR — the fresh verdict replaces this approval.

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved.

Contained frontend feature behind an existing feature flag with test coverage; the dock-reveal issue CodeRabbit and Greptile flagged is addressed in the current diff (isTerminalPage guard) and covered by new tests, and no risky territory is touched.

  • Author wrote 60% of the modified lines and has 85 merged PRs in these paths (familiarity MODERATE).
  • 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 59L, 4F substantive, 134L/7F incl. docs/generated/snapshots — within ceiling
tier ✓ T1-agent / T1c-medium (134L, 7F, two-areas, feat)
stamphog 2.1.0 .stamphog/policy.yml @ a4a240a · reviewed head a4a240a

@trunk-io
trunk-io Bot merged commit 47948ca into master Sep 25, 2026
219 checks passed
@trunk-io
trunk-io Bot deleted the feat/terminal-folder-menu branch September 25, 2026 00:20
@deployment-status-posthog

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

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-09-25 00:51 UTC Run
prod-us ✅ Deployed 2026-09-25 01:02 UTC Run
prod-eu ✅ Deployed 2026-09-25 01:03 UTC Run

This branch had an error being deployed

1 failed deployment
preview-pr-106321 — a4a240a8 Deployed Sep 24, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant