fix(worker): 单次任务固定同一 WeKnora 连接

TargetIdentity 与业务调用原先各自 Resolve:身份核验通过后,上传/轮询/验收/
移除的后续调用仍可能在下一次解析时切到新实例。现在 BeginTask 只解析一次,
用同一连接读取对象租户并把该不可变连接钉进返回 context;后续上传、列库恢复、
查询、chunk 读取、删除与删除后重查全部复用它。

TaskConnector 优先于 IdentityProvider;仅实现 TargetIdentity 的窄假客户端仍可
工作,生产路径不会走双解析。新增假端点测试断言一次处理只解析一次、绑定后改
当前实例仍全部打到原实例;四个 handler 的 TaskConnector 假客户端断言所有业务
调用携带同一连接令牌,覆盖上传恢复和删除重查。
This commit is contained in:
姚章浩
2026-11-19 15:33:40 +08:00
parent 1f5bf72aec
commit 6ae5150fdf
10 changed files with 424 additions and 50 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ func (handler *ValidateHandler) Handle(ctx context.Context, job jobs.Job) error
runID = job.ID
}
identity, hasProvider, identityErr := resolveIdentity(ctx, handler.client, publication.TestKBID)
ctx, identity, hasProvider, identityErr := resolveIdentity(ctx, handler.client, publication.TestKBID)
identityOK := !hasProvider || (identityErr == nil &&
identityMatches(publication.TestInstanceURL, publication.TestInstanceTenant, identity))
identityReason := ""