Skip to content

fix(sdk/typescript): rename jcode-prefixed test fixture paths so assertKcodePath stops rejecting them #147

Done

Description

@KooshaPari

Summary

The assertKcodePath guard in sdk/typescript/src/product.ts rejects any path segment matching /^(?:jcode(?:[.-].*)?|\.jcode.*)$/iu. After the kcode rebrand (PR #33), several test fixtures in sdk/typescript/test/*.test.ts still hard-code jcode--prefixed temp paths (e.g. jcode-sdk-test-..., jcode-definitely-not-installed, jcode-precious-test-). When the SDK CI job creates these temp dirs, assertKcodePath throws cross_product_path and the test fails. This is the root cause of the failures breaking the "Node 20 TypeScript SDK" job in .github/workflows/ci.yml:118-159.

Repro

cd sdk/typescript
npm ci --no-audit --no-fund
# on master: many failing tests, including all of:
#   - sdk/typescript/test/mock-harness.ts:30
#   - sdk/typescript/test/client.test.ts:285, 302
#   - sdk/typescript/test/launch.test.ts:26, 65, 84, 118, 131, 203, 225, 255
#   - sdk/typescript/test/live-options.mjs:21, 38
# all of which throw cross_product_path from assertKcodePath

Root cause

The fixture temp-dir prefixes were not renamed when src/product.ts was added during the kcode rebrand. The guard regex jcode[.-].* matches any path segment whose name starts with jcode followed by - or .. jcode-sdk-test- satisfies that. The guard is correct; the fixtures are the bug.

Fix

Rename ONLY the test fixture prefixes to kcode--prefixed peers so the temp dirs no longer trip assertKcodePath. The guard regex, src/product.ts, and every other source file are untouched.

Files changed:

  • sdk/typescript/test/client.test.ts — 2 prefixes
  • sdk/typescript/test/launch.test.ts — 8 prefixes/binary
  • sdk/typescript/test/live-options.mjs — 2 prefixes
  • sdk/typescript/test/mock-harness.ts — 1 prefix

Validation

With TMPDIR=/tmp (simulating CI on ubuntu-latest):

Before fix After fix
121 fail / 22 pass 9 fail / 78 pass

The 9 remaining failures are 4 unique tests that fail on master too. They assert against product text strings that already say kcode (e.g. Start the bridge with kcode api-bridge in client.ts:138). They are pre-existing and out of scope for the fixture fix; they will be addressed in a follow-up.

Out of scope (left alone on purpose)

  • src/** — no product source touched
  • launch.test.ts:54 not-a-jcode-instance- segment — descriptive label, segment does not match guard regex
  • error-docs/schema-parity/parity.test.ts references to crates/jcode-harness-api — upstream Rust crate name preserved
  • product-isolation.test.ts .jcode / jcode-api.sock strings — these are the negative tests of the guard itself
  • error.code === 'jcode_not_found' assertions — the public product error code

Reference

docs/sessions/2026-10-18-resume-reland/00_SESSION_OVERVIEW.md

Activity

  1. added
    bug
    on Oct 19, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions