Skip to content

refactor: port typing-lag CI test to the v2 socket client#71

Merged
arzafran merged 1 commit into
mainfrom
refactor/lag-test-v2-client
Jul 8, 2026
Merged

refactor: port typing-lag CI test to the v2 socket client#71
arzafran merged 1 commit into
mainfrom
refactor/lag-test-v2-client

Conversation

@arzafran

@arzafran arzafran commented Jul 8, 2026

Copy link
Copy Markdown
Member

What this does

The typing-lag regression test that runs in CI (tests-build-and-lag job) was the last CI-gated python test still talking to the app through the old v1 socket protocol. This points it at the v2 JSON client instead, so v1's line-protocol client can eventually be deleted without breaking CI.

Summary

  • tests/test_workspace_churn_up_arrow_lag.py now imports cmux/cmuxError from tests_v2/ instead of tests/cmux.py.
  • list_workspaces() / list_surfaces() row shapes are identical between the v1 and v2 clients, so the test's tuple destructuring (for _index, wid, _title, _selected in ...) needed no changes.
  • The v2 client doesn't ship a send_line() convenience method (it mirrors most, but not all, of v1's API), so a small local send_line() helper was added to the test file — kept out of tests_v2/cmux.py to keep this diff scoped to one file.
  • RawSocketClient, used only for the tight simulate_shortcut latency-measurement loop, was ported from v1's raw plaintext framing to v2's one-JSON-object-per-line protocol ({"id", "method", "params"} request / {"id", "ok", "result"} response), calling debug.shortcut.simulate. The warm-up-then-measure loop shape (5 warm-up calls, then N timed round trips via time.perf_counter(), same optional inter-call delay) is unchanged, so latency numbers stay comparable to prior runs.
  • keep_only_first_workspace()'s retry-on-"not found" loop is preserved; v2's error text (not_found: Workspace not found) still contains "not found" case-insensitively, same as v1's "ERROR: Tab not found", so the existing match logic covers both.
  • .github/workflows/ci.yml needed no changes — it invokes the same file path with the same PROGRAMA_SOCKET_PATH env var, which both clients honor.

Test Plan

  • python3 -c "import ast; ast.parse(open('tests/test_workspace_churn_up_arrow_lag.py').read())" — syntax OK
  • Imported the module the way CI would load it and confirmed cmux resolves to tests_v2/cmux.py (not tests/cmux.py)
  • This test needs a live Programa instance and this repo's policy forbids running it locally — the `tests-build-and-lag" CI job on this PR is the real proof it still passes.

This was the last CI-gated consumer of the v1 line-protocol client
(tests/cmux.py). Points the import at tests_v2/cmux.py instead and ports
the RawSocketClient used for the tight simulate_shortcut latency loop
from v1 plaintext framing to v2's one-JSON-object-per-line protocol.

The warm-up + measured-loop shape is unchanged (5 warm-up calls, then N
timed round trips via perf_counter, same optional inter-call delay), so
latency thresholds stay comparable to prior CI runs.

list_workspaces()/list_surfaces() row shapes matched exactly between v1
and v2 clients, so the test's tuple destructuring needed no changes.
seed_history() needed a small local send_line() helper since the v2
client mirrors most of v1's API but doesn't ship that one convenience
method — added to the test file rather than tests_v2/cmux.py to keep
the diff scoped to this one file.

Part of the v1-protocol-deletion sequence: after this, no CI-gated code
depends on the v1 client.
@arzafran arzafran merged commit 816d154 into main Jul 8, 2026
8 checks passed
arzafran added a commit that referenced this pull request Jul 8, 2026
The v1 socket-protocol python test suite in tests/ (driven by tests/cmux.py)
is superseded by tests_v2/, which now has full protocol parity. Deletes 85
files from tests/ plus scripts/run-tests-v1.sh (the manual VM runner for the
retired suite).

Two tests/ files stay because they're CI-wired in .github/workflows/ci.yml
and don't depend on the v1 protocol:
- test_cli_version_memory_guard.py (no socket protocol, standalone)
- test_workspace_churn_up_arrow_lag.py (ported to the v2 client in #71)

Also preserved: the CI/release-infrastructure guard scripts in tests/ (they
guard workflow/build/release config, not app socket behavior, so they're
unrelated to the v1 protocol) and tests/fixtures/ssh-remote, which tests_v2/
depends on.

Fixes the one stale living reference to the deleted layout in
docs/v2-api-migration.md. Dated historical changelog/checklist entries in
TODO.md, PROJECTS.md, and docs/agent-browser-port-spec.md that record past
VM validation runs are left untouched as historical record.

Part of the v1-protocol-deletion sequence (step 5).
arzafran added a commit that referenced this pull request Jul 8, 2026
The v1 socket-protocol python test suite in tests/ (driven by tests/cmux.py)
is superseded by tests_v2/, which now has full protocol parity. Deletes 85
files from tests/ plus scripts/run-tests-v1.sh (the manual VM runner for the
retired suite).

Two tests/ files stay because they're CI-wired in .github/workflows/ci.yml
and don't depend on the v1 protocol:
- test_cli_version_memory_guard.py (no socket protocol, standalone)
- test_workspace_churn_up_arrow_lag.py (ported to the v2 client in #71)

Also preserved: the CI/release-infrastructure guard scripts in tests/ (they
guard workflow/build/release config, not app socket behavior, so they're
unrelated to the v1 protocol) and tests/fixtures/ssh-remote, which tests_v2/
depends on.

Fixes the one stale living reference to the deleted layout in
docs/v2-api-migration.md. Dated historical changelog/checklist entries in
TODO.md, PROJECTS.md, and docs/agent-browser-port-spec.md that record past
VM validation runs are left untouched as historical record.

Part of the v1-protocol-deletion sequence (step 5).
arzafran added a commit that referenced this pull request Jul 8, 2026
v2 JSON-RPC is now the only socket protocol. All consumers were migrated
first (CLI in #74, shell integration in #72, tests in #71/#73; the remote
daemon was already v2-only), so this deletes the v1 line dispatch itself
and everything that only existed to serve it.

- TerminalController.processCommand now dispatches JSON unconditionally;
  a non-JSON line gets a terse v1_removed error instead of being routed
  to the old space-delimited command switch.
- Deletes the v1 switch (~90 cases) and every handler function that
  becomes unreferenced, plus their v1-only parsing helpers
  (parseOptions/parseOptionsNoStop, resolveTabForReport,
  withReportTargetSurface, upsertSidebarMetadata/clearSidebarMetadata/
  listSidebarMetadata, schedulePanelMetadataMutation,
  parseReadScreenArgs). Debug handlers that v2's debug.* methods reuse
  as their implementation core (setShortcut, simulateShortcut,
  activateApp, isTerminalFocused, readTerminalText, renderStats,
  layoutDebug, bonsplit/empty-panel/flash counters,
  focusFromNotification, panelSnapshot(Reset), captureScreenshot) are
  kept, since they're still live v2 entry points, not v1 relics.
  Self.socketFastPathState and tailTerminalLines/
  readTerminalTextBase64(terminalPanel:) stay too - v2 surface-telemetry
  and screen-read methods depend on them directly.
- auth was already a connection-level preamble (authResponseIfNeeded,
  handled before any protocol dispatch) supporting both a raw
  auth-plus-password line and v2 auth.login; only the CLI's raw-line
  call needed migrating, which this does (auth.login now).
- Removes the now-unreachable isV2:false focus-intent allowlist
  (focusIntentV1Commands) and updates the one unit test that exercised
  it directly to cover the v2 equivalent instead.
- Docs: v2-api-migration.md collapses to a short removal note plus the
  v1->v2 name mapping (kept for reference); socket-focus-steal-audit.todo.md
  and agent-browser-port-spec.md get historical annotations; CLAUDE.md's
  socket-threading-policy examples are reworded to v2 method names.

TerminalController.swift: 12834 -> 9615 lines (-3219). Net repo diff:
+156/-3410 across 7 files.

Breaking change: any external script or tool that still speaks the old
space-delimited socket protocol directly (rather than through the CLI)
will now get a v1_removed JSON error instead of a response. Use the CLI
or the v2 JSON-RPC protocol described in docs/v2-api-migration.md.
@arzafran arzafran deleted the refactor/lag-test-v2-client branch July 10, 2026 16:05
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