Repository navigation
I-02A–F2: 实现身份、巡检基础与上传验证受理 - #9
Merged
Merged
Conversation
Implement I-02A through I-02F2 with 31 dev/test APIs, domain guards, tenant authorization, atomic idempotency and audit, and pinned upload validation intents. Preserve remaining workflow and worker boundaries. Validation: pytest business/domain/security/persistence unit 1283 passed; isolated MySQL suite 213 passed (192 database + 21 overlapping unit); Ruff and design checks passed. See docs/08-delivery acceptance records for commands and limitations. Rollback: disable identity/uploads feature flags and restart; retain business, task, outbox, audit and idempotency history. No migration changes; existing signed URLs expire naturally. Requires independent security/database review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
本 PR 接通 dev/test 的身份、角色、组织、模板、巡检草稿、巡检项查询和上传验证受理,共 31 个公共业务接口。客户端可以创建巡检草稿并提交上传完成请求,服务端固定对象版本并原子登记 validating 图像、验证任务和 TaskDispatch;后台消费尚未实现,因此不会将图像伪标 ready。
影响范围
主要文件:apps/api/app/{identity,foundations,item_queries,uploads,main}.py;packages/{domain,application,persistence} 的对应模块;packages/storage/s3.py;tests/{business,domain,persistence,security};DEVELOPMENT.md、docs/08-delivery/01-implementation-plan.md、10–16 批次验收记录及 API/编码规范;.env.example、requirements/py311-business.txt、pyproject.toml 和 .github/workflows/ci.yml。
实现当前权限重验、CSRF、幂等重放、最后管理员保护、租户/实验室隔离和事务原子性。上传 HEAD 在数据库事务外,提交前再次检查 owner/期限/声明 hash;同 upload 不重复创建 image/task。图像查询不暴露内部对象引用。Python 3.11 业务/AI 环境保持隔离,boto3 仅在业务环境安装。
验证
Windows / Python 3.11.4 本地结果:
python -m pytest tests/business tests/domain tests/security tests/persistence/test_unit.py -q --tb=short:1283 passed,含 1 个既有 Starlette/AnyIO 弃用警告。python tools/database/run_mysql_tests.py --mysqld <isolated-mysqld>:213 passed;192 项真实 MySQL + 21 项与主套件重叠的单元测试。MySQL 8.0.33、0001_initial、43 表/115 外键、结构 errors=[]。本次文档纠正了 F2 曾沿用 F1 的 157 项统计。python -m ruff check apps packages tests tools/database、python -m ruff format --check apps packages tests tools/database:PASS,106 文件。python -m unittest discover -s tests/ai -t . -v:15 passed;两个环境各运行协议测试 4 passed;AI 无业务/S3/模型依赖检查通过。python -B tools/design/build_specs.py --check、test_readiness_design.py、validate_specs.py:16 份生成物无漂移、148 项 synthetic readiness checks、228 个文档链接通过。git diff --check通过。SDK 签名为真实本地计算,HEAD/GET 使用 Stubber;没有真实 MinIO/IAM/nginx/TLS、GPU/模型或浏览器联调证据。远程 CI 以本 PR checks 为准。风险与回滚
审查清单
请通过 PR 审查后按仓库规范 Squash merge;本次不自动合并。