Skip to content

test: C2c — lock the host, exit and control behavior; delete pointless tests - #1370

Closed
gewenyu99 wants to merge 1 commit into
posthog/functional-c2b-headlessfrom
posthog/functional-c2c-control
Closed

gewenyu99 wants to merge 1 commit into
posthog/functional-c2b-headlessfrom
posthog/functional-c2c-control

Conversation

@gewenyu99

@gewenyu99 gewenyu99 commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The logic in #1313 gives each host one job: runProgram runs a program on its session store, the TUI and headless hosts resolve an exit code, and only the CLI exits. Tools run on their own through runTuiTool. Those behaviors need tests that fail when they break. Some older tests only check what the compiler already guarantees, or compare a literal with itself. They cost review time and lock nothing.

Changes

This PR adds the tests for the behavior #1313 introduces, and deletes the tests that lock nothing. It touches test files only. The suite goes from 3,260 to 3,515 tests.

  • Exit codes: src/tui/__tests__/screen-exits.test.tsx drives every screen to its exit by keyboard and checks the code it passes to requestExit. src/tui/__tests__/run.test.ts covers runTuiTool, Ctrl-C exiting 130, and an abort resolving once its outro is dismissed.
  • Program runs: src/tui/__tests__/run-program-on-screens.test.ts covers runProgramOnScreens. src/headless/__tests__/run.test.ts covers a headless run, including a signal resolving 143.
  • Control: src/headless/control/__tests__/server.test.ts, src/tui/control/__tests__/control.test.ts and src/programs/session/__tests__/control.test.ts check that sessionControlTarget routes every public store method, and that partial control refuses setters.
  • CLI: src/cli/__tests__/mcp-cli.test.ts covers mcpCommand, control-flags.test.ts covers the control flags, and src/cli/runners/__tests__/signals.test.ts covers how signals end a run.
  • Tools: runDoctorReport and addMcpServer resolve 0 or 1 (src/tools/doctor/__tests__/report.test.ts, src/tools/mcp/__tests__/console.test.ts).
  • Flows and state: tuiWorkflow, AGENT_SKILL_STEPS, the program and tool flows, logIn, missingOAuthScopes, extractZipArchive and extractBundle (zip-slip is rejected).
  • Release smoke: src/agent/__tests__/warlock-smoke.no-jest.ts scans one fixture per category with the real @posthog/warlock package.
  • Typed mocks: vi.mock(import('…')) replaces string paths in the touched tests, so a mock whose path stops resolving fails to compile.
  • Deletions: across the stack, 158 pointless tests go. They checked compiler-guaranteed shapes, compared a literal with itself, duplicated another test, checked prompt prose, or tested machinery that no longer exists. Examples here: src/agent/__tests__/commandments.test.ts, src/shared/errors/__tests__/codes.test.ts, part of handoff-schema-parity.test.ts, and the stale snapshots for post-auth-gates and flow-traces.
Kind Files Lines Review
New test files 44 +5,346 read
New cases in existing test files 4 +98/-6 read
Typed mocks and small edits 36 +103/-137 mechanical
Deleted tests and snapshots 10 -297 read
Total 94 +5,547/-440

Stack: #1311 moves, #1369 contracts, #1313 logic, #1370 tests, #1315 fences, #1371 docs.

Test plan

On this PR's tree:

Created with PostHog Desktop

@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci ai-observability
  • /wizard-ci basic-integration
  • /wizard-ci feature-flags
  • /wizard-ci mcp-analytics
  • /wizard-ci replay-vision
  • /wizard-ci revenue
  • /wizard-ci self-driving
  • /wizard-ci warehouse
  • /wizard-ci warehouse-seeded

Test an individual app:

  • /wizard-ci ai-observability/anthropic
  • /wizard-ci ai-observability/google-adk
  • /wizard-ci ai-observability/groq
Show more apps
  • /wizard-ci ai-observability/manual-capture
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/opentelemetry
  • /wizard-ci ai-observability/vercel-ai
  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/flutter
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci feature-flags/django
  • /wizard-ci feature-flags/next-js
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci replay-vision/javascript-node
  • /wizard-ci replay-vision/next-js
  • /wizard-ci replay-vision/react-vite
  • /wizard-ci revenue/stripe
  • /wizard-ci self-driving/astro
  • /wizard-ci self-driving/fastapi
  • /wizard-ci self-driving/nuxt
  • /wizard-ci self-driving/react-router
  • /wizard-ci self-driving/sveltekit
  • /wizard-ci warehouse/monorepo-env
  • /wizard-ci warehouse/multi-source-next
  • /wizard-ci warehouse/stripe-node
  • /wizard-ci warehouse/zero-source
  • /wizard-ci warehouse-seeded/next-stripe
  • /wizard-ci warehouse-seeded/next-stripe-declined

Test against a Context Mill branch:

  • /wizard-ci all context-mill:my-branch

Add context-mill:<branch> to any command above to pin the Context Mill branch. It defaults to main.

Results will be posted here when complete.

@gewenyu99
gewenyu99 added this pull request to stack #1372 September 27, 2026 15:28
Tests for the previous PR's behavior. Tests that only restated types, literals or other tests are deleted.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
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.

1 participant