fix(npm): honor codewhaleBinaryVersion in installer (#3769)#3774
Conversation
`install.js` resolved the binary version from legacy env vars and `deepseekBinaryVersion`, skipping `pkg.codewhaleBinaryVersion`, while `run.js` and `verify-release-assets.js` already honor it. That let install-time asset resolution disagree with runtime and release verification on packaging-only npm releases. - `resolvePackageVersion` now resolves `pkg.codewhaleBinaryVersion` before `deepseekBinaryVersion` and `pkg.version`, matching the sibling scripts. - Legacy `DEEPSEEK_TUI_VERSION` / `DEEPSEEK_VERSION` precedence is unchanged. - Parameterized `(pkgObj, env)` for testability and exported it via `_internal`. - Adds a precedence test covering codewhaleBinaryVersion > deepseekBinaryVersion > pkg.version, with env vars still taking top precedence. Fixes #3769
|
Claude finished @Hmbown's task in 1m 9s —— View job Code Review
Summary: Clean, targeted fix. The logic is correct and the test coverage is solid. A few minor observations below — none are blockers. Correctness ✓
Minor observations
const binVersion =
pkg.codewhaleBinaryVersion || pkg.deepseekBinaryVersion || pkg.version;This function doesn't consult Block comment at Five lines is on the verbose side given the codebase's comment style. The test already serves as executable documentation for the precedence contract. Not a blocking concern. Test coverage All five precedence levels are covered. One combination not explicitly tested: VerdictApprove. The fix is correct, the injectable-args pattern makes the function properly testable, and the precedence test documents the full contract. The |
Summary
Closes #3769.
npm/codewhale/scripts/install.jswas the only wrapper path that skippedpkg.codewhaleBinaryVersion, so install-time asset resolution could disagree withrun.jsandverify-release-assets.js.Changes
resolvePackageVersion()precedence is nowDEEPSEEK_TUI_VERSION→DEEPSEEK_VERSION→pkg.codewhaleBinaryVersion→pkg.deepseekBinaryVersion→pkg.version, matching the sibling scripts.(pkgObj = pkg, env = process.env)for injectable testing and exported via_internal.Validation
node --test npm/codewhale/test/install.test.js→ 10 passed (incl. new precedence test).node --test test/*.test.js) → 32 passed.Acceptance criteria
pkg.codewhaleBinaryVersionbefore legacy +pkg.version