Repository navigation
Description
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 assertKcodePathRoot 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 prefixessdk/typescript/test/launch.test.ts— 8 prefixes/binarysdk/typescript/test/live-options.mjs— 2 prefixessdk/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 touchedlaunch.test.ts:54not-a-jcode-instance-segment — descriptive label, segment does not match guard regexerror-docs/schema-parity/parity.test.tsreferences tocrates/jcode-harness-api— upstream Rust crate name preservedproduct-isolation.test.ts.jcode/jcode-api.sockstrings — these are the negative tests of the guard itselferror.code === 'jcode_not_found'assertions — the public product error code
Reference
docs/sessions/2026-10-18-resume-reland/00_SESSION_OVERVIEW.md
Activity