Repository navigation
fix(plan): planHash 只认参数内容;release/publish 凭证前置校验 - #54
Merged
Merged
Conversation
- lib/plan.mjs: norm() 的剥离边界扩到 workflow 账簿字段(planHash/release/issuePlan/commit/ checkpoint/operation/updatedAt/lastError)、repo.head/changedFiles/clean 与顶层 head - lib/domains/release.mjs + publish.mjs: 凭证前置校验,缺 GITHUB_TOKEN 在 commit/push 之前失败 - test/cli.test.mjs: 两条回归(账簿与 HEAD 推进不作废 plan;参数变化必须作废 + 缺凭证不落提交) 实证:release 半失败(commit 成功、push 因缺 token 失败)会推进 HEAD,旧口径下重试被 PLAN_HASH_INVALID 拒绝,只能重跑 plan,导致同一提交被造两遍(shadow-dev-workflow PR #50 里 两条同 message 的 commit)。
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.
动机
shadow-dev-workflow侧出 PR 时实测到两条连坐缺陷:lib/plan.mjs的norm()只剥了workflow.planHash/release/issuePlan/commit,没剥checkpoint/operation/updatedAt/lastError,也没剥repo.head与顶层head。于是:release 半失败(commit 成功、push 因缺GITHUB_TOKEN失败)→ HEAD 前移 → 下一次release execute重算哈希不一致 →PLAN_HASH_INVALID→ 只能重跑 plan → 同一个提交被造了两遍(shadow-dev-workflow PR feat(change): 实现期扩面登记 change amend + 归档门旁路防护 #50 里两条同 message 的 commit 就是它)。release execute的顺序是commit → push → 建 PR,缺 token 时本地已经落下提交,留下「已提交、未推送」的半状态,重试就得手工收拾。决策
planHash 的语义是「参数须与 plan 一致」(files/message/title/body 与 brief 正文),不是「快照不许动」。因此:
norm()把剥离边界扩到「CLI 自身的状态推进 + 易变快照」:workflow的账簿字段、repo.head/changedFiles/clean、顶层head。dirty 行为检查仍由sync等域在planData内联执行,安全语义不丢。release.execute/publish.execute前置token():不可逆动作(commit / push)之前先确认能推送、能建 PR。保留的部分:参数变化、brief 正文变化仍然改变 planHash 并判红——漂移防护没有被削弱。
任务
lib/plan.mjs—norm()剥离边界扩展lib/domains/release.mjs— 凭证前置校验lib/domains/publish.mjs— 凭证前置校验test/cli.test.mjs— 两条回归用例结果
node --test test/cli.test.mjs test/install.test.mjs→tests 118 / pass 109 / fail 1✔ planHash 只认参数内容:CLI 自身状态推进与 HEAD 快照不作废 plan(同一条用例同时钉住两侧:账簿字段与 HEAD 前移不改哈希;--files/--message/--title/--body任一变化必须改哈希)✔ release execute 缺凭证时不落提交(避免已提交未推送的半状态)(断言缺 token 时git rev-list --count前后一致)workflow release track resolves latest release and downloads the asset via the API与本次改动无关:它经bash解包 release 资产,而本机 PATH 首命中System32\bash.exe(WSL 入口桩,未装子系统),报「Windows Subsystem for Linux has not been enabled」。同一形态已在shadow-dev-workflow侧固化为scripts/resolve-bash.mjs与 SGN-011,本仓属同族环境噪声,非回归。影响面
planHash在本次改动后按新口径重算,历史指纹会变(workflow.planHash只是凭证,不参与任何语义判断)。check:requires的能力声明:无新命令键、无命令语义变更。