Repository navigation
test: cover workflow asset import fan-out, user edits and fetch bounds - #83
Conversation
creegon2
left a comment
There was a problem hiding this comment.
审查 commit d1c23c9。
新增的多 Workspace、用户编辑后升级、TLS 握手/响应头/整包超时及流式中断测试具有直接断言。TLSRoots 仅注入该客户端的根池,两个生产调用方继续使用系统根,未发现阻塞代码问题。并行子测试各自隔离 schema、监听端口和服务端,gin 初始化经 sync.Once 保护。
核对了 CI run 39035300194:PR head 与 CI 实测 merge commit f0c3c75 的 tree 相同,真实 PostgreSQL 的全量 race 门禁通过,日志明确包含三个新测试及四个取包边界子用例。本次未重复运行全量测试。
批准范围限定于这些测试及测试接缝:10 秒用例在 TCP 已连接后阻塞 TLS,实际证明的是 TLS 握手截止,不能替代 TCP 拨号截止的直接证据。specs#122 需单独修正证据状态与漏掉的多 Workspace 义务行;本次 Approve 不表示 circus#195 的全部验收已完成。
Refs ora-space/circus#217
The two import gaps circus#195 names that need no production change: with several live Workspaces the import stays scoped to the space (one source row, one workflow and one published snapshot per document), and a package upgrade after the user edited the imported copy and published their own snapshot changes nothing the user owns.
…rt tests NewUpstreamClientWithRoots builds the production upstream client with an explicit TLS root pool instead of the platform pool, following the existing gitrefs.NewWithHTTP seam. Production wiring keeps calling NewUpstreamClient, so deployed upstream identity still comes from the deployment's system roots; tests that must run the checked dialer, the 10/30-second deadlines and TLS hostname verification against a controlled HTTPS server inject the root that signed it. The roots travel as a constructor argument rather than an UpstreamConfig field so the deployment configuration struct keeps its existing shape and size; modelgateway always receives the full UpstreamConfig by value, and growing it past the gocritic hugeParam threshold would force a pointer signature change on the production path.
The four approved fetch bounds had no slow-response evidence: the 10s connection deadline, the 30s response-header deadline, the 60s whole-package deadline and the 16 MiB streaming cap are now each triggered for real through the production upstream transport against a controlled HTTPS server (public deployment egress, fixture-host exemption for 127.0.0.1 only, TLS verified against a generated CA). Every case asserts the package-level failure leaves no document, workflow or snapshot rows and that the next administrator trigger retries the same URL successfully. gin.SetMode moves behind a sync.Once so parallel subtests can each build their own fixture; the whole test costs its longest boundary (60s), not the sum.
d1c23c9 to
23e4078
Compare
|
已 rebase 到 cloud main 相对上次审的
@creegon2 请按新 head |
creegon2
left a comment
There was a problem hiding this comment.
Approve
审的 commit:23e4078d(基线 cloud main 0f4e60b)。相对我上次批准的 d1c23c9,逐文件对比了四个文件:
integration/workflow_asset_import_scope_test.go:内容完全相同。integration/workflow_asset_fetch_boundaries_test.go:只有realAssetFetcher的构造改了——egress.DefaultDNSConfig()+egress.Parse解析出的 public 策略,信任根改由NewUpstreamClientWithRoots传入。用例和断言没有变化。internal/modelgateway/transport.go:相对 main 只增加NewUpstreamClientWithRoots和私有的newUpstreamClient;NewUpstreamClient仍传nil,生产路径不设置TLSClientConfig,行为不变;传入nil根池时报错,不会静默退回系统根。UpstreamConfig形状与 main 一致。integration/cloud_test.go:gin.SetMode改为sync.Once,与上次一致。
另外:
- 本 PR 与当前 cloud main
5953506(含 #91 / #100 / #104 / #105)试合并无冲突;main 在这几个目录的新增改动只有internal/egress和internal/modelgateway的 README。 - CI
check在23e4078上通过。
非阻塞建议:internal/modelgateway/README(.en).md 的 transport.go 一行可以补一句“NewUpstreamClientWithRoots 只供测试注入信任根”,方便以后查生产接线的人确认它不在生产路径上。
🤖 Generated with Claude Code
补齐 #195 命名的三条 workflow 资产导入直接证据,全部真实 HTTPS + 真实 PostgreSQL;不重做导入实现。
Refs ora-space/circus#217
三条证据
TestWorkflowAssetImportDoesNotFanOutToWorkspaces):项目 main Workspace 加两个 isolated,共 ≥2 个 live Workspace;Node 侧安装确实 fan-out(每个 live workspace 一行workspace_plugin_instances),导入不跟随——来源记录一行、每份文档一个 workflow 和一个已发布快照,第二轮也不新增。TestWorkflowAssetImportKeepsUserEditsAcrossUpgrade):用户编辑导入副本的活稿并发布自己的 v2 快照后升级包;活稿与两份快照的graph::text逐字节不变,升级内容不出现在任何位置,仅新增hotfix.json按只增不改导入。TestWorkflowAssetImportCancelsSlowOrOversizePackages):四个子用例全部经生产NewUpstreamClient传输链触发真实边界——10 秒连接(接受 TCP 后不完成 TLS 握手;TCP 拨号与 TLS 握手同一 10 秒取值)、30 秒响应头、60 秒整包、16 MiB 流式(无 Content-Length 的 chunked 流,读计数在读完前中断,服务端写失败为证)。每个失败都是包级(无文档行、无 workflow、无快照),同一 URL 修复后重装同版本重试成功。四个子用例并行(各自独立 schema 与服务器),整个测试耗时约等于最长边界 60 秒,而非总和。生产代码改动
仅一处测试接缝:
feat(modelgateway)commit 新增NewUpstreamClientWithRoots(config, roots),按gitrefs.NewWithHTTP的既有做法给测试一个显式信任根入口;生产调用方(cmd/server、cmd/model-gateway)仍只调用NewUpstreamClient,上游身份照旧由部署的 system root pool 验证。边界测试用它在受控 HTTPS 服务器上跑完整生产链路:受检拨号、10/30 秒截止与 TLS 主机名验证全部照常执行。根池走构造参数而不是
UpstreamConfig字段:rebase 到最新 main 后该结构体随 egress 重构变为 72 字节,再加字段会越过 gocritichugeParam阈值(80 字节),只能改生产路径的指针签名;构造参数让部署配置结构保持原样。integration/cloud_test.go的gin.SetMode移到sync.Once之后,使并行子测试各自建 fixture 不在 race 检测下竞争全局。验证
0f4e60b(含外部 Git 线、WorkflowRun、cloud#84 等),冲突只在internal/modelgateway/transport.go:按 main 的egress.Policy/egress.DNSConfig重接,integration/cloud_test.go的sync.Once自动合入。TestWorkflowAssetImport*全部 8 个用例回归通过;internal/modelgateway公共路径单测通过。go test -race ./integration/ -run TestWorkflowAssetImport通过(71s),无竞争报告。task lint0 issues、task format:check通过、git diff --check干净。internal/modelgateway的 enterprise 用例失败(staticAddresses forbidden by address policy):本机非回环网卡只有 198.18/15、100.64/10 等保留段,与本次改动无关;pristine main 同样失败,已单独核对。ADR 状态
不涉及新 ADR 实现:
20261016-workflow-plugin-assets.md与20261016-asset-import-and-published-snapshots.md均已是implemented,本 PR 只补测试证据。specs 用例的证据状态在 specs#122 更新,链到 cloud main 上的固定提交,按 owner 结论在 cloud#83 合并后再改并请复核。