diff --git a/docs/reference/devops-hygiene.md b/docs/reference/devops-hygiene.md index 5b27f74a..40ecbb3b 100644 --- a/docs/reference/devops-hygiene.md +++ b/docs/reference/devops-hygiene.md @@ -54,6 +54,8 @@ If a manual repair is needed to unblock the platform, the durable fix must be co 开始使用任何固定主/目标 worktree 时,如果发现它落后 remote/base,必须先完成 source-truth 同步再继续分析或创建任务 worktree:若工作区有脏改,先用 `git stash push -u` 保存当前脏改(包括 untracked),再执行 `git pull --ff-only ` 快进,随后 `git stash apply` 并按快进后的语义合并冲突或重复内容;若工作区 clean,则直接 `git pull --ff-only`。这个 stash 是保护并行修改以便固定主 repo 回到最新 source truth,不是清理、丢弃或隐式接管并行任务;apply 后只提交当前任务明确相关的文件,其他并行修改继续保留原状。不得在落后的固定 worktree 上继续源码分析、创建任务分支、修改代码或给 issue 写基于旧源码的结论。 +固定 worktree 对齐 remote 是硬前置,不是建议项。`git status` clean、运行面 healthy、CI/CD snapshot 对齐或历史 PipelineRun 通过,都不能替代固定工作区自身的 remote/base 对齐检查;只要 HEAD 与声明 remote/base 不一致、`remoteUpToDate=false`、ahead/behind/diverged 或受控 source-workspace 状态返回 not-ready,就必须先修复固定工作区或改用从最新 remote/base 创建的干净 anchor。禁止从未对齐的固定 worktree 创建任务 worktree、开测试 PR、运行 repo 内验证或写 closeout 结论。 + 所有源码、配置、部署脚本和运行面修复都必须在从最新 remote/base 创建的独立 `.worktree/` 中完成;固定主 worktree 不直接承载代码修改。PR 合并或等价集成进入 remote base 后,应及时回到对应固定主 worktree 执行 `git fetch` 与 `git pull --ff-only`,让下一轮 source-truth 预检、web-probe 复核、issue closeout 和新任务 worktree 都从已合并的最新源码开始。若固定主 worktree 因并行脏改不能安全快进,保留脏改并改用干净的最新 remote/base worktree 继续,不能 reset、checkout 或删除他人修改。 任务 worktree 清理前必须做语义合并核查。最低要求是:worktree clean;相关提交已经是 `origin/master` 祖先,或 `git log --left-right --cherry-pick ...origin/master` 没有 left-only 未吸收 patch;必要时再核对关键文件 diff、PR merge commit、issue closeout 和运行面验证是否对应最新 `master`。只有确认当前任务语义已经进入 `master` 或被更新实现等价替代后,才允许 `git worktree remove `;不得只因为分支落后、PR 已关闭、文件看起来相似或本地空间紧张就删除。若发现未提交文件、未推送提交、left-only patch 或语义不确定,先把应保留内容提交/合并/推送到 `master`,或记录阻塞并保留 worktree。 diff --git a/docs/reference/hwlab.md b/docs/reference/hwlab.md index 1c2ae479..d49c03ee 100644 --- a/docs/reference/hwlab.md +++ b/docs/reference/hwlab.md @@ -15,7 +15,7 @@ - JD01 的出网、依赖拉取、k3s/bootstrap、git-mirror 和 web-probe 浏览器依赖都以 UniDesk YAML 中的 host-route/host-proxy 声明为准:`config/hwlab-node-control-plane.yaml` 的 `nodes.JD01.egressProxy`、`config/platform-infra/host-proxy.yaml#targets.JD01`,以及 `config/hwlab-node-lanes.yaml` 的 JD01 network/download/sourceWorkspace 配置。JD01 的 MDTODO、Cloud Web、web-probe 或 rollout 任务不是 Sub2API 任务;除非 issue/CLI 明确指向 Sub2API runtime、Codex pool 或 platform-infra sub2api target,不要把这类故障默认归因到 Sub2API,也不要把 JD01 egress 临时切到 Sub2API 路径。 - JD01 的 node-local registry 是 k3s workload/PVC,不是 host Docker registry。`hwlab nodes control-plane infra status --node JD01 --lane v03` 应显示 registry workload ready、PVC bound、endpoint ready、`zeroSeeded=true` 和 `seededFromOldRegistry=false`;旧 host Docker `registry` 容器应保持停止。零种子 registry 迁移后,必须通过受控 `runtime-image preload` 和 `infra tools-image build/status` 补齐 BuildKit、runtime/base 和 tools image,再把 HWLAB/AgentRun status 与 web-probe smoke 作为可用性证据。 - HWLAB 项目内长期规则入口仍以目标 repo 的 `AGENTS.md` 为准。进入已解析的目标 workspace 后,必须重新读取该 workspace 的规则文件;不能只凭主 server 的压缩上下文继续操作。 -- 每次开始 node/lane 源码修改、PR 准备或 repo 内验证前必须通过 YAML-first 受控入口检查并同步目标 workspace:`bun scripts/cli.ts hwlab nodes control-plane source-workspace sync --node --lane --confirm`,再用 `source-workspace status` 读取 clean、branch、remote、HEAD 和依赖状态。该入口从 `config/hwlab-node-lanes.yaml#lanes..targets..sourceWorkspace` 读取 workspace remote、proxy env、identityTarget/identityId 和 up-to-date policy,并复用 `config/deploy-ssh-identities.yaml` 分发非交互 GitHub SSH 身份;不要把裸 `trans : git fetch ...` 当成正式预检入口。CI/CD trigger、status 和 rollout source closeout 仍以选中 `sourceAuthority` 解析出的受控 source snapshot 为准。 +- 每次开始 node/lane 源码修改、PR 准备或 repo 内验证前必须通过 YAML-first 受控入口检查并同步目标 workspace:`bun scripts/cli.ts hwlab nodes control-plane source-workspace sync --node --lane --confirm`,再用 `source-workspace status` 读取 clean、branch、remote、HEAD 和依赖状态。`source-workspace status` 必须显示声明 remote/base 已对齐;如果返回 `source-workspace-not-ready`、`remoteUpToDate=false`、ahead/behind/diverged 或 HEAD 与声明 remote/base 不一致,先修复固定 workspace,再创建 `.worktree/`、提交测试 PR 或给验收写结论。运行面 `status` healthy、PaC snapshot 对齐和 GitOps/Argo healthy 只能证明 runtime source authority,不代表 host 固定 workspace 已可用于源码工作。该入口从 `config/hwlab-node-lanes.yaml#lanes..targets..sourceWorkspace` 读取 workspace remote、proxy env、identityTarget/identityId 和 up-to-date policy,并复用 `config/deploy-ssh-identities.yaml` 分发非交互 GitHub SSH 身份;不要把裸 `trans : git fetch ...` 当成正式预检入口。CI/CD trigger、status 和 rollout source closeout 仍以选中 `sourceAuthority` 解析出的受控 source snapshot 为准。 - k3s 操作必须使用 YAML 解析出的 route 语法,例如 `trans D601:k3s ...` 或 `trans G14:k3s ...`。第一个 route token 必须定位分布式目标,后续 token 才是 operation。 - D601 node-scoped runtime(例如 `D601` + `v0.3`)不是 legacy;只要 issue/CLI 明确选择 D601 node/lane,就按 YAML 中的 D601 target 执行。D601 legacy 只指旧 DEV/迁移/回滚对照路径(如 `/home/ubuntu/workspace/hwlab-dev`、16666/16667 或历史 `deploy/deploy.json` wrapper),必须由 issue/CLI 明确写成 legacy/迁移/回滚才使用。 - `/root/HWLAB`、`/workspace/hwlab`、`/home/ubuntu/hwlab`、`/tmp/hwlab-*`、无关 runner clone、master-server checkout 或未由 YAML 选中的 workspace 都不能作为当前 HWLAB 开发 source truth;CI/CD source authority 只看选中 YAML `sourceAuthority` 的受控 source snapshot。