Skip to content

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

fix(terminal): restore neovim with manifest-aware install tests (#106738)

Marius Andra1b9d0cb6fc4d
diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.yml
index 426530fecd7b..e81bfc3986b8 100644
--- a/.github/workflows/ci-frontend.yml
+++ b/.github/workflows/ci-frontend.yml
@@ -395,7 +395,7 @@ jobs:
# cwd because `pnpm --filter=@posthog/frontend exec` runs from there.
CHANGED_FILES=$(
awk '
- /\.(ts|tsx|js|jsx|mjs|cjs)$/ {
+ /\.(ts|tsx|js|jsx|mjs|cjs|json)$/ {
if ($0 ~ /^frontend\//) {
sub(/^frontend\//, "", $0)
print
diff --git a/docs/internal/ci-things-already-tried.md b/docs/internal/ci-things-already-tried.md
index fac287534b7c..c77baed6950b 100644
--- a/docs/internal/ci-things-already-tried.md
+++ b/docs/internal/ci-things-already-tried.md
@@ -213,6 +213,7 @@ Read the comment at the top of `.github/workflows/ci-backend.yml` for the curren
The jest and Playwright suites made the same move later, so `ready_for_review` no longer buys a full matrix anywhere.
Selection now runs on drafts and ready PRs alike in `ci-backend.yml`, `ci-frontend.yml`, `ci-storybook.yml`, and `ci-e2e-playwright.yml`, and the merge queue's `trunk-merge/**` run is the only full gate.
+Jest selection includes imported JSON files, such as terminal package manifests, because changes to data can break their consumers without changing TypeScript.
What still differs by draft state is the fallback when a selection cannot be trusted: a draft skips the suite and defers to its ready run, a ready PR takes the full matrix because no later run on that PR would cover it.
_Also asked as:_ snob, is test selection on, why does CI run all the tests, do we select tests on PRs
diff --git a/frontend/src/scenes/terminal/posthogFilesystem.ts b/frontend/src/scenes/terminal/posthogFilesystem.ts
index 655cf7ded54c..5d92e72395d5 100644
--- a/frontend/src/scenes/terminal/posthogFilesystem.ts
+++ b/frontend/src/scenes/terminal/posthogFilesystem.ts
@@ -117,7 +117,7 @@ open [path] opens a project file or folder in PostHog. With no path, it opens th
current folder. JSON files open their PostHog item, including files in /posthog/api.
Folders open in the Files tab when the simple side panel is enabled.
-Optional tools download on first use: node, pi, nyancat, and doom.
+Optional tools download on first use: nvim, node, pi, nyancat, and doom.
In Doom, W/S move, A/D strafe, left/right arrows turn, Space fires, E opens doors,
and Shift runs. Use Capture mouse to turn with the mouse; left-click fires.
@@ -173,6 +173,8 @@ Files are limited to 4 MiB. Use Ctrl+C to interrupt, Tab to complete, and the
mouse wheel for scrollback. Run busybox to see the installed Unix utilities.
jq 1.8.2 is installed for JSON queries and formatting.
nano 8.4 edits text with syntax highlighting. Ctrl+S saves; Ctrl+X exits.
+nvim installs Neovim on first use. Run nvim file to edit, press i to insert text,
+then Escape to return to normal mode. :w saves; :q quits.
mc opens Midnight Commander. Tab switches panels; F3 views, F4 edits, F10 quits.
Use Escape then a digit if your browser or keyboard captures function keys.
mcview, mcedit, and mcdiff also run directly from the shell.
diff --git a/frontend/src/scenes/terminal/terminal-packages.json b/frontend/src/scenes/terminal/terminal-packages.json
index 16b391979450..aee8628846aa 100644
--- a/frontend/src/scenes/terminal/terminal-packages.json
+++ b/frontend/src/scenes/terminal/terminal-packages.json
@@ -85,6 +85,19 @@
"commands": {
"nyancat": "/opt/posthog-packages/nyancat-1.5.2-r1/bin/nyancat"
}
+ },
+ "neovim": {
+ "name": "Neovim",
+ "version": "0.11.1-r1",
+ "file": "archives/neovim-0.11.1-r1-linux-i386.tar.gz",
+ "sha256": "afa616ab23afac13f33f8a1a45a0025e5892f49be879aca05ec3fa1db25e09b6",
+ "size": 9490313,
+ "archiveSize": 33024000,
+ "dependencies": [],
+ "commands": {
+ "nvim": "/opt/posthog-packages/neovim-0.11.1-r1/bin/nvim"
+ },
+ "baseUrl": "https://raw.githubusercontent.com/PostHog/terminal-assets/b6267668fd1f5cfbb431f19f6b834b79a75265c4"
}
},
"baseUrl": "https://raw.githubusercontent.com/PostHog/terminal-assets/745b60735f92fd480ff3aaf712b28c99ddd3221d",
diff --git a/frontend/src/scenes/terminal/terminalPackages.test.ts b/frontend/src/scenes/terminal/terminalPackages.test.ts
index a9ef51f1adb2..4d7089b9f126 100644
--- a/frontend/src/scenes/terminal/terminalPackages.test.ts
+++ b/frontend/src/scenes/terminal/terminalPackages.test.ts
@@ -2,7 +2,7 @@ import { spawnSync } from 'node:child_process'
import { createHash } from 'node:crypto'
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
-import { join } from 'node:path'
+import { dirname, join, relative } from 'node:path'
import manifest from './terminal-packages.json'
import { TerminalFilesystem } from './terminalFilesystem'
@@ -122,11 +122,16 @@ describe('optional terminal packages', () => {
)
}
for (const dependency of [...pkg.dependencies, id]) {
+ const dependencyPackage = packages[dependency]
const stage = join(directory, dependency)
- mkdirSync(join(stage, 'bin'), { recursive: true })
- writeFileSync(join(stage, 'bin', dependency), '#!/bin/sh\nprintf "launched:%s\\n" "$@"\n', {
- mode: 0o700,
- })
+ for (const entrypoint of new Set(Object.values(dependencyPackage.commands))) {
+ const executable = join(
+ stage,
+ relative(`/opt/posthog-packages/${dependency}-${dependencyPackage.version}`, entrypoint)
+ )
+ mkdirSync(dirname(executable), { recursive: true })
+ writeFileSync(executable, '#!/bin/sh\nprintf "launched:%s\\n" "$@"\n', { mode: 0o700 })
+ }
expect(
spawnSync('tar', ['-cf', join(mount, 'packages', `${dependency}.tar`), '-C', stage, '.']).status
).toBe(0)
@@ -134,12 +139,17 @@ describe('optional terminal packages', () => {
const run = (): ReturnType<typeof spawnSync> =>
spawnSync('/bin/sh', [join(mount, 'bin', command), 'two words'], { encoding: 'utf8' })
const first = run()
- expect(first.status).toBe(0)
- expect(first.stderr).toContain(`Starting ${command}...\n`)
- expect(first.stdout).toContain('launched:two words\n')
+ expect(first).toMatchObject({
+ status: 0,
+ stderr: expect.stringContaining(`Starting ${command}...\n`),
+ stdout: expect.stringContaining('launched:two words\n'),
+ })
const repeated = run()
- expect(repeated.status).toBe(0)
- expect(repeated.stderr).toBe('')
+ expect(repeated).toMatchObject({
+ status: 0,
+ stderr: '',
+ stdout: expect.stringContaining('launched:two words\n'),
+ })
rmSync(join(installed, `${id}-${pkg.version}`), { recursive: true })
const archivePath = join(mount, 'packages', `${id}.tar`)
@@ -151,8 +161,11 @@ describe('optional terminal packages', () => {
expect(failed.stdout).toBe('')
writeFileSync(archivePath, archive)
const retry = run()
- expect(retry.status).toBe(0)
- expect(retry.stderr).toContain(`Starting ${command}...\n`)
+ expect(retry).toMatchObject({
+ status: 0,
+ stderr: expect.stringContaining(`Starting ${command}...\n`),
+ stdout: expect.stringContaining('launched:two words\n'),
+ })
} finally {
rmSync(directory, { recursive: true, force: true })
}