固化七月迭代审计治理进展以隔离线上热修

Constraint: 切换 main 前必须保存当前七月分支全部项目进展,套餐生效提案仅属于 Iteration/7-11。

Rejected: 将七月套餐修复直接移植到 main | 两个分支的可靠投递架构不同。

Confidence: medium

Scope-risk: broad

Directive: 不得将本提交整体 cherry-pick 到 main;main 套餐热修必须基于其纯 Asynq 代码独立实施。

Tested: git diff --check;openspec validate fix-package-activation-starvation --strict。

Not-tested: 按用户要求未运行自动化测试;go build ./... 因当前审计改造中的 Enterprise 模型字面量和 role.recordFailure 参数类型错误未通过。
This commit is contained in:
2026-08-03 09:47:22 +08:00
parent cf2ff0ac1c
commit b3499adfca
114 changed files with 16961 additions and 2782 deletions

View File

@@ -2,6 +2,28 @@ package constants
import "time"
const (
// IntegrationIDMaxLength 是外部交互稳定ID的数据库长度上限。
IntegrationIDMaxLength = 64
// IntegrationTriggerSeriesMaxLength 是技术尝试序列ID的数据库长度上限。
IntegrationTriggerSeriesMaxLength = 64
// IntegrationCorrelationIDMaxLength 是跨业务链路关联ID的数据库长度上限。
IntegrationCorrelationIDMaxLength = 100
// IntegrationResourceIDMaxLength 是外部交互本地资源ID的数据库长度上限。
IntegrationResourceIDMaxLength = 128
// IntegrationResourceKeyMaxLength 是外部交互资源稳定Key的数据库长度上限。
IntegrationResourceKeyMaxLength = 128
// IntegrationProviderMessageMaxLength 是外部交互结果摘要的数据库长度上限。
IntegrationProviderMessageMaxLength = 500
// IntegrationSafeMessagePrefix 标识调用方已提供的受控可读业务结果摘要。
IntegrationSafeMessagePrefix = "业务结果摘要:"
// IntegrationQueryMaxRange 是调查列表允许的最大连续时间范围。
IntegrationQueryMaxRange = 31 * 24 * time.Hour
// IntegrationPendingStaleAfter 是待处理尝试进入陈旧统计的时长。
IntegrationPendingStaleAfter = 5 * time.Minute
)
const (
// IntegrationDirectionInbound 表示外部系统调用本系统。
IntegrationDirectionInbound = "inbound"
@@ -85,3 +107,86 @@ func IntegrationResultName(result string) string {
}
return names[result]
}
const (
// IntegrationResultCategoryProcessing 表示仍在处理。
IntegrationResultCategoryProcessing = "processing"
// IntegrationResultCategorySucceeded 表示外部请求实际成功。
IntegrationResultCategorySucceeded = "succeeded"
// IntegrationResultCategoryIndeterminate 表示结果无法确认。
IntegrationResultCategoryIndeterminate = "indeterminate"
// IntegrationResultCategoryFailed 表示外部请求或载荷明确失败。
IntegrationResultCategoryFailed = "failed"
// IntegrationResultCategoryNotSent 表示外部请求未发送。
IntegrationResultCategoryNotSent = "not_sent"
)
// IntegrationResultCategory 返回外部尝试的稳定派生类别。
func IntegrationResultCategory(result string) string {
switch result {
case IntegrationResultPending:
return IntegrationResultCategoryProcessing
case IntegrationResultSuccess:
return IntegrationResultCategorySucceeded
case IntegrationResultUnknown:
return IntegrationResultCategoryIndeterminate
case IntegrationResultFailed, IntegrationResultNotFound, IntegrationResultInvalidPayload, IntegrationResultConflict:
return IntegrationResultCategoryFailed
case IntegrationResultIgnored, IntegrationResultMerged, IntegrationResultRateLimited, IntegrationResultCompleted, IntegrationResultCancelled:
return IntegrationResultCategoryNotSent
default:
return ""
}
}
// IntegrationProviderName 返回外部提供方中文名称。
func IntegrationProviderName(provider string) string {
names := map[string]string{
IntegrationProviderCTCC: "中国电信", IntegrationProviderCMCC: "中国移动",
IntegrationProviderCUCC: "中国联通", IntegrationProviderWechatPay: "微信支付",
IntegrationProviderAlipay: "支付宝", IntegrationProviderWeCom: "企业微信",
IntegrationProviderGateway: "Gateway",
}
if name := names[provider]; name != "" {
return name
}
return "未知提供方"
}
// IntegrationDirectionName 返回外部交互方向中文名称。
func IntegrationDirectionName(direction string) string {
switch direction {
case IntegrationDirectionInbound:
return "入站"
case IntegrationDirectionOutbound:
return "出站"
default:
return "未知方向"
}
}
// IntegrationOperationName 返回已注册外部操作中文名称。
func IntegrationOperationName(operation string) string {
names := map[string]string{
IntegrationOperationCTCCRealnameCallback: "接收实名结果回调",
IntegrationOperationCUCCRealnameRemovalCallback: "接收解除实名回调",
IntegrationOperationPaymentPreCreate: "支付预下单", IntegrationOperationPaymentQuery: "支付查单",
IntegrationOperationPaymentCallback: "接收支付回调",
IntegrationOperationWeComAccessToken: "获取企业微信访问令牌",
IntegrationOperationWeComVisibleMembers: "查询企业微信可见成员",
IntegrationOperationWeComVisibleDepartments: "查询企业微信可见部门",
IntegrationOperationWeComTemplateDetail: "查询企业微信审批模板",
IntegrationOperationWeComAttachmentUpload: "上传企业微信审批附件",
IntegrationOperationWeComApprovalSubmit: "提交企业微信审批",
IntegrationOperationWeComApprovalCallback: "接收企业微信审批回调",
IntegrationOperationWeComApprovalDetail: "查询企业微信审批详情",
IntegrationOperationWeComApprovalInfo: "查询企业微信审批单号",
IntegrationOperationGatewayRealname: "查询实名状态", IntegrationOperationGatewayTraffic: "查询流量",
IntegrationOperationGatewayNetwork: "查询卡网络状态", IntegrationOperationGatewayDeviceInfo: "查询设备信息",
IntegrationOperationGatewaySpeedTier: "设置卡限速档位",
}
if name := names[operation]; name != "" {
return name
}
return "未知外部操作"
}