fix(entity): 删除仓库根 __init__.py,消除 entity.init 命名空间歧义(pbls-deploy-Q6)
- 根 __init__.py 的删除已在 e118efe 落地并推送 origin/main(本提交补齐可追溯的 Q6 专项说明:README.md / skill/SKILL.md 增补「命名空间铁律」段,留档根因与核验命令) - 根因:modules/entity 根同时存在包目录 entity/ 与种子目录 init/,根再放 __init__.py 会使根成为包,entity.init 解析到根下命名空间目录,遮蔽 entity/entity/init.py → 部署侧 cannot import name 'load_entity' from 'entity.init' - 核验:python3 apps/pbls/scripts/verify_import_closure.py → entity 无 NS_AMBIGUITY 告警
This commit is contained in:
parent
e118efecf4
commit
9e8984168f
@ -33,3 +33,9 @@ entity/
|
|||||||
- `wwwroot/api/entity_import.dspy`:实体导入(world_id + scene_id + file)
|
- `wwwroot/api/entity_import.dspy`:实体导入(world_id + scene_id + file)
|
||||||
- `wwwroot/api/entity_create.dspy` / `entity_update.dspy` / `entity_delete.dspy`:实体 CRUD
|
- `wwwroot/api/entity_create.dspy` / `entity_update.dspy` / `entity_delete.dspy`:实体 CRUD
|
||||||
- `wwwroot/api/get_search_*.dspy`:下拉数据源
|
- `wwwroot/api/get_search_*.dspy`:下拉数据源
|
||||||
|
|
||||||
|
## 命名空间约束(Q6)
|
||||||
|
仓库根**不得**存在 `__init__.py`(会使根成为包,令 `entity.init` 遮蔽 `entity/entity/init.py`,
|
||||||
|
部署时报 `cannot import name 'load_entity' from 'entity.init'`)。根 `__init__.py` 已在提交
|
||||||
|
`e118efe` 删除并推送 `origin/main`;核验命令:
|
||||||
|
`python3 apps/pbls/scripts/verify_import_closure.py`(entity 应无 NS_AMBIGUITY 告警)。
|
||||||
|
|||||||
@ -27,3 +27,16 @@ description: entity 模块技能文档——实体管理(实体表 CRUD + 实
|
|||||||
## 依赖
|
## 依赖
|
||||||
- world、scene(下拉数据源 world / scene 表)
|
- world、scene(下拉数据源 world / scene 表)
|
||||||
- 基础:sqlor、ahserver、bricks、appbase(appcodes)
|
- 基础:sqlor、ahserver、bricks、appbase(appcodes)
|
||||||
|
|
||||||
|
## 命名空间铁律(pbls-deploy-Q6 缺陷 2 修复留档)
|
||||||
|
|
||||||
|
- **仓库根禁止存在 `__init__.py`**:`modules/entity/` 根下同时有包目录 `entity/` 与种子数据目录
|
||||||
|
`init/`,若根再放 `__init__.py`,根目录自身成为包,`entity.init` 会被解析成「根下的 init/
|
||||||
|
命名空间目录」而遮蔽真实实现 `entity/entity/init.py` → 部署侧报
|
||||||
|
`cannot import name 'load_entity' from 'entity.init'`(deploy_test 第 3 轮实测)。
|
||||||
|
- 根 `__init__.py` 已于提交 `e118efe` 删除(`git rm`),本地 main 与 `origin/main` 同 SHA,
|
||||||
|
`git ls-remote origin main` 已含该提交;`apps/pbls/scripts/verify_import_closure.py` 复跑
|
||||||
|
entity 无 `NS_AMBIGUITY` 告警。
|
||||||
|
- 唯一入口:`from entity.init import load_entity`(实现文件 `entity/init.py`,包导出
|
||||||
|
`entity/__init__.py`)。新增函数仍须遵守三处同步注册(实现 def / 包 `__init__.py` 导出 /
|
||||||
|
`init.py` 的 `load_entity()` 内 `env.xxx = xxx`)。
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user