Skip to content

test: 为照片用纸增加首份 PDF 区域保护评测 - #92

Merged
SXP-Simon merged 2 commits into
mainfrom
test/rsi-photo-first-pdf
Dec 1, 2026
Merged

SXP-Simon merged 2 commits into
mainfrom
test/rsi-photo-first-pdf

Conversation

@SXP-Simon

@SXP-Simon SXP-Simon commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

为什么值得测

识别到横线不等于写进了指定的栏。笔迹也可能太大,即使字的基线贴着横线,仍盖到原有印字。这个脚本给出六张可重复生成的合成纸,用第一份实际 PDF 检查这些问题。

两条路怎么比

  • 直接出稿:保留自动识别结果,导出一份 PDF。
  • 先核对再出稿:量文字是否越过允许区或盖住旧印字。必要时采用题目已经给定的参考线,重新核对。如果仍不满足,就不导出。

这只是实验脚本和说明,不改变用户默认流程。不假设真实 Agent 已能自己看图找到参考线。

实测

同一份输入和种子,在 bd144204 和匹配的 Worker 上跑真实 MCP。首份合格 PDF 1/6 → 5/6;发出的不合格 PDF 5 → 0;调用 24 → 38。最后一张有冲突,停止,不计作正确交付。11 份实际 PDF 与各自的预览像素一致,正确性另由位置和保护区条件判断。

复跑说明和数据。所有公开样例由脚本生成,不包含真实照片。没有合并或开启 CI。

Summary by Sourcery

为照片用纸增加可复现的首份 PDF 区域保护评测。

Enhancements:

  • 新增基于六张合成照片用纸的首份 PDF 区域保护对照评测,比较直接导出与发布前核对,并在区域检查仍不通过时停止导出。

Documentation:

  • 新增实验说明,记录评测方法、复跑步骤和实测结果。

Tests:

  • 新增像素评分规则的单元测试,验证各行均须有可见笔迹。

背景:自动识别的横线可能不在用户指定的栏,预览与 PDF 一致也无法验证位置。

解决手段:生成合成纸并在同种子下对比直接交付与区域预检,记录首份成品、越界笔迹和保留栏。

收益:用可复跑的实际文件区分正确交付、错误交付和安全停止,不影响生产行为。

Copy link
Copy Markdown
Owner Author

第 1 轮:单看基线会漏掉什么

先用 3 张不同的合成纸选择对齐检查,再在 6 张独立的合成纸上冻结规则试跑。遇到一张纸,字的基线平均只偏 0.316 px,但实际有 77 px 笔迹越过允许区。后来在当前版本的一张新纸上复现:0.269 px 的基线偏差,仍有 118 px 越界。

所以下一轮不把「横线贴合」当作充分条件。把基线误差、笔迹范围、保留印字拆成三项,另外核对首份 PDF 确实是那一版。已有照片验收指引仍保留,实验脚本不重复增加产品提示。

Copy link
Copy Markdown
Owner Author

第 2 轮:当前版本的六张留出纸复验

bd144204 + 与源码匹配的 Worker e7179454…,默认 TeX 配置,真实 stdio 共 62 次调用。两组用相同底纸、内容和随机种子。

  • 直接导出 1/6 合格,5 份出错。先核对再导出 5/6 合格、0 份出错,放弃 1 份确实无法满足保护要求的纸。
  • 11 份首份 PDF 各自与同版预览逐像素一致。发出的文件中,越界变化像素 13,384→0,保护区变化 2,601→0。越界统计只看已经发出的文件,不把停止当成画面正确。
  • 阻塞例用参考线后平均对齐误差约 0.404 px,并且没有写出允许区,但仍盖住 1,823 px 的保护区。候选拒绝导出。调用 24→38,不是免费改善。
  • 位置与参考线在实验里已由题目给出;此处没有测模型自己选位置的可靠度。公开脚本只生成合成样例。每次运行可留存真实调用和实际首份 PDF。

@sourcery-ai

sourcery-ai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Documentation

说明评测方法、复跑步骤及实测结果,并记录样例边界与验证条件。

  • docs/experiments/photo-zone-rsi.md L1-40

Tests

新增合成照片用纸的 MCP 对照实验,比较直接导出与区域预检,并检查首份 PDF、逐行可见墨迹、区域越界及受保护印字。

  • crates/panache-mcp/tests/photo_zone_rsi.py L1-254
  • crates/panache-mcp/tests/test_photo_zone_rsi.py L1-39

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

背景:照片评测仅检查位置与保护区域,布局正常的空白输出或缺行输出也可能达标。

解决手段:按四个目标行统计成图与底纸的可见差分,覆盖空白、逐行缺失与微弱噪声,并固定复跑依赖、更新结果入口。

收益:首份交付需要在每个目标行留下可见笔迹,评分条件和逐例结果都可独立复核。
@SXP-Simon
SXP-Simon marked this pull request as ready for review December 1, 2026 20:44
@SXP-Simon SXP-Simon added the run-ci 手动批准当前 PR 版本的相关 CI 检查 label Dec 1, 2026
@sourcery-ai

sourcery-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown

Sorry @SXP-Simon, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 5 days and 12 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@SXP-Simon
SXP-Simon merged commit 9dd40ca into main Dec 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci 手动批准当前 PR 版本的相关 CI 检查

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant