Assign every v2 route and service file to a layer and enforce the doc-only v2 layer rules
维护者通常 2 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 20/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
Start with scripts/run_quality_guards.py, the rules under scripts/rules/, and the existing checks in tests/unit/v2/test_data_crud_boundaries.py; read rules/registry.toml and v2-code-organization.md for the current rule setup. Discover and classify all Python files under policyengine_api/services/v2 and policyengine_api/fastapi_routes/v2, then add the guard, rule citations, and proof fixtures. Done means every file has a layer, the listed layer rules are enforced or ratcheted, and the fixtures cover receiver-aware calls, TYPE_CHECKING imports, connector imports in routes, and an unassigned file.
由索引模型根据 Issue 内容生成。
描述
Four API v2 layer rules in rules/registry.toml are doc-only: nothing checks them.
api.v2.routes-no-sessions-or-sqlapi.v2.services-no-sqlapi.v2.connectors-never-commitapi.v2.connectors-no-cross-calls
The existing structural tests in tests/unit/v2/test_data_crud_boundaries.py match any call by method name (.add counts whether it is session.add or set.add), and nothing makes sure a new v2 file is checked at all.
Change
A v2-layers quality guard in the rules tool (scripts/rules/, run by scripts/run_quality_guards.py), standard library only:
-
Discover every
.pyfile underpolicyengine_api/services/v2andpolicyengine_api/fastapi_routes/v2and assign it to a layer by its file name (services.py,validators.py,database_connectors/reads.py,routes.py, and so on), or by a small manifest,rules/v2-layer-manifest.toml, for the few files with other names. Fail on any file that has no layer. This is new ruleapi.v2.files-assigned-to-layers. -
Check calls by their receiver (
session.add, not any.add) and SQL builders by where they are imported from, per layer:- route modules open no session and build no SQL;
- services build no SQL and call no data-access session method;
- connectors never open, commit, roll back or close a session.
Imports under
TYPE_CHECKINGcount. -
Make the three rules above
enforced, orratchetedwith a baseline of today's findings.api.v2.connectors-no-cross-callsbecame ratcheted with the Import Linter contracts in #4181. -
Give each rule a proof fixture, including a route that imports a connector and a file with no layer.
-
Cite each rule id in
v2-code-organization.md.
Open pull requests that add v2 files will have to give each new file a layer once this merges.
- 主要语言
- Python
- 星标
- 18
- 派生
- 33
- 平均合并
- 2 天 21 小时
- 30 天内合并 PR
- 93
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PolicyEngine/policyengine-api 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
PolicyEngine/policyengine-api#4037 ·
维护者通常 2 天内回复
-
难度 1/5 1-3 小时 新手友好度 88/100
PolicyEngine/policyengine-api#3911 ·
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
PolicyEngine/policyengine-api#3910 ·
维护者通常 2 天内回复
-
Check that every test function asserts something可能已有人在做 @anth-volk 今天认领。 未关闭
难度 4/5 3-5 天 新手友好度 25/100
PolicyEngine/policyengine-api#4187 ·
维护者通常 2 天内回复
-
Check that every noqa and type: ignore comment names a code and gives a reason可能已有人在做 @anth-volk 今天认领。 未关闭
难度 3/5 1-2 天 新手友好度 20/100
PolicyEngine/policyengine-api#4182 ·
维护者通常 2 天内回复
查看 PolicyEngine/policyengine-api 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
huggingface/deep-rl-class#723 ·
-
[tool] bug: Qwen3 XML tool parser raises on `...` argument values (Ellipsis is not JSON serializable)可能已有人在做 @super-yuki 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 87/100
verl-project/verl#8559 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
TencentCloud/octop-harness#228 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
google/osv-scalibr#2585 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
NousResearch/hermes-agent#149323 ·
维护者通常 1 天内回复