Skip to content

Add deterministic CLI E2E smoke layer + CI#47

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/cli-e2e-smoke-tests
Draft

Add deterministic CLI E2E smoke layer + CI#47
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/cli-e2e-smoke-tests

Conversation

@posthog

@posthog posthog Bot commented Jul 22, 2026

Copy link
Copy Markdown

Summary

The only CLI-level checks were the two live scripts in scripts/, which dispatch real vendor sessions and need ANTHROPIC_API_KEY / JULES_API_KEY — so they can't run in CI and nobody could safely verify the polyagent entrypoint before shipping. There was also no CI at all.

This adds a deterministic, key-free smoke/E2E layer that drives the real commander entrypoint (src/cli.ts via tsx) as a subprocess, plus a CI workflow.

  • POLYAGENT_STATE_PATH override (src/config.ts) so tests isolate state to a temp file instead of mutating ~/.polyagent/state.json.
  • POLYAGENT_FAKE_ADAPTERS test seam (src/registry.ts + src/adapters/fake.ts) — a deterministic in-memory adapter with no keys or network, so the CLI can run end-to-end.
  • test/cli.e2e.test.ts — covers the deterministic validation branches (--vendor required, Jules --repo required, empty-state status) and a full dispatch → persist → status → followup happy path against the fakes.
  • .github/workflows/ci.yml — runs npm run build + npm test on every push and PR.
  • README + test:e2e script documenting how to run it locally.

Why

Tracked as Linear PK-282: regressions in CLI wiring, argument validation, and state handling could ship unnoticed because nothing exercised the actual entrypoint without real vendor keys. This gives ongoing regression safety with a check that runs in CI.

Test plan

  • npm test → 41 tests pass (35 existing unit + 6 new E2E)
  • npm run build → clean
  • npm run test:e2e → 6 E2E tests pass
  • The live scripts/smoke-*.ts are unchanged and still require keys.

Created with PostHog Code from this inbox report.

Adds a key-free, deterministic smoke/E2E layer that drives the real
commander entrypoint (`src/cli.ts` via tsx) as a subprocess and wires
up CI so CLI regressions get caught before shipping.

- `POLYAGENT_STATE_PATH` override in config so tests isolate state to a
  temp file instead of mutating `~/.polyagent/state.json`.
- `POLYAGENT_FAKE_ADAPTERS` test seam in the registry returning a
  deterministic in-memory adapter (no keys, no network).
- `test/cli.e2e.test.ts` covering the deterministic validation branches
  (`--vendor` required, Jules `--repo` required, empty-state status) and
  a full dispatch → persist → status → followup happy path against fakes.
- `.github/workflows/ci.yml` running build + full test suite on push/PR.
- README + `test:e2e` script documenting how to run it locally.

Why: the only CLI-level checks were live scripts that dispatch real
vendor sessions and need API keys, so nobody could safely verify the
CLI entrypoint before shipping (Linear PK-282).

Generated-By: PostHog Code
Task-Id: eae35fc3-1e75-413c-bebb-f140ebc531ae
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
polyagent Ready Ready Preview, Comment Jul 22, 2026 5:02am

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.

0 participants