Files
zkxw/docs/superpowers/plans/2026-10-26-protocol-sample-code-lock.md
T
zlwuandCursor 5dad1bb0e3 fix: 协议子资源单事务保存,并补齐样本编码/OA/质检等近期能力
锁定缴费校验失败时整单回滚,避免样本半成功落库;前端禁止删除锁定缴费样本,改码走更正编码。同步落地样本更正、采集微信通知、OA提及未读、细胞产品套餐与相关迁移文档。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-26 11:02:25 +08:00

1.4 KiB
Raw Blame History

协议编辑锁定已落库样本编码 Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: 采集协议 / 科研捐赠编辑时,已落库样本编码只读;后端拒绝改码;新增样本仍可选码。

Architecture: 共享校验函数比对 payload id 与库中 sample_code/sample_code_id;Web SampleTransportFormSection 与小程序 ProtocolSampleTransportPanel 按是否有 id 锁控件。

Tech Stack: FastAPI/SQLAlchemy、Vue 3、mobile-oa-h5、pytest

Spec: docs/superpowers/specs/2026-10-26-protocol-sample-code-lock-design.md


Task 1: Backend 校验 + 测试

Files:

  • Modify: backend/app/crud/collection_protocol.py

  • Modify: backend/app/crud/research_donation.py

  • Create: backend/tests/test_protocol_sample_code_lock.py

  • 写失败用例 → 实现 validate_persisted_sample_codes_immutable → 接入两处 save → 测试通过

Task 2: Web UI 锁定

Files:

  • Modify: web-admin/src/components/business/sample-transport-form-section/index.vue

  • 编辑且有 id 时编码只读 + 提示

Task 3: 小程序 UI 锁定

Files:

  • Modify: mobile-oa-h5/src/market/components/ProtocolSampleTransportPanel.vue

  • 编辑且有 id 时编码只读 + 提示