Merge pull request #2206 from pikasTech/fix/2203-pac-release-yaml
Pipelines as Code CI / hwlab-web-probe-sentinel-nc01- Success
Pipelines as Code CI / platform-infra-gitea-nc01- Failed
Pipelines as Code CI / unidesk-host- Success

fix: 校验 PaC release YAML 文档身份
This commit is contained in:
Lyon
2026-07-15 20:20:26 +08:00
committed by GitHub
5 changed files with 112 additions and 27 deletions
@@ -0,0 +1,29 @@
# R9.6 任务报告
## 结果
- 修复 [UniDesk #2203](https://github.com/pikasTech/unidesk/issues/2203) 的 PaC release manifest YAML stream 解析缺陷。
- renderer 现在跳过空文档以及 `Bun.YAML.parse` 返回 `null``undefined` 的 comment-only 文档。
- renderer 在 watcher probe 注入和后续集群 mutation 前,统一验证每个实际资源均具备非空 `apiVersion``kind`
- 无效资源通过 `PacReleaseManifestRenderError` 返回稳定错误类型、错误码、文档序号和缺失字段,不再把 `null` 转换为 `{}` 后交给 `kubectl`
## 语义保持
- watcher Deployment 仍按 owning YAML 声明的 deployment、namespace 与 container 精确匹配。
- startup、readiness 与 liveness probes 的注入逻辑未改变。
- 有效资源的原始顺序保持不变;仅空文档和 comment-only/null 文档从输出 stream 中移除。
- 未修改 PaC 上游 URL、版本、owning YAML、PK01 或其他 consumer 配置。
## Fixture 与验证
- `release-leading-comment-only.yaml` 覆盖官方 release manifest 形状:首个文档仅包含版权注释,后续 Deployment 与 Service 正常渲染,输出保持两个有效资源。
- `release-missing-object-identity.yaml` 覆盖缺少 `apiVersion``kind` 的实际对象,renderer 在 mutation 前返回 `pac-release-manifest-object-identity-invalid`
- `bun test scripts/src/platform-infra-pipelines-as-code-bootstrap.test.ts`14 项通过,0 项失败。
- `bun --check scripts/src/platform-infra-pipelines-as-code.ts`:通过。
- `git diff --check`:通过。
- 按任务边界未运行 Vitest,未使用 `validate=false`、fallback、人工 PipelineRun、Argo、mirror、trigger 或 PK01 操作。
## 自动交付边界
- 本任务只提交源码、fixture、Bun 定向测试与报告,并通过正常 PR merge 事件触发 PaC 自动交付。
- PR 合并后的 `hwlab-nc01-production` bootstrap/status 原入口复测由主代理在正常自动链上完成;源码验证、PR 或构建结果不能替代该运行面证据。