Skip to content

fix(jcode-transport): Windows pipe-name fallback test asserts a 'jcode-' prefix that production never produces #162

Done

Description

@KooshaPari

Problem

crates/jcode-transport/src/windows.rs has two sources of truth for the pipe-name stem, and they disagree in the empty-stem case:

  • Production (path_to_pipe_name): falls back to the stem "kcode" — both via unwrap_or("kcode") and via the empty-after-filter branch.
  • Test (pipe_name_falls_back_when_stem_is_empty): asserts the result starts with \\.\pipe\jcode-.

The assertion can therefore never pass.

Exact derivation trace

  1. Path::new("...").file_stem() returns Some("..") (the file name is ..., so the stem is the last two dots).
  2. The character filter keeps only ASCII alphanumerics, - and _. Both dots are dropped, so the filtered stem is the empty string.
  3. The empty branch yields the fallback "kcode".
  4. Production output: \\.\pipe\kcode-<hash>.

The test asserts jcode-. It would fail on every Windows run.

Why it is latent

  • crates/jcode-transport/src/lib.rs gates the module with #[cfg(windows)] mod windows;, so the test only compiles on Windows.
  • In .github/workflows/ci.yml the windows-build-test job is pinned if: false (hosted Actions minutes are capped at $0), so it is disabled.
  • .github/workflows/windows-smoke.yml is workflow_dispatch-only and does not run on pull requests.

Consequence: the broken assertion is invisible to CI today, and will break the moment either Windows path is re-enabled.

Scope

Only the fallback branch is wrong. The two pinned parity literals in pipe_name_matches_the_typescript_sdk (jcode-api-5e00c01702e8cfe4, jcode-52dfdb00b2f35a71) are user-visible socket names that are intentionally still jcode on the TypeScript side, and Rust's file_stem() and Node's path.win32.parse(p).name agree on both. They must NOT be renamed to kcode — that would break the cross-language parity contract.

Fix

Assert \\.\pipe\kcode- in pipe_name_falls_back_when_stem_is_empty. One line, in one file.

Acceptance

  • crates/jcode-transport/src/windows.rs is the only file changed.
  • pipe_name_matches_the_typescript_sdk is untouched.
  • The TypeScript SDK's own fallback (sdk/typescript/src/sockets.ts, || "kcode") and its test (sdk/typescript/test/pipe-name.test.ts, asserting kcode-) already agree with the Rust production path.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions