SIGN IN SIGN UP

fix(availability): restore status_code IS NOT NULL terminal filter (#1189)

* fix(availability): restore status_code IS NOT NULL terminal filter

可用性监控的 provider + 时间范围聚合改用 status_code IS NOT NULL 收敛
终态边界,与部分索引 idx_message_request_provider_created_at_finalized_active
(deleted_at IS NULL AND status_code IS NOT NULL) 对齐,让热路径查询
能稳定命中索引;同时避免把仅写入 providerChain / errorMessage 片段但
statusCode 仍为 NULL 的"请求中"记录算入聚合(之前的内联终态谓词复刻
fn_is_message_request_finalized 语义后,会让分类函数把它们误算成 failure)。
终态记录的成功/失败/排除分类继续由
fn_compute_message_request_success_rate_outcome(...) 完成。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(availability): factor finalized-boundary asserts, cover error_message

把"终态边界只看 status_code IS NOT NULL"的 5 处断言抽到
expectStatusCodeOnlyFinalizedBoundary helper,并补上对
"error_message" is not null 的负向断言:之前只排除 blocked_by /
provider_chain 路径,如果未来 finalized 回归成
"status_code" is not null or "error_message" is not null,
仅写入 errorMessage 的"请求中"记录会重新被纳入可用性统计而不被发现。

Addresses CodeRabbit nitpick on #1189.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: ding113 <ding113@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
D
Ding committed
18b8e605600a51660c44102adaba4d95b0cb80a5
Parent: b0c9eaf
Committed by GitHub <noreply@github.com> on 5/15/2026, 8:07:40 AM