From 48a26e5375f9767ed397be3b32b8d57e5017e07d Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 23 Aug 2026 21:40:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20org=20scope=20=E7=BC=BA=E7=9C=81?= =?UTF-8?q?=E7=BB=A7=E6=89=BF=E2=80=94=E2=80=94ocai(org=5Fid=3D'0')?= =?UTF-8?q?=E6=9C=BA=E6=9E=84=E6=8A=80=E8=83=BD=E6=89=80=E6=9C=89=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E5=85=B1=E4=BA=AB=EF=BC=8C=E5=85=B6=E4=BB=96=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E5=8F=AF=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 机构技能层架构:org_id='0' 是 ocai 组织(缺省机构),其机构技能(基础模块 apppublic/sqlor/ahserver/rbac/appbase/accounting 的应用/模块规范)是所有组织 缺省共享的内容;其他组织(org_id≠'0')先继承 ocai 缺省,再用自己 org scope 的同名技能覆盖(很多组织有自己的开发规范)。 get_merged 改为:先 update _orgs['0'](ocai 缺省),再 update _orgs[org_id] (组织自有,org_id≠'0' 时),实现缺省继承 + 组织覆盖。 --- pipeline_core/skill_loader.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pipeline_core/skill_loader.py b/pipeline_core/skill_loader.py index 697b48d..6dc77d8 100644 --- a/pipeline_core/skill_loader.py +++ b/pipeline_core/skill_loader.py @@ -321,7 +321,9 @@ class SkillLoader: """按优先级合并七级技能。同名技能高优先级覆盖低优先级。 优先级(低→高):global → project_common → pipeline → org → project → role → user - """ + org scope 缺省继承:org_id='0' 是 ocai 组织(缺省机构),其机构技能是所有组织共享的 + 缺省内容;其他组织(org_id≠'0')先继承 ocai 的机构技能,再用自己 org scope 的同名技能覆盖 + (很多组织有自己的开发规范)。""" merged = dict(self._global) # 项目通用(projects/,所有项目共享) @@ -330,7 +332,12 @@ class SkillLoader: if pipeline_id and pipeline_id in self._pipelines: merged.update(self._pipelines[pipeline_id]) - if org_id and org_id in self._orgs: + # 缺省机构技能:ocai(org_id='0')的机构技能,所有组织缺省共享 + if '0' in self._orgs: + merged.update(self._orgs['0']) + + # 组织自有机构技能覆盖 ocai 缺省(org_id='0' 已在上一步加载,跳过重复) + if org_id and org_id != '0' and org_id in self._orgs: merged.update(self._orgs[org_id]) # 项目私有(orgs/{org_id}/{project_id}/)