[Bug] HSR 更新把 Mirror 酱 CDK 业务错误覆盖成通用 HTTP 403

Open Beginner friendly
#1,960 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
api, backend

Research direction

Read app/task/HSR/tools/update/discover.py, especially _query_mirrorchyan and _query_latest, along with the existing update discovery tests that use httpx.MockTransport. Start by checking how non-2xx responses are parsed and how _CDK_ERROR_CODES is reached; reproduce with an HTTP 403 response containing code=7002. Done means the existing CDK-specific prompt appears for that response while the general HTTP error handling remains covered.

Written by the indexing model from the issue text.

Description

AI bug

本轮仅追踪 MAS 最新正式版 v5.8.0 与最新 beta v5.8.0-beta.4。

提交所用的 AI 工具或模型

ChatGPT(GPT-6 Astra Pro)。按用户授权读取 Sentry,核对当前源码、Mirror 酱官方契约,并实际运行最小验证。

问题描述

HSR 专项(三月七/SRA)选择 Mirror 酱更新源时,CDK 错误会被展示成通用的“查询最新版本失败:403 Forbidden”,具体的过期、无效或次数用尽原因没有进入现有处理分支。用户无法从提示判断应该检查 CDK,而容易把它当成网络或更新服务器异常。

本问题对应 MAS 对失败响应的解释顺序和现有 CDK 提示分支。

证据与环境

  • Sentry:AUTO-MAS-BACKEND-F3。已按当前正式版 / beta 范围重新取样,本组匹配当前正式版 [email protected],后端构建 7c24a80b7ade,时间 2026-11-12T11:48:14Z(UTC)。样本确认 HSR 请求 Mirror 酱时得到 HTTP 403,随后记录“查询三月七最新版本失败”。事件未保留 JSON 响应体,因此不能断言这一条现场具体属于哪一个 CDK 业务码。
  • Mirror 酱官方错误表明确列出 HTTP 403 与业务码 7001–7005 的对应关系,并要求客户端读取非 2xx 响应中的 JSON 错误体。
  • 当前 _query_mirrorchyan在 response.json() 之前调用 raise_for_status()。官方的 403 响应会在这里抛出,使后面的 _CDK_ERROR_CODES 分支无法执行。
  • 上层 _query_latest对已选 Mirror 酱的这类 HTTP 异常统一包装成查询失败。因此没有返回现成的 CDK 提示。
  • 已核对当前 dev 与 release/v5.8.0,这个处理顺序都仍存在。#1945 修的是 SRA 自建下载源,与此边界无关。

日志 / 堆栈

下列内容来自 F3 的 Sentry 结构化异常字段,是脱敏后的调用摘要,不是完整应用日志。记录事件为 0dd614f8664440b6ac713301d88cca5b,异常记录时间 2026-11-12T11:48:14Z。只列实际记录的相关帧;URL 参数已省略,未补造调用。

HTTPStatusError: HTTP 403 Forbidden(Mirror 酱资源查询,URL 参数已省略)
  at raise_for_status (httpx/_models.py:829)
  at _query_mirrorchyan (app/task/HSR/tools/update/discover.py:247)
  at _query_latest (app/task/HSR/tools/update/discover.py:202)

HSRUpdateError: 查询三月七最新版本失败:HTTP 403 Forbidden(URL 参数已省略)
  at _query_latest (app/task/HSR/tools/update/discover.py:213)
  at discover (app/task/HSR/tools/update/discover.py:95)
  at check_engine_update (app/task/HSR/tools/update/__init__.py:114)

验证与复现边界

在当前 dev 5aa609284b6da2db0431c305b4a258885210b3c1 实际运行真实 discover(M7A, source="MirrorChyan", ...) 入口,使用真实引擎描述和错误码映射;沿用仓库既有更新发现测试的 httpx.MockTransport 外部 HTTP 边界。

  1. 返回官方规定的 HTTP 403,JSON 为 code=7002、msg=KEY_INVALID。实际结果是通用 HSRUpdateError,只有查询失败/403,没有“填入的 CDK 错误”。
  2. 保持同一 JSON 体,把状态改为 200 作对照,实际结果变成现有的“填入的 CDK 错误”,证明业务分支本身存在,却被前面的 HTTP 状态检查阻断。

验证环境为 Linux Python 3.12.14、httpx 0.28.1;没有使用真实 CDK、没有下载脚本包或运行游戏,没有完成 Windows UI 端到端验证。受控响应来自已核实的官方契约,生产发现逻辑未替换。本次未修改生产实现。

确认

  • 这是 AI 生成的内容,已核对事件、源码和官方契约,并实际执行上述最小验证。
  • 理解 AI 报告分区不承诺处理时间,也不保证有人认领。
Dominant language
Python
Stars
707
Forks
56
Avg merge
11h 45m
Merged PRs (30d)
429

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AUTO-MAS-Project/AUTO-MAS

All issues in AUTO-MAS-Project/AUTO-MAS

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.