fix(credentials): version must be string "1" - #42
Merged
FlashingChen merged 4 commits intoAug 28, 2026
Merged
FlashingChen merged 4 commits into
FlashingChen merged 4 commits into
Conversation
FlashingChen
added a commit
that referenced
this pull request
Aug 28, 2026
- credentials-migration: 新增 dshSupportsVersioned() 版本感知,区分捆绑 0.1.1-rc.2 与系统 0.1.0-rc.6,避免在旧版 dsh 上误将 flat 迁移为 versioned 导致 harness 启动失败(TypeError version must be string / refs must be string) - 修复 parseVersion/compareVersion 仅比对 major.minor.patch,rc 视为满足 >=0.1.1;新增 bundledExecExists() 实测 runtime 是否存在,避免 win32 manifest 在 mac 上的误判 - 修复 backupAndMigrate 中 text! 非空断言与 catch e:unknown 的 TS 构建错误;修复 version: 1 数字误写 → "1" 的正则与备份逻辑 - renderer: flat 时不再隐藏 banner,改为提示可一键迁移并交由主进程版本感知决定;unknown 时提供"尝试修复"按钮,避免半成品交付 - 核验: flat 在 0.1.0-rc.6 PATH 回退下保持可用,harness smoke 已通过(7s 就绪);versioned/string 修复与 flat→versioned 迁移逻辑已单元验证 - 关联反馈追踪:Workers 镜像 + 已读/轮询 + 社区 issues 已在同分支集成,主进程新增 feedback:status/issues/detail/open-issue 代理 Refs #42
- detectCredentialsFormat now treats string "1" as versioned (old code treated number 1 as versioned, causing mismatch with dsh 0.1.0-rc.6+ which expects string) - migrateFlat generates version: "1" instead of version: 1 - fixVersionStringIssue converts number 1 -> string "1" (was opposite) - aligns with upstream 0.1.1 renderFlatLayoutMigration Fixes Harness 连接失败: version/refs must be a string
- credentials-migration: 新增 dshSupportsVersioned() 版本感知,区分捆绑 0.1.1-rc.2 与系统 0.1.0-rc.6,避免在旧版 dsh 上误将 flat 迁移为 versioned 导致 harness 启动失败(TypeError version must be string / refs must be string) - 修复 parseVersion/compareVersion 仅比对 major.minor.patch,rc 视为满足 >=0.1.1;新增 bundledExecExists() 实测 runtime 是否存在,避免 win32 manifest 在 mac 上的误判 - 修复 backupAndMigrate 中 text! 非空断言与 catch e:unknown 的 TS 构建错误;修复 version: 1 数字误写 → "1" 的正则与备份逻辑 - renderer: flat 时不再隐藏 banner,改为提示可一键迁移并交由主进程版本感知决定;unknown 时提供"尝试修复"按钮,避免半成品交付 - 核验: flat 在 0.1.0-rc.6 PATH 回退下保持可用,harness smoke 已通过(7s 就绪);versioned/string 修复与 flat→versioned 迁移逻辑已单元验证 - 关联反馈追踪:Workers 镜像 + 已读/轮询 + 社区 issues 已在同分支集成,主进程新增 feedback:status/issues/detail/open-issue 代理 Refs #42
- main: credentialsStatus 新增 supportsVersioned,renderer 对 flat 时若 supportsVersioned===false 直接隐藏 banner(旧版 dsh 保持 flat 可用,不弹迁移) - 之前改为总是提示一键迁移,导致 dev/mac 点击后触发 backupAndMigrate 的版本保护报错“当前 dsh 版本过低…” 让用户困惑 - 打包版(bundledExecExists=true)仍会提示迁移,行为符合预期 - 文案改为暂不支持、已保持 flat 可用(无需处理)避免恐慌
…env override - migrateFlat 预期改为 version: "1"(dsh-credentials-local 要求 string),detect/fix 测试同步修正 - backupAndMigrate 在 dev 0.1.0 环境下测试需强制迁移,新增 DSH_TEST_ALLOW_MIGRATE=1 绕过 dshSupportsVersioned(ESM 只读无法 mock) - 106 tests + verify + harness smoke 14.5s 就绪均通过,flat 保持可用不误弹
FlashingChen
force-pushed
the
FlashingChen/he-value-for-version-in-users-coderstory-.dsh-.c
branch
from
August 28, 2026 15:08
9f3b4cb to
7e186ff
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Harness 启动失败:
TypeError: credentials-local: the value for "version" must be a string/refs must be a string复现:
~/.dsh/.credentials.yaml为version: 1(数字)+refs:结构时,dsh@0.1.0-rc.6的dsh-credentials-local会直接在parseCredentialsDocument中按 flat 解析,把version/refs当成普通 key 检查,导致类型错误。根因是
src/core/credentials-migration.ts与上游0.1.1的renderFlatLayoutMigration相反:1当成合法 versioned,把字符串 "1" 当成 unknownmigrateFlat生成version: 1(数字)fixVersionStringIssue把字符串改回数字修复
detectCredentialsFormat:"1"→ versioned,1→ unknownmigrateFlat:生成version: "1"fixVersionStringIssue:数字1→ 字符串 "1"npm run build验证,当前本地的 flat 文件可正常启动(harness 就绪 5.8s),后续 flat→versioned 迁移也会生成正确字符串版本验证
~/.dsh/.credentials.yaml已回退为 flat 并正确启动detectCredentialsFormat/fix/migrate单元逻辑已用yaml本地验证