Skip to content

docs: PR #15 升级说明加固 + stdin 示例可粘贴 - #16

Merged
kyomarshal merged 1 commit into
mainfrom
fix/pr15-upgrade-note
Nov 27, 2026
Merged

kyomarshal merged 1 commit into
mainfrom
fix/pr15-upgrade-note

Conversation

@kyomarshal

Copy link
Copy Markdown
Collaborator

修什么

PR #15 合并后御史复审(Shared/Transfers/zce-pr15-81cbf677/verdict.md)的 2 项:

  1. [Medium] 升级说明加固:旧片段掩盖拉取失败(未提交改动 → git 拒绝快进 → 脚本照跑恢复、退出码 0、用户停在旧版本不自知),固定 /tmp 备份路径还可能把上次留下的另一份指南误恢复进只保留一份的克隆。现改为:
    • 每次 mktemp -d 独立备份目录,只备份实际存在的文件、不吞错误;
    • step 0 明示先处理受跟踪的本地改动(git stash push -- AGENTS.md CLAUDE.md 或分支提交);
    • 恢复包在 if git pull --ff-only 里——拉取失败什么都不恢复并明确报错,只恢复本次备份到的文件。中英双版同步。
  2. [Low] stdin 示例:<id> 原样粘贴会被 bash 当重定向(CLI 根本没启动),改为 "$SESSION_ID" 并注明先设置会话 ID。

验证(逐条实跑,仿真旧克隆)

  • 仿真 pre-chore: untrack local AGENTS.md/CLAUDE.md and split Jev config reference from SKILL.md #14 克隆 + 指南未提交改动:拉取如预期拒绝,什么都不恢复,HEAD 停在旧提交、本地改动完好;
  • 按 step 0 暂存后完整跑一遍:升级成功,两份指南以未跟踪文件恢复,备份目录只含本次文件;
  • 只保留 AGENTS.md 的克隆:不会凭空恢复出 CLAUDE.md(旧固定路径陷阱不存在);
  • stdin 示例原样粘贴进 bash:heredoc 正常闭合、CLI 真实启动(对测试 id 回应「会话不在登记簿」——正是想要的非卡死行为);
  • node scripts/sync-doc-version.mjs --check 通过。

纯文档改动,未跑全量测试(不动 lib)。

…ce, pull-failure guard, paste-able stdin example

[Medium] The #15 upgrade snippet masked pull failures: uncommitted
edits to the tracked guides make git refuse the fast-forward, yet the
snippet kept restoring and exited 0, leaving the user on the old
version none the wiser; the fixed /tmp backup path could also
resurrect the OTHER guide from an older run on a clone that keeps
only one. The bilingual note now:
- uses a fresh mktemp -d per run, copies only what exists (no error
  swallowing);
- step 0: stash or commit the tracked local edits first
  (git stash push -- AGENTS.md CLAUDE.md);
- restores only what THIS run backed up, and only inside
  if git pull --ff-only — a failed pull restores nothing and says so.

[Low] SKILL.md stdin example: <id> pasted verbatim is a bash
redirect, not a placeholder — replaced with "$SESSION_ID" plus a
note on setting it.

Verification: simulated pre-#14 clone with uncommitted guide edits —
pull refuses, nothing restored, HEAD stays, local edit intact; with
the documented stash the full upgrade completes and both guides come
back untracked; a clone keeping only AGENTS.md never regains a
CLAUDE.md; the stdin example pasted verbatim closes its heredoc and
the CLI actually runs (answers session-not-found for the test id).
sync-doc-version --check passes.
@kyomarshal
kyomarshal merged commit 386b67b into main Nov 27, 2026
2 of 3 checks passed
kyomarshal added a commit that referenced this pull request Nov 27, 2026
[Medium] The #16 snippet stashed BEFORE backing up: stash reverts the
worktree to the old committed content, so the backup captured the
pristine version and the user's local edits were never restored — worse,
a later git stash pop then conflicts on the same filenames and exits 1.
The order is now backup-with-edits FIRST, stash second (it only clears
the upstream sync — nothing left to pop, drop it when happy).

[Low] The failure branch exits non-zero via 'false' instead of 'exit 1'
(which would kill the interactive shell the snippet is pasted into);
the per-file restore tests use a guarded if so a clone keeping only
AGENTS.md exits 0 instead of failing on the missing CLAUDE.md test.

Verification (simulated pre-#14 clones): with uncommitted guide edits
the full snippet restores the edits verbatim as untracked files and
advances HEAD, stash holding only the redundant copy; an unreachable
remote exits 1, restores nothing, edits recoverable via stash pop; a
clone keeping only AGENTS.md upgrades with exit 0.
sync-doc-version --check passes.
@kyomio-openbot
kyomio-openbot Bot deleted the fix/pr15-upgrade-note branch November 29, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant