From 35b9a62ed4cc29c75d1dfaf072d4161a43de2b5c Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 21 Oct 2026 16:51:21 +0900 Subject: [PATCH] docs: hand off deterministic daily operations SOP --- docs/协作/evidence/daily-ops-01/build.json | 1 + docs/协作/evidence/daily-ops-01/tests.txt | 36 ++++++++++++++++++++++ docs/协作/日常操作SOP-交付-01.md | 32 +++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 docs/协作/evidence/daily-ops-01/build.json create mode 100644 docs/协作/evidence/daily-ops-01/tests.txt create mode 100644 docs/协作/日常操作SOP-交付-01.md diff --git a/docs/协作/evidence/daily-ops-01/build.json b/docs/协作/evidence/daily-ops-01/build.json new file mode 100644 index 0000000..5003e24 --- /dev/null +++ b/docs/协作/evidence/daily-ops-01/build.json @@ -0,0 +1 @@ +{"schemaVersion":1,"action":"build","root":"/workspace/scratch/0aaa9774aecc/single-package-staging/ycode","status":"PASS","code":"BUILT","summary":"Build completed with fresh main, preload and renderer entry artifacts.","git":{"sha":"dac4af53e098ea452cb8421962b49b7c9f66df91","dirty":true,"branch":"master","changes":["M AGENTS.md"," M README.md"," M \"docs/\\345\\215\\217\\344\\275\\234/Dev\\345\\220\\257\\345\\212\\250SOP.md\""," M src/main/index.ts","?? \"docs/\\345\\215\\217\\344\\275\\234/\\346\\227\\245\\345\\270\\270\\346\\223\\215\\344\\275\\234SOP.md\"","?? scripts/ops.mjs","?? scripts/ops/","?? src/main/dev-ops-health.ts"],"changesTruncated":false},"evidence":{"startedAt":"2026-10-21T07:48:32.008Z","logPath":"/workspace/scratch/0aaa9774aecc/single-package-staging/ycode/.git/ycode-ops/logs/1792568912009-7d4ff325-85c5-470b-aebc-ed991c34c52b.log","artifactDirectory":"/workspace/scratch/0aaa9774aecc/single-package-staging/ycode/out","artifacts":[{"name":"main/index.mjs","size":1609693,"mtimeMs":1792568914459.8896,"sha256":"aaf4089ca9fd6f1494cd3b0f88d4870efb42852b58395ec39500bfae370941a8"},{"name":"preload/index.cjs","size":16064,"mtimeMs":1792568914481.6614,"sha256":"5c2fc6bb0138e4b936eba32aeb4b3a498b3e9c068fb9e89dc4f114588157412d"},{"name":"renderer/index.html","size":1739,"mtimeMs":1792568916590.1694,"sha256":"42bb74095384906f5781292c4c60569c308dc916b377cbd400d03660d13f9c7f"}],"sourceFingerprint":"dfe948fbbd5a84f423ec686460bc0ae01eb918775c5e3753ec4ee3f01fa408e2","sourceDirty":true,"sourceIdentity":"HEAD plus local modifications; not a pristine commit build"},"ok":true,"exitCode":0} diff --git a/docs/协作/evidence/daily-ops-01/tests.txt b/docs/协作/evidence/daily-ops-01/tests.txt new file mode 100644 index 0000000..6a7b953 --- /dev/null +++ b/docs/协作/evidence/daily-ops-01/tests.txt @@ -0,0 +1,36 @@ +✔ identity rejects PID reuse, command changes, opaque timestamps (1.428999ms) +✔ ownership excludes unrelated siblings and pre-parent timestamp PID artifacts (1.167004ms) +✔ renderer app path is an exact Windows path, not a substring (0.573903ms) +✔ actual Local URL parses ANSI and variable ports without accepting remote hosts (0.377024ms) +✔ HTTP requires exact source and real transformed JS, not generic 200 HTML (6.388623ms) +✔ health requires correct port ownership, target renderer, responsive owned main (6.090154ms) +✔ non-Windows native dev is explicitly unsupported, never GUI PASS (0.903487ms) +✔ renderer attestation requires fresh UUID-bound visible UI and exact process IDs (0.616465ms) +✔ producer opt-in gates packaged, missing and invalid run IDs without timers or writes (6.708382ms) +✔ producer writes fresh run and native PID proof only for a complete visible shell with button (14.703835ms) +✔ loading, rejected renderer and linked output directory cannot produce ready proof (4.14652ms) +✔ invalidation while a true proof write is pending cannot leave a stale true result (2.538499ms) +✔ unresponsive and closed windows invalidate proof; close cancels periodic probes (3.467302ms) +✔ strict parser accepts only fixed action and bounded flags (1.665876ms) +✔ shell metacharacters remain literal argv, not commands (86.126075ms) +✔ explicit root never silently picks parent or another repository (38.502242ms) +✔ dirty checkout blocks pull without discarding changes (44.167862ms) +✔ pull refuses wrong branch and remote before network access (61.812683ms) +✔ workspace lock excludes concurrent mutations and preserves unknown lock (48.40442ms) +✔ timeout is bounded and records actual timeout (56.057511ms) +✔ artifact freshness rejects stale outputs and accepts rewritten identical bytes (38.828005ms) +✔ logs redact credentials and JSON errors are machine-readable (117.029628ms) +✔ package never invokes installer on unsupported platforms (41.293196ms) +✔ fresh local fetch fast-forwards exactly; ahead/divergent and fetch failure preserve checkout (3785.777542ms) +✔ source fingerprint notices content changes even when HEAD and dirty boolean do not change (64.664435ms) +✔ redaction preserves JSON syntax for embedded token error text (0.562847ms) +✔ dev-latest is unsupported before any Git mutation on non-Windows (61.207156ms) +✔ oversized evidence is bounded for small-model JSON consumption (1.9262ms) +ℹ tests 28 +ℹ suites 0 +ℹ pass 28 +ℹ fail 0 +ℹ cancelled 0 +ℹ skipped 0 +ℹ todo 0 +ℹ duration_ms 4598.969052 diff --git a/docs/协作/日常操作SOP-交付-01.md b/docs/协作/日常操作SOP-交付-01.md new file mode 100644 index 0000000..3035986 --- /dev/null +++ b/docs/协作/日常操作SOP-交付-01.md @@ -0,0 +1,32 @@ +# 日常操作 SOP:交付 01 + +2026-10-21。源码提交 `2aafb6f92f483de24cf6e17277a2f5385c7c9fc5`,基线 `dac4af53e098ea452cb8421962b49b7c9f66df91`。 + +## 新对话入口 + +新对话已打开本仓库并加载 AGENTS.md 时,只说“拉取代码”“运行 dev”“运行最新 dev”“停止 dev”“重启 dev”“构建”“打包”或“查看状态”,由模型映射固定入口 `node scripts/ops.mjs --json`。 + +若新对话没有项目上下文,先提供一次项目根目录并要求读取 AGENTS.md。仓库规则不会自动进入所有纯聊天,也不会替用户切换模型或改变额度。完整映射见 [日常操作 SOP](日常操作SOP.md)。 + +## 实现 + +- 固定白名单动作、参数检查、JSON schema/status/code/exitCode、绑定目录及 Git 身份,不让模型拼任意命令。 +- pull 仅干净 master + 正确 gitea 远端 + 本次 fetch + 快进到精确 SHA;本地领先/分叉/脏修改均停止,不 reset/stash/强推。 +- dev 当前代码与 dev-latest 明确区分。已有可验证实例复用;restart/stop 只操作 PID、创建时间、完整命令行匹配的目标进程树。未知实例拒绝接管或批量杀进程。 +- dev 验证所有者、端口、实际仓库源码 HTTP 响应、对应 renderer 和可响应窗口,并要求带本次 UUID/PID/时间的新鲜实际 DOM 心跳。开发态 opt-in 主进程只观察自己窗口的可见 App shell;无网络/CDP/新 IPC 入口,打包应用不启用。不是全业务功能验收。 +- build/package 检查本次新鲜精确类型产物及源码内容指纹;package 限 Windows x64、仅生成未签名本地产物、不发布/上传。超时可能存在后代进程时保留锁并阻止重叠重试。 +- 错误结构化报告;不自动改代码、升级依赖、修复未知环境或变更安全策略。缺依赖/PowerShell 策略限制/认证等必须明确处理,不能伪装成功。 + +## 验证 + +- 28 项离线/夹具测试通过:参数注入、目录/分支/远端、临时本地 bare 仓库快进与失败、脏修改保护、锁、超时、输出脱敏/边界、构建产物、新旧源码、进程归属/PID 重用、HTTP 错配、旧/错心跳、DOM 谓词、主窗口生命周期及写入失效竞态。 +- 主线程实际调用 `node scripts/ops.mjs build --json --timeout-ms 120000` 成功,得到 BUILT 和 main/preload/renderer 三类新鲜产物哈希。执行时源码为上述提交的工作树内容,因此报告保留当时 dirty=true,不改写成提交后重跑。 +- 前一次实构建恰遇新增测试文件,入口返回 SOURCE_CHANGED,未误报成功;源码停止变化后重跑才通过。 +- TypeScript 检查、独立复审、git diff --check 通过。 +- 证据:[测试](evidence/daily-ops-01/tests.txt)、[实构建结果](evidence/daily-ops-01/build.json)。 + +## 未验证与验收 + +尚未在 Windows 实机运行 dev/start/stop/restart/installer。需验证 PowerShell 查询权限与脚本执行策略、detached 主机是否被执行器 job 清理、真实窗口/端口关联、中文空格路径、已有实例、错误版本、启动失败和超时。脚本不会更改执行策略来绕过阻塞。Linux 的 native dev/package 返回 UNSUPPORTED,不算通过。 + +模型必须依据动作结果与证据汇报:status 的 PASS 只表示状态读取完成,不表示其嵌套 dev 一定已启动。工具返回执行 session 时只能续读同一 session,不能重复启动。SOP 旨在减少常规操作的推理与失误,不保证任意模型或机器永不出错。