Skip to content

I-ML-01: 接通固定版本CPU推理、OCR证据与冻结名称候选(第36–41批) - #13

Merged
SayQuan1 merged 3 commits into
mainfrom
wsq/i-ml01-analysis-input
Oct 10, 2026
Merged

SayQuan1 merged 3 commits into
mainfrom
wsq/i-ml01-analysis-input

Conversation

@SayQuan1

@SayQuan1 SayQuan1 commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

变更说明

  • 任务编号:I-ML-01,第36–41批。
  • 需求 ID / Gate:R-03、R-06、R-07、R-09;AI-03/AI-04、AI-10/CAP-01 的局部工程覆盖、DB-02/JOB-02;SEC-03 的真实 MinIO 作用域权限证据。完整现场模型、UP-03/生产部署与独立批准仍待验收。
  • 变更目的:让巡检任务固定分析图的准确对象版本,通过常驻 CPU HTTP 执行官方 D-FINE COCO80 与 PP-OCRv6_small,并由独立 Worker 重建、上传和原子登记 OCR 证据。结果保留真实 bottle/未知关联、全部字段来源及冻结词典名称候选,统一进入人工复核。
  • 主要变更文件:apps/ai_inference/{analysis,inputs,bundle,runtime_cpu,supervisor}.py、apps/ai_inference/app/*;apps/worker/inference_evidence.py、packages/application/inference_execution.py、packages/inference_protocol/{association,fields,chemical,evidence}.py;packages/persistence/migrations/versions/0003_run_image_version.py、0004_ocr_evidence.py;contracts/*、tools/ml/*、.github/workflows/ci.yml、docs/08-delivery/36–41 及相关开发/设计文档。

影响范围

  • 产品/业务流程
  • 数据库/迁移
  • API 契约
  • AI 模型/数据
  • 规则
  • 权限/隐私/审计
  • 部署/监控
  • 仅文档

固定 analysis VersionId/SHA 与 run 输入;0004 支持独立文字区域证据。受控 development bundle/lock/pin、ready/version、串行子进程预算、取消/崩溃/退出清理与 Worker 围栏共同约束结果。文字只关联同图真实 COCO bottle;字段保留全部 source_lines,候选按全部同瓶 name 字段判断共识/冲突,Worker 核原始快照 SHA 并完整重算。开发词典不含安全分类,CPU runs 仍为 needs_review,无 DateFact/FactRevision 或新规则接线。

远程Push检查发现 IPC 发送完成时外层取消可能被 asyncio.wait_for 消费;补充 asyncio.timeout 修复及确定性取消/进程回收回归,原实现稳定重现超时,新实现正确传播取消。两份真实 MinIO/官方 CPU smoke 以修复后的代码锁重新生成,不复用旧锁宣称新代码通过。

验证

  • 测试命令:
    • .venv-business/Scripts/python.exe -B -m pytest tests/business tests/domain tests/security tests/protocol -q
    • .venv-ai/Scripts/python.exe -B -m unittest tests.ai.test_dfine_adapter tests.ai.test_cpu_runner tests.ai.test_cpu_pixels tests.ai.test_ocrv6_adapter tests.ai.test_quality_pixels tests.ai.test_pipeline_cpu tests.ai.test_crop_evidence tests.ai.test_analysis tests.ai.test_supervisor tests.ai.test_text_association_pixels tests.protocol.test_contract -q
    • .venv-business/Scripts/python.exe -B -m unittest tests.ai.test_fixture tests.ai.test_cpu_runner tests.ai.test_cpu_http -q
    • .venv-evidence/Scripts/python.exe -B -m unittest tests.worker.test_evidence_pixels -q
    • .venv-business/Scripts/python.exe -B tools/database/run_mysql_tests.py --mysqld 'D:/SQL/MySQL/MySQL Server 8.0/bin/mysqld.exe'
    • ruff check / ruff format --check apps packages tests tools/database tools/ml;tools/design/build_specs.py --check、tools/design/validate_specs.py;三环境 pip check、git diff --check。
  • 测试结果:2026-10-10本机主回归1795通过;取消修复后CPU/像素/supervisor/协议76通过,无跳过(含新增确定性取消用例,旧实现对照稳定失败);fixture/spawn/HTTP27通过;独立 Worker 像素9通过;隔离MySQL8.0.33完整持久化套件458通过、无跳过,head=0004_ocr_evidence/43表115FK无差异,独立临时实例已回收。主回归/MySQL各有1条既有Starlette/anyio弃用警告,无失败。三环境pip check与隔离检查、ruff 245文件及契约/设计检查(含148 readiness)通过。两份真实MinIO smoke已基于修复后的代码锁重跑通过。实现/修复提交726786c/ae53d0a,ae53d0a的远程业务、AI、CPU、Worker、Web和契约六类检查通过;最新head=56f3d91只更新交付文档/实施计划表格,已重新通过设计校验,其远程CI待完成。最终状态以PR检查页为准,不将本机成绩冒充远程通过。
  • 手工验证或截图:第41批真实官方 ONNX CPU HTTP → 独立 Worker → 独立临时 MinIO 已记录于 41-i-ml01-minio-smoke.json:11项真实 AccessDenied、读取固定旧V1(latest为坏V2)、34个裁剪的准确版本/SHA/复用及退出清理通过。四张素材瓶数3/1/0/0、34条文字,第三图为 cup,全部 needs_review。41-i-ml01-candidates-smoke.json 的正向候选使用明确 synthetic 测试词典与合成瓶框、真实 OCR,单独标记 is_simulated=true,不计现场模型准确率。Git 中只有脱敏工程摘要,无真实图片/OCR原文/模型权重/凭据。

风险与回滚

  • 已知风险:内部 OCRField/Version/InferenceResult 契约、profile 与 bundle/lock/pin 需 AI/Worker 协调升级;旧身份任务先排空。三套环境保持隔离,仅 dev/test,默认开关关闭、production 禁止,未安装 CUDA/Paddle/Torch。真实化学安全数据、日期/事实快照、公共 activation/多版本路由、现场校准、nginx/公开签名/TLS/持久部署与生产批准仍待后续。
  • 回滚提交/版本:应用基线 13a854f9b80b51d5c68d8ffd5a034701bcada528(main、PR I-ML-01: 官方 COCO80 与 PP-OCRv6 CPU 推理及可重建证据 #12);先停止接入/排空任务,恢复成套旧代码、契约、依赖环境与 bundle/lock/pin,保留已登记历史结果/对象,不手改摘要。
  • 数据迁移回滚或补偿:head 从0002推进为0003/0004,历史迁移不改写。保留新增列并采用备份/前向修复;历史 run 的 NULL准确版本不自动回填,由授权用户重新提交。0004存在独立NULL检测证据时拒绝 downgrade;仅明确可丢弃测试库允许破坏性降级,不删历史证据或审计。

审查清单

  • 没有提交 .obsidian/、.env、凭据或未脱敏数据
  • 已更新相关设计/API/数据库/运行文档
  • 已补充或更新测试
  • 已记录模型/规则/迁移版本(如适用)
  • 至少一名其他协作者审查

本 PR 涉及数据库、模型、权限与部署配置,按 CONTRIBUTING.md 需两名协作者共同确认;作者不代替独立审批,不自动合并。

…didates

Freeze analysis object versions and route official COCO80/PP-OCRv6_small CPU
inference through a pinned resident HTTP process. Rebuild OCR crops in an
isolated Worker, register all evidence with lease fencing, and recompute
bottle associations, source fields and frozen dictionary candidates.

Update generated contracts, migration head 0004, CI runtime isolation and
delivery records for batches 36-41. Keep results in needs_review and retain
unknown/conflicting evidence; development dictionaries contain no safety
classes. Record real MinIO version/IAM checks without assets or secrets.

Validation: pytest business/domain/security/protocol (1795); CPU/protocol
unittest (75); Worker pixels (9); fixture/HTTP and isolated MySQL regression;
ruff check/format, generated specs/design checks and environment pip checks.

Rollback: drain fixed-identity tasks, restore the matched prior application,
contracts, environments and bundle/lock/pin. Retain migration additions and
historical evidence; use backup/forward repair, never destructive production
downgrades or old-run version backfill. Base: 13a854f (PR #12).
Replace wait_for around the bounded IPC send with Python 3.11 timeout so
outer cancellation is not consumed by a concurrently completed send.
Add a deterministic regression that fails against the previous supervisor
and confirms cancellation reaps the CPU process and releases capacity.

Validation: 76 CPU/protocol tests and 27 fixture/HTTP tests pass; both
official CPU/real MinIO smoke records were rebuilt with the changed code
lock. Ruff, generated contracts and design validation pass. Sync batch
36-41 Git delivery status to PR #13 without claiming independent approval.

Rollback restores the matched previous application/contracts/environment
and bundle/lock/pin after draining fixed-identity tasks. No new migration
or change to historical evidence; retain additions and use forward repair.
Preserve the implementation-plan table formatting and record the final 458-test isolated MySQL regression. Link batch 36-41 delivery to PR #13 and distinguish local validation from pending CI and independent review. No runtime or migration changes; restore the prior document version for rollback.
@SayQuan1
SayQuan1 merged commit 1fd2696 into main Oct 10, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants