2code icon indicating copy to clipboard operation
2code copied to clipboard

Task 1: Verify the Herdr integration contract

Open AkaraChen opened this issue 2 months ago • 0 comments

Summary

Establish the concrete, versioned Herdr integration contract required by parent plan #394. Produce reproducible evidence that the selected release supports the migration’s terminal and workspace requirements before later tasks depend on it.

Dependencies: None.

Work to complete

  1. Pin and inspect a release

    • Select an exact Herdr release; record its version, source commit, download URLs, target triples, checksums and license.
    • Download and verify the executable as a Tauri sidecar candidate in an isolated fixture.
    • Inspect the release’s bundled schema and CLI interfaces. Record the exact requests, responses, events and terminal commands used; distinguish verified behavior from documentation claims.
  2. Exercise server startup and lifetime

    • Start a server in a dedicated test namespace with isolated state and a disposable repository.
    • Record startup arguments, endpoint discovery, readiness and version/capability detection.
    • Disconnect and exit the client; verify that the server and running terminal survive.
    • Reconnect to the same server. Separately exercise server restart and document its recovery guarantees without treating restored sessions as preserved live processes.
  3. Verify terminal transport

    • Create and enumerate a terminal; exercise writable control and read-only observation, input, resize, scrollback, detach/release and reconnect.
    • Attach competing clients to establish controller exclusivity, conflict responses and control release behavior.
    • Record framing, encoding, message boundaries, frame ordering, initial attachment and reconnect behavior. Establish whether terminal frames are incremental output, full redraws or another representation, and how an xterm.js consumer must apply them.
    • Check Unicode, ANSI colors, alternate-screen applications and terminal query responses. Record history limits and implications for scrolling and search.
    • Identify the supported transport for subsequent implementation, including whether a pinned CLI helper is required.
  4. Verify workspace/worktree lifecycle

    • Create a workspace and worktree in the disposable repository.
    • Adopt an existing checkout and an externally created worktree containing uncommitted changes; verify that adoption preserves their contents and does not recreate them.
    • Repeat discovery/adoption to establish duplicate-handling behavior.
    • Exercise removal and record effects on terminals, workspace records, branches and checkout directories, including dirty-worktree refusal or retention behavior.
    • Record workspace, tab and pane identity stability across enumeration, detach/reconnect, rename and server restart.
  5. Define external split mapping and capability limits

    • Create splits outside 2code and observe their identities and lifecycle events.
    • Define the supported mapping from Herdr workspaces/tabs/panes to 2code profiles/terminal tabs, including how every supported pane is exposed, selected, reattached and removed.
    • State whether split layout is preserved, flattened or unsupported; document identity rules and behavior when external panes disappear.
    • Produce a platform/capability matrix covering macOS and the existing experimental Linux/Windows targets, including release artifacts and Unix socket/Windows named-pipe transport.
    • Record shell, working-directory, environment, startup-command, agent-state and subscription capabilities needed by later tasks.
    • Mark each capability as verified, unsupported or unverified. Turn missing prerequisites into linked blocking sub-issues before dependent implementation proceeds.

Likely files and directories

  • New: docs/herdr-integration.md — pinned release, protocol contract, platform matrix, split mapping, reproduction instructions and capability decisions.
  • New: src-tauri/crates/infra/tests/herdr_contract.rs — small, explicitly invoked integration probe against the pinned executable.
  • New: src-tauri/crates/infra/tests/fixtures/herdr/ — representative schema excerpts and sanitized request/response/frame fixtures.
  • If necessary: src-tauri/crates/infra/Cargo.toml — minimal test-only support.

Downloaded binaries and disposable runtime state remain outside tracked source. Production sidecar configuration belongs to Task 3.

Estimated changes: 200–400 lines total, additions plus deletions, including tests and fixtures; excluding generated files, lockfile churn and binary artifacts. Material scope growth should become a separate issue.

Acceptance criteria

  • [ ] An exact release and checksum-verified sidecar candidate are documented; reproduction does not depend on latest.
  • [ ] The bundled schema and chosen control/terminal interfaces are tied to that release.
  • [ ] Reproducible commands and captured evidence cover startup, control/observe, resize, scrollback, detach and reconnect.
  • [ ] Client exit preserves the server and live terminal; server restart behavior is documented separately.
  • [ ] Frame semantics, controller conflicts, history behavior and identity stability are explicit enough to implement Tasks 5, 10–12 without guessing.
  • [ ] Workspace creation, existing-checkout/worktree adoption and removal are exercised only against disposable fixtures, with filesystem effects recorded.
  • [ ] Externally created splits have an explicit, verified mapping and lifecycle policy.
  • [ ] Platform coverage distinguishes executed checks from documentation-only or unavailable verification.
  • [ ] Every required capability gap has a linked blocking issue; unresolved prerequisites are not represented as a passing contract.
  • [ ] Another developer can rerun the probe using documented prerequisites and clean up its processes, endpoints and temporary state.
  • [ ] The targeted probe passes against the pinned release. Run cargo test --workspace from src-tauri if Rust code or manifests change; frontend lint, typecheck and tests apply only if frontend scope is introduced.
  • [ ] The contract records a clear proceed/block decision for dependent tasks.

Out of scope

  • Production binary acquisition, Tauri bundling, signing or release CI.
  • Runtime interfaces, production server management, socket bridge or frontend transport.
  • Database migrations, migration switches, user-profile adoption or rollback implementation.
  • Terminal UI changes or split-layout implementation.
  • Replacing PTY ownership, agent detection or workspace management.
  • Removing legacy code, changing the default runtime or implementing remote operation.
  • Fixing upstream capability gaps within this task.

AkaraChen avatar Sep 14 '26 03:09 AkaraChen