Skip to content

bugfix and docs: restructure response anomaly detection docs; remove empty payload_staging shell - #502

Merged
zhongzhouTan-coder merged 12 commits into
AISBench:masterfrom
Libotry:br_docs_modify
Aug 28, 2026
Merged

zhongzhouTan-coder merged 12 commits into
AISBench:masterfrom
Libotry:br_docs_modify

Conversation

@Libotry

@Libotry Libotry commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

PR Type / PR类型

  • Feature(功能新增)
  • Bugfix(Bug 修复)
  • Docs(文档更新)
  • CI/CD(持续集成/持续部署)
  • Refactor(代码重构)
  • Perf(性能优化)
  • Dependency(依赖项更新)
  • Test-Cases(测试用例更新)
  • Other(其他)

Related Issue | 关联 Issue
#500 #501

🔍 Motivation / 变更动机

本 PR 覆盖响应异常检测的文档整理与一处收尾行为修复:

文档侧:

  1. --response-anomaly 参数说明中"(无 --no-response-anomaly 形态)"的括号注释专门强调一个并不存在的形态,属于冗余信息,容易引起误解。
  2. 原先嵌在 cli_args.md 中的"推理响应异常检测配置"章节存在结构问题:中文版里它插在"配置常量文件参数"标题与正文之间,把该节内容隔断;且特性级使用指南与参数参考页混杂,缺少从依赖安装到运行的完整说明。
  3. 开关默认态表述"不增加即关闭"容易被误解为"不加开关即被主动关闭",实际语义是默认不开启。
  4. 原文档引导用户配置 response_anomaly 配置字段,但实际使用中无需任何配置:模型 path(实际运行必填)已驱动模型名推导与检测配置自动生成,功能仅靠两个命令行参数即可完整开启与调整。随之而来,path 末级目录名成为模型名的解析来源,需要提醒用户保持其与模型仓库中的模型名一致、勿随意改动。
  5. 用户视角的资料不应暴露内部检测器的实现名(msProbe / mindstudio-probe),统一改为中性表述。

代码侧:
6. 检测收尾只清理了 payload_staging/<数据集> 子目录(all 模式下被 rename 走,其余模式被 rmtree),但 response_anomaly/<模型>/payload_staging/ 目录本体残留为空壳,应在最后一个数据集检测完成后一并移除。
7. payload 归档 manifest 的分片校验值格式为 "sha256": "sha256:<hex>",字段名与值前缀重复了算法名,应存裸十六进制摘要。
8. workers 的检测汇总日志与单任务完成日志文案完全相同("Response anomaly detection completed"),控制台无法区分;汇总条应体现汇总语义。

This PR covers documentation cleanup plus one finalization-behavior fix for response anomaly detection. Docs: removed the redundant non-existent-flag note; moved the feature guide from cli_args.md into a standalone advanced tutorial (fixing the orphaned heading); reworded the default state to "off by default"; reworked the guide into a zero-config narrative (two CLI switches, model path drives everything) with a reminder that the path directory name must match the model-repo name; dropped internal msProbe/mindstudio-probe naming. Code: detection cleanup left an empty payload_staging shell directory under response_anomaly/<model> — the shell is now removed once the last dataset of the model finishes detection.

📝 Modification / 修改内容

代码:

  • _process_staged_payloads 在按数据集清理 staging 后,对 payload_staging 根目录执行 rmdir()(仅空目录可删,OSError 静默忽略):同模型多数据集场景下只有最后一个数据集收尾时才会真正删除空壳,无需额外状态跟踪。

测试(tests/UT/utils/test_response_anomaly.py):

  • 新增 test_detection_removes_payload_staging_shell:构造带 payload_staging 的运行目录,驱动 _detect 全流程后断言 payload_staging/<数据集> 与 payload_staging/ 目录本体均不存在。
  • response_anomaly_jsonl.py:两个 manifest 构建点(writer 收尾与 build_jsonl_zstd_manifest)的分片 sha256 值去掉 sha256: 前缀,存裸十六进制摘要;对应 UT 断言升级为与分片文件重算哈希精确比对。
  • workers.py:检测汇总日志改为带任务数的汇总语义("Response anomaly detection summary across N task(s)"),与单任务完成日志区分;单任务完成日志与任务专属日志保持不变。
  • 新增 test_detect_summary_aggregates_across_tasks:验证多数据集下 summary 为全量聚合、各任务日志仅含本任务统计。

文档:

  • 删除 zh/en cli_args.md 中 --response-anomaly 行的冗余括号注释。
  • 统一开关默认态表述:"不增加默认不开启" / "omitting it leaves detection off by default"。
  • 新增 zh/en 独立进阶教程页 advanced_tutorials/response_anomaly_detection.md(概述 / 前置条件 / 安装依赖 / 快速使用 / 运行流程与落盘结构 / 检测结果说明 / 断点续跑),零配置叙事,快速使用仅需 --response-anomaly 与 --response-anomaly-payload-retention 两个命令行参数。
  • 从 zh/en cli_args.md 迁出原章节并修复孤儿标题;从 models.md 移除 response_anomaly 参数行与代码示例配置块。
  • 新增 path 填写提醒(models.md 参数行 + 教程页提示,zh/en):末级目录名需与 Hugging Face / ModelScope / Modelers 模型名一致。
  • 清除全部 msProbe / mindstudio-probe 内部名字眼(15 处,zh/en)。
  • payload 保留表格表头标注参数名;检测流程删去 prediction 表述;归档收尾连词"或"改"及";staging 清理表述更新为"连同目录一并清理"。
  • 更新 6 处交叉链接;注册 toctree(zh/en index.rst)。

Code: _process_staged_payloads now rmdir()s the payload_staging root after the per-dataset cleanup (rmdir only succeeds on an empty dir, so the shell disappears exactly when the last dataset of the model finalizes). Test: new test_detection_removes_payload_staging_shell UT. Docs: standalone zh/en tutorial with zero-config narrative, wording fixes, de-branding, path naming reminder, and the staging-cleanup wording updated to match the new behavior.

📐 Associated Test Results / 关联测试结果

  • python3 -m pytest tests/UT/utils/test_response_anomaly.py -q → 46 passed(含新增用例)
  • python3 -m pytest tests/UT/utils/test_response_anomaly_jsonl.py -q → 3 passed(断言升级后)
  • python3 -m pytest tests/UT/utils/test_response_anomaly.py tests/UT/cli/test_workers.py -q → 83 passed(含新增用例)
  • python3 -m pytest tests/UT/utils/test_response_anomaly_jsonl.py tests/UT/cli/test_config_manager.py -q → 72 passed, 9 subtests passed
  • 文档侧验证:全仓检索旧锚点/旧表述/配置字段引导/msProbe 字眼均零残留(仅 install.md 保留依赖安装命令、best_practices 保留无关量化工具提及);交叉链接全部有效;新增文件 LF 行尾;中英结构对称。可按需触发 /readthedocs build。

Docs checks: repo-wide searches show zero stale anchors / old wording / config-field guidance / internal naming; all links resolve; LF endings; zh/en symmetric. /readthedocs build can be triggered if needed.

⚠️ BC-breaking (Optional) / 向后不兼容变更(可选)

无。payload_staging 为运行期临时目录,检测完成后本就应消失;--reuse 续跑逻辑依据 prediction/result 与 payload 归档匹配,不依赖该目录存在。 / None.

⚠️ Performance degradation (Optional) / 性能下降(可选)

无(单次空目录 rmdir,开销可忽略)。 / None.

🌟 Use cases (Optional) / 使用案例(可选)

不涉及新功能 / N.A.

✅ Checklist / 检查列表

Before PR:

  • Pre-commit or other linting tools are used to fix the potential lint issues. / 使用预提交或其他 linting 工具来修复潜在的 lint 问题。
  • Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests. / 修复的 Bug 已完全由单元测试覆盖,导致 Bug 的情况应在单元测试中添加。(新增 test_detection_removes_payload_staging_shell)
  • The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness. / 此拉取请求中的修改已完全由单元测试覆盖。如果不是,请添加更多单元测试以确保正确性。
  • All relevant documentation (API docs, docstrings, example tutorials) has been updated to reflect these changes. / 所有相关文档(API 文档、文档字符串、示例教程)已更新以反映这些更改。

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with those projects. / 如果此拉取请求对下游或其他相关项目有潜在影响,应在那些项目中测试此 PR。
  • CLA has been signed and all committers have signed the CLA in this PR. / CLA 已签署,且本 PR 中的所有提交者均已签署 CLA。

👥 Collaboration Info / 协作信息

🌟 Useful CI Command / 实用的CI命令

Command / 命令 Introduction / 介绍
/gemini review Performs a code review for the current pull request in its current state by Gemini. / 对当前拉取请求在当前状态下由 Gemini 执行代码审核。
/gemini summary Provides a summary of the current pull request in its current state by Gemini. / 对当前拉取请求在当前状态下由 Gemini 提供摘要。
/gemini help Displays a list of available commands of Gemini. / 显示 Gemini 可用命令的列表。
/readthedocs build Triggers a build of the documentation for the current pull request in its current state by Read the Docs. / 触发当前拉取请求在当前状态下由 Read the Docs 构建文档。
/pr_check 手动重新触发 PR 合入质量检查工作流(PR Quality Check),并在 PR 上评论即可生效。 / Manually re-runs the PR Quality Check workflow by commenting on the pull request.

Copilot AI lite review requested due to automatic review settings August 27, 2026 12:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the no_issue PR 未关联任何 Issue,合入前必须关联 Issue label Aug 27, 2026
@github-actions

Copy link
Copy Markdown

🚫 PR 合入质量检查未通过,PR 已被禁止合入。

未通过项:no_issue

  • 未关联 Issue:请在 PR 描述中关联 Issue,例如 Fixes #123 或 Relates to #123。

请按上述提示整改后,重新推送(push)或评论本 PR 即可触发再次检查。

@github-actions github-actions Bot added the docs label Aug 27, 2026
The parenthetical noting the absence of a --no-response-anomaly flag adds noise rather than information: omitting --response-anomaly already implies detection is disabled.
@github-actions github-actions Bot removed the no_issue PR 未关联任何 Issue,合入前必须关联 Issue label Aug 27, 2026
@github-actions

Copy link
Copy Markdown

✅ PR 合入质量五项检查全部通过,允许合入。

… tutorial

The response anomaly detection section was previously embedded in cli_args.md, where it split the Configuration Constant File Parameters heading from its content (zh) and mixed feature-level guidance into a parameter reference page. Move it into a standalone advanced tutorial page (zh/en) restructured as a complete guide from dependency installation to configuration, fix the orphaned heading, point the --response-anomaly CLI rows to the new page, update all cross links (models/mode/accuracy_benchmark), and register the new page in the toctree.
Copilot AI review requested due to automatic review settings August 27, 2026 12:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

✅ PR 合入质量五项检查全部通过,允许合入。

@Libotry Libotry changed the title docs: remove redundant no-response-anomaly absence notes docs: clean up and restructure response anomaly detection documentation Aug 27, 2026
The wording 不增加即关闭/不增加则关闭 (omitting it disables detection) reads like omitting the flag actively disables the feature; reword to 不增加默认不开启 (not enabled by default) and align the English wording accordingly.
Copilot AI review requested due to automatic review settings August 27, 2026 12:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

✅ PR 合入质量五项检查全部通过,允许合入。

The feature needs no config-file fields in practice: the model path field (always set for real runs) drives model-name derivation and msProbe config auto-generation, and payload retention is controlled by the --response-anomaly-payload-retention CLI switch. Drop the global and model-level response_anomaly config-block guidance from the tutorial, the models.md code sample and parameter table, and rework Quick Start around the two CLI switches.
Copilot AI review requested due to automatic review settings August 27, 2026 13:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

✅ PR 合入质量五项检查全部通过,允许合入。

User-facing docs should not expose the internal detector implementation name. Replace msProbe/mindstudio-probe wording with neutral terms (built-in anomaly detection, detector source, detection configs) across the tutorial, cli_args/mode/accuracy_benchmark notes and the install guide, zh and en. The pip extra name response_anomaly remains the single user-facing handle for the dependency.
Copilot AI review requested due to automatic review settings August 28, 2026 00:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

✅ PR 合入质量五项检查全部通过,允许合入。

…el repositories

The path directory basename is the model-name source for detection; document that it must stay consistent with the model name on Hugging Face / ModelScope / Modelers and must not be renamed arbitrarily, in the models.md path row and the anomaly detection tutorial tip (zh/en).
Copilot AI review requested due to automatic review settings August 28, 2026 00:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

✅ PR 合入质量五项检查全部通过,允许合入。

Copilot AI review requested due to automatic review settings August 28, 2026 01:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

✅ PR 合入质量五项检查全部通过,允许合入。

Retention and staging cleanup both happen during archive finalization; use and/及 instead of or (zh/en).
Copilot AI review requested due to automatic review settings August 28, 2026 01:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

✅ PR 合入质量五项检查全部通过,允许合入。

Detection cleanup only removed the per-dataset staging subtree (or renamed it away in all mode), leaving an empty payload_staging directory under response_anomaly/<model>. rmdir the staging root after the per-dataset cleanup; it only succeeds when the last dataset of the model finishes detection, so multi-dataset runs stay safe. Covered by a new UT; wording in the zh/en tutorial updated accordingly.
Copilot AI review requested due to automatic review settings August 28, 2026 01:18
@Libotry
Libotry temporarily deployed to smoke-test-approval August 28, 2026 01:18 — with GitHub Actions Inactive

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

✅ PR 合入质量五项检查全部通过,允许合入。

@Libotry Libotry changed the title docs: clean up and restructure response anomaly detection documentation docs: restructure response anomaly detection docs; remove empty payload_staging shell Aug 28, 2026
The shard checksum value was formatted as sha256:<hex> while the field is already named sha256, duplicating the algorithm name. Store the bare hex digest in both manifest builders and strengthen the UT to compare against the hash recomputed from the shard file.
Copilot AI review requested due to automatic review settings August 28, 2026 01:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Libotry
Libotry temporarily deployed to smoke-test-approval August 28, 2026 01:59 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown

✅ PR 合入质量五项检查全部通过,允许合入。

…ion log

The finalize step logged the aggregated summary with the exact same wording as the per-task completion line, making them indistinguishable in the console. The summary line now reads Response anomaly detection summary across N task(s). Per-task completion logs and dedicated task log files are unchanged; a new UT covers multi-dataset aggregation (summary totals) and per-task log isolation.
Copilot AI review requested due to automatic review settings August 28, 2026 02:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Libotry
Libotry temporarily deployed to smoke-test-approval August 28, 2026 02:17 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown

✅ PR 合入质量五项检查全部通过,允许合入。

@zhongzhouTan-coder
zhongzhouTan-coder merged commit 6fa4f7d into AISBench:master Aug 28, 2026
12 checks passed
@Libotry Libotry changed the title docs: restructure response anomaly detection docs; remove empty payload_staging shell bugfix and docs: restructure response anomaly detection docs; remove empty payload_staging shell Sep 20, 2026
zhongzhouTan-coder pushed a commit that referenced this pull request Sep 21, 2026
…566)

* docs: remove redundant response_anomaly preset note from models.md

The paragraph stating that the common model templates do not preconfigure response_anomaly adds no information (an unset field is the default state) and references a response_anomaly example block that no longer exists after #502, leaving a dangling pointer; remove it from zh/en.

* docs: reword staging retention as keep-or-clean in anomaly tutorial

The archive finalization step decides between keeping the staging data as archive or cleaning it up depending on the retention mode; use or (zh: 或) instead of and (zh: 及) in zh/en.

This branch was previously deployed

1 inactive deployment
smoke-test-approval — e9a308d5 Deployed Aug 28, 2026 by Libotry via run_smoke_test_cases #635
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants