Repository navigation
Description
The TypeScript SDK CI job asserts pre-decollision jcode strings while production already emits kcode. Every hit in sdk/typescript/test/ was classified before being touched — not every jcode string is stale, and several are load-bearing public contracts.
Bucket A — fixed: the test asserted a value production no longer produces
| File:line | Old | New | Production proof |
|---|---|---|---|
sdk/typescript/test/pipe-name.test.ts:19 |
|| "jcode" |
|| "kcode" |
sdk/typescript/src/sockets.ts:56 — transportEndpoint() uses || "kcode"; mirrored by crates/jcode-transport/src/windows.rs:15 (unwrap_or("kcode")) and :22 (if stem.is_empty() { "kcode" }) |
sdk/typescript/test/pipe-name.test.ts:53 |
/^\\\\\.\\pipe\\jcode-[0-9a-f]{16}$/ |
...\\pipe\\kcode-... |
same — this assertion exists specifically to pin the empty-stem fallback |
This was a silent divergence: the test keeps its own copy of the pipe derivation (it must, being TypeScript against a Rust implementation), and the test's copy still used jcode. The suite was green while asserting a value production had already stopped producing — it was pinning a contract that no longer existed. Fixed so the parity check is real again.
Bucket B — fixed: decollision artifact fixture paths
| File:line | Old | New | Rationale |
|---|---|---|---|
sdk/typescript/test/launch.test.ts:54 |
not-a-jcode-instance- |
not-a-kcode-instance- |
arbitrary mkdtemp name, no production contract. Matches the jcode-* → kcode-* tmpdir rename already done in #148 (jcode-sdk-instance- → kcode-sdk-instance-, jcode-precious-test- → kcode-precious-test-, etc.). #148 missed this one because it does not start with a bare jcode-. |
Bucket A (non-gating) — fixed: stale binary names in opt-in live scripts
These .mjs scripts are dev tooling, not in the npm test glob (test/*.test.ts), but they name a binary that no longer exists:
| File:line | Old | New | Production proof |
|---|---|---|---|
test/live-launch.mjs:18, test/live-isolation.mjs:19, test/live-options.mjs:18 |
process.argv[2] ?? "jcode" |
?? "kcode" |
sdk/typescript/src/binary.ts:5 — resolveKcodeBinary() default is "kcode" |
test/live-launch.mjs:124 |
pgrep -cf 'jcode --provider auto serve' |
'kcode ...' |
Cargo.toml:112 — [[bin]] name = "kcode" (:2 [package] name = "kcode") |
test/live-text-framing.mjs:14 |
target/selfdev/jcode |
target/selfdev/kcode |
same Cargo.toml bin name |
live-launch.mjs:10, live-isolation.mjs:10, live-options.mjs:10, live-text-framing.mjs:5, live-tools.mjs:1,9 |
usage prose | kcode |
same |
Deliberately NOT changed (Bucket C)
These look like stale jcode but are live contracts. Changing them would break production parity:
| File:line | String | Why it stays |
|---|---|---|
launch.test.ts:208 |
jcode_not_found |
Stable public error code. sdk/typescript/src/launch.ts:727 throws exactly new HarnessError("jcode_not_found", ...). Mirrored by crates/jcode-sdk/src/errors.rs:56 (Self::JcodeNotFound => "jcode_not_found"). Renaming it would break every caller branching on the code. |
launch.test.ts:237,261, live-options.mjs:5,37,40,49, live-tools.mjs:12 |
jcodeHome |
SDK option name, unchanged in production. sdk/typescript/src/launch.ts:163 still declares jcodeHome?: string (and :209 on the result type). The SDK has no kcodeHome. Renaming would be a breaking API change. |
error-docs.test.ts:11 |
../../../crates/jcode-harness-api/src/events.rs |
The crate directory is literally named jcode-harness-api in this repo. |
schema-parity.test.ts:23 |
../../../crates/jcode-harness-api/src |
same crate directory name. |
pipe-name.test.ts:7,12,25,38 |
jcode-transport |
The Rust crate is literally named jcode-transport. |
pipe-name.test.ts:30,31,33,45,46 |
.../jcode/run/jcode-api.sock → \\.\pipe\jcode-api-<hash> |
The pipe stem is derived from the input path, not hardcoded. These literal pairs are pinned identically on the Rust side by crates/jcode-transport/src/windows.rs:455-470 (pipe_name_matches_the_typescript_sdk). The two languages must agree exactly; renaming one side breaks Windows. |
product-isolation.test.ts (all jcode uses) |
JCODE_HOME, JCODE_BINARY, .jcode, jcode-api.sock, binary: "jcode" |
This file's entire purpose is asserting that legacy jcode homes/binaries/sockets are rejected (cross_product_path). The jcode strings are the negative fixtures. |
live-tools.mjs:15 |
JCODE_DISABLE_TELEMETRY |
Dead either way — no such var in the Rust sources, and no KCODE_DISABLE_TELEMETRY handler exists. Renaming would imply a handler that does not exist. |
live-tools.mjs:6,11, live-text-framing.mjs:6 |
JCODE_SDK_TEST_BINARY, JCODE_SCRATCH_DIR |
Script-local env vars, self-contained within the .mjs file. Not a production contract. |
launch.test.ts:178,184,193, live-launch.mjs:97,100,105,112,118, live-isolation.mjs:6,7 |
prose / test titles | Not assertions. Left alone to keep the diff reviewable. |
Validation
Suite run clean-room: TMPDIR=/tmp and a cwd outside any jcode-marked path, because sdk/typescript/src/product.ts:9 (assertKcodePath) rejects any path component matching ^jcode(?:[.-].*)?$ — and this machine sets TMPDIR=~/.jcode/scratch.
- Before: 82 tests, 81 pass, 1 fail
- After: 82 tests, 81 pass, 1 fail (unchanged — no regressions)
npm run typecheck: exit 0
The one remaining failure is pre-existing and unrelated: launch.test.ts:130 "login inheritance creates file links" fails only on macOS. sdk/typescript/src/launch.ts:226 returns ~/Library/Application Support/kcode on darwin and ignores XDG_CONFIG_HOME, but the test writes its fixture under $XDG_CONFIG_HOME. It passes on Linux CI. Not touched here — it is a platform-conditional test, not a decollision staleness.
Note the earlier TypeScript SDK failure on client.test.ts:284 (/jcode api-bridge/) was already fixed by a71d26eb5.
Activity
fix(sdk/typescript): use kcode binary and path names so the SDK tests…