infraro-core 0.23.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- infraro_core-0.23.1/LICENSE +21 -0
- infraro_core-0.23.1/PKG-INFO +275 -0
- infraro_core-0.23.1/README.md +248 -0
- infraro_core-0.23.1/pyproject.toml +160 -0
- infraro_core-0.23.1/setup.cfg +4 -0
- infraro_core-0.23.1/src/infra_core/__init__.py +3 -0
- infraro_core-0.23.1/src/infra_core/autofix_demo.py +18 -0
- infraro_core-0.23.1/src/infra_core/cli.py +243 -0
- infraro_core-0.23.1/src/infra_core/engine/__init__.py +50 -0
- infraro_core-0.23.1/src/infra_core/engine/anchor_gate.py +164 -0
- infraro_core-0.23.1/src/infra_core/engine/droid_review/__init__.py +1 -0
- infraro_core-0.23.1/src/infra_core/engine/droid_review/plan_shards.py +130 -0
- infraro_core-0.23.1/src/infra_core/engine/droid_review/publish_findings.py +445 -0
- infraro_core-0.23.1/src/infra_core/engine/droid_review/repair_shard_findings.py +163 -0
- infraro_core-0.23.1/src/infra_core/engine/evolution_adapters.py +431 -0
- infraro_core-0.23.1/src/infra_core/engine/evolution_heartbeat.py +958 -0
- infraro_core-0.23.1/src/infra_core/engine/evolution_scanner.py +1755 -0
- infraro_core-0.23.1/src/infra_core/engine/evolution_self_audit.py +972 -0
- infraro_core-0.23.1/src/infra_core/engine/evolution_utils.py +2071 -0
- infraro_core-0.23.1/src/infra_core/engine/extract_anchor.py +111 -0
- infraro_core-0.23.1/src/infra_core/engine/version_sync.py +775 -0
- infraro_core-0.23.1/src/infra_core/governance.py +190 -0
- infraro_core-0.23.1/src/infra_core/guard.py +267 -0
- infraro_core-0.23.1/src/infra_core/packs/__init__.py +1 -0
- infraro_core-0.23.1/src/infra_core/packs/memory/__init__.py +25 -0
- infraro_core-0.23.1/src/infra_core/packs/memory/_daily_base.py +266 -0
- infraro_core-0.23.1/src/infra_core/packs/memory/_daily_checks.py +493 -0
- infraro_core-0.23.1/src/infra_core/packs/memory/_daily_cli.py +348 -0
- infraro_core-0.23.1/src/infra_core/packs/memory/_daily_infra.py +764 -0
- infraro_core-0.23.1/src/infra_core/packs/memory/_daily_report.py +415 -0
- infraro_core-0.23.1/src/infra_core/packs/memory/daily_audit.py +216 -0
- infraro_core-0.23.1/src/infra_core/packs/memory/error_patterns.py +972 -0
- infraro_core-0.23.1/src/infra_core/packs/memory/hygiene.py +663 -0
- infraro_core-0.23.1/src/infra_core/packs/memory/layout_audit.py +1528 -0
- infraro_core-0.23.1/src/infra_core/packs/memory/ownership_reader.py +137 -0
- infraro_core-0.23.1/src/infra_core/packs/memory/pack.py +164 -0
- infraro_core-0.23.1/src/infra_core/py.typed +1 -0
- infraro_core-0.23.1/src/infraro_core.egg-info/PKG-INFO +275 -0
- infraro_core-0.23.1/src/infraro_core.egg-info/SOURCES.txt +147 -0
- infraro_core-0.23.1/src/infraro_core.egg-info/dependency_links.txt +1 -0
- infraro_core-0.23.1/src/infraro_core.egg-info/entry_points.txt +10 -0
- infraro_core-0.23.1/src/infraro_core.egg-info/requires.txt +12 -0
- infraro_core-0.23.1/src/infraro_core.egg-info/top_level.txt +1 -0
- infraro_core-0.23.1/tests/test_audit_project_layout.py +838 -0
- infraro_core-0.23.1/tests/test_audit_telemetry_coverage.py +25 -0
- infraro_core-0.23.1/tests/test_auto_merge_gate_contract.py +335 -0
- infraro_core-0.23.1/tests/test_auto_merge_pipeline_hardening.py +148 -0
- infraro_core-0.23.1/tests/test_auto_merge_read_write_token_contract.py +336 -0
- infraro_core-0.23.1/tests/test_auto_merge_triage.py +1188 -0
- infraro_core-0.23.1/tests/test_auto_merge_workflow_contract.py +494 -0
- infraro_core-0.23.1/tests/test_autofix_demo.py +24 -0
- infraro_core-0.23.1/tests/test_boundary_guard.py +117 -0
- infraro_core-0.23.1/tests/test_branch_cleanup.py +2624 -0
- infraro_core-0.23.1/tests/test_branch_cleanup_action_copies.py +117 -0
- infraro_core-0.23.1/tests/test_branch_cleanup_issue.py +1417 -0
- infraro_core-0.23.1/tests/test_budget_guard_recovery_close.py +88 -0
- infraro_core-0.23.1/tests/test_check_droid_review.py +478 -0
- infraro_core-0.23.1/tests/test_check_zero_red.py +284 -0
- infraro_core-0.23.1/tests/test_ci_fallback_repo_routing.py +365 -0
- infraro_core-0.23.1/tests/test_ci_health_check.py +25 -0
- infraro_core-0.23.1/tests/test_ci_structure_contract.py +514 -0
- infraro_core-0.23.1/tests/test_ci_timeout_watchdog.py +801 -0
- infraro_core-0.23.1/tests/test_cli.py +105 -0
- infraro_core-0.23.1/tests/test_code_hygiene_audit.py +1222 -0
- infraro_core-0.23.1/tests/test_code_hygiene_audit_silent_swallow.py +97 -0
- infraro_core-0.23.1/tests/test_core_delivery_import_contract.py +212 -0
- infraro_core-0.23.1/tests/test_cross_e2e_observability.py +89 -0
- infraro_core-0.23.1/tests/test_daily_audit_facade_contract.py +195 -0
- infraro_core-0.23.1/tests/test_daily_kb_audit_coverage.py +1138 -0
- infraro_core-0.23.1/tests/test_daily_kb_audit_main.py +451 -0
- infraro_core-0.23.1/tests/test_daily_kb_audit_source_repo.py +150 -0
- infraro_core-0.23.1/tests/test_deadlock_exit_retrigger.py +709 -0
- infraro_core-0.23.1/tests/test_doc_classification_guard.py +130 -0
- infraro_core-0.23.1/tests/test_documentation_contract.py +400 -0
- infraro_core-0.23.1/tests/test_drift_gate.py +391 -0
- infraro_core-0.23.1/tests/test_drift_watch_reverse.py +315 -0
- infraro_core-0.23.1/tests/test_drift_watch_reverse_integration.py +267 -0
- infraro_core-0.23.1/tests/test_droid_autofix_notify_filter.py +152 -0
- infraro_core-0.23.1/tests/test_droid_cli_host_first.py +330 -0
- infraro_core-0.23.1/tests/test_droid_review_aggregate_action.py +266 -0
- infraro_core-0.23.1/tests/test_droid_review_byom_tailnet.py +310 -0
- infraro_core-0.23.1/tests/test_droid_review_exit137_resilience.py +494 -0
- infraro_core-0.23.1/tests/test_droid_review_fork_guard.py +170 -0
- infraro_core-0.23.1/tests/test_droid_review_repair_findings.py +191 -0
- infraro_core-0.23.1/tests/test_droid_review_shard_timeout.py +65 -0
- infraro_core-0.23.1/tests/test_droid_review_sharding.py +772 -0
- infraro_core-0.23.1/tests/test_droid_review_shards_workflow.py +440 -0
- infraro_core-0.23.1/tests/test_droid_review_watchdog_handlers_workflow.py +254 -0
- infraro_core-0.23.1/tests/test_droid_review_watchdog_quota_sweep.py +163 -0
- infraro_core-0.23.1/tests/test_droid_task_executor.py +620 -0
- infraro_core-0.23.1/tests/test_engine_authorization_gate_contract.py +698 -0
- infraro_core-0.23.1/tests/test_engine_lazy_init.py +66 -0
- infraro_core-0.23.1/tests/test_error_pattern_detector.py +1951 -0
- infraro_core-0.23.1/tests/test_error_pattern_detector_silent_swallow.py +68 -0
- infraro_core-0.23.1/tests/test_evolution_heartbeat.py +1780 -0
- infraro_core-0.23.1/tests/test_evolution_scan_heartbeat_workflow.py +413 -0
- infraro_core-0.23.1/tests/test_evolution_scanner.py +11074 -0
- infraro_core-0.23.1/tests/test_fix_has_test_guard.py +198 -0
- infraro_core-0.23.1/tests/test_gate1_fail_closed.py +272 -0
- infraro_core-0.23.1/tests/test_gate3_release_window.py +183 -0
- infraro_core-0.23.1/tests/test_gate_a_sync_origin_labels.py +93 -0
- infraro_core-0.23.1/tests/test_gh_proxy_contract.py +80 -0
- infraro_core-0.23.1/tests/test_gh_repo_context_guard.py +277 -0
- infraro_core-0.23.1/tests/test_governance.py +273 -0
- infraro_core-0.23.1/tests/test_governance_paths_contract.py +166 -0
- infraro_core-0.23.1/tests/test_guard.py +302 -0
- infraro_core-0.23.1/tests/test_h1_alwayscheck_earlyexit.py +723 -0
- infraro_core-0.23.1/tests/test_livetruth_probes_contract.py +161 -0
- infraro_core-0.23.1/tests/test_local_branch_cleanup.py +1123 -0
- infraro_core-0.23.1/tests/test_memory_pack_entrypoints.py +205 -0
- infraro_core-0.23.1/tests/test_naming_contract.py +906 -0
- infraro_core-0.23.1/tests/test_no_old_repo_references.py +68 -0
- infraro_core-0.23.1/tests/test_notification_linear_isolation.py +683 -0
- infraro_core-0.23.1/tests/test_onboarding_guide_contract.py +47 -0
- infraro_core-0.23.1/tests/test_p0a_guard.py +106 -0
- infraro_core-0.23.1/tests/test_pack_seam_contracts.py +382 -0
- infraro_core-0.23.1/tests/test_platform_governance_contract.py +735 -0
- infraro_core-0.23.1/tests/test_poll_releases_contract.py +577 -0
- infraro_core-0.23.1/tests/test_posthog_webhook_hardening.py +60 -0
- infraro_core-0.23.1/tests/test_pr_ref_consistency_guard.py +369 -0
- infraro_core-0.23.1/tests/test_publish_findings_crossrun_dedup.py +576 -0
- infraro_core-0.23.1/tests/test_pypi_dist_name_contract.py +165 -0
- infraro_core-0.23.1/tests/test_quality_gate_contract.py +142 -0
- infraro_core-0.23.1/tests/test_real_shell_adversarial_matrix.py +137 -0
- infraro_core-0.23.1/tests/test_reconcile_failed_exit.py +134 -0
- infraro_core-0.23.1/tests/test_red_pr_sweeper.py +1313 -0
- infraro_core-0.23.1/tests/test_release_announce_contract.py +597 -0
- infraro_core-0.23.1/tests/test_repo_health_check.py +230 -0
- infraro_core-0.23.1/tests/test_run_shard_error_classification.py +582 -0
- infraro_core-0.23.1/tests/test_runner_toolchain_contract.py +243 -0
- infraro_core-0.23.1/tests/test_self_audit_config_packs.py +134 -0
- infraro_core-0.23.1/tests/test_setup_venv_action.py +45 -0
- infraro_core-0.23.1/tests/test_stale_orphan_fallback.py +325 -0
- infraro_core-0.23.1/tests/test_suppress_drift_guard.py +154 -0
- infraro_core-0.23.1/tests/test_suppression_expiry.py +436 -0
- infraro_core-0.23.1/tests/test_sweep_pipeline_fix.py +250 -0
- infraro_core-0.23.1/tests/test_sync_webhook_scripts.py +929 -0
- infraro_core-0.23.1/tests/test_tick_budget.py +216 -0
- infraro_core-0.23.1/tests/test_trigger_ci_droid_fallback.py +1112 -0
- infraro_core-0.23.1/tests/test_trigger_ci_droid_routing.py +387 -0
- infraro_core-0.23.1/tests/test_trigger_release_contract.py +1064 -0
- infraro_core-0.23.1/tests/test_uses_sha_pinning_contract.py +225 -0
- infraro_core-0.23.1/tests/test_venv_create.py +124 -0
- infraro_core-0.23.1/tests/test_version_sync.py +349 -0
- infraro_core-0.23.1/tests/test_webhook_anchor.py +622 -0
- infraro_core-0.23.1/tests/test_webhook_no_mission_dispatch.py +90 -0
- infraro_core-0.23.1/tests/test_webhook_scripts_manifest.py +139 -0
- infraro_core-0.23.1/tests/test_workflow_permissions_contract.py +216 -0
- infraro_core-0.23.1/tests/test_write_pending_ci_hardening.py +506 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 hdot123
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: infraro-core
|
|
3
|
+
Version: 0.23.1
|
|
4
|
+
Summary: 组织级演进引擎:自进化/审计/门禁体系的共享基础设施
|
|
5
|
+
Author-email: hdot123 <hdot123@users.noreply.github.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
12
|
+
Requires-Python: ==3.12.*
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
16
|
+
Requires-Dist: requests>=2.34.2
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest>=9.1.1; extra == "dev"
|
|
19
|
+
Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest-timeout>=2.4.0; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest-xdist>=3.8.0; extra == "dev"
|
|
22
|
+
Requires-Dist: ruff>=0.16.9; extra == "dev"
|
|
23
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
24
|
+
Requires-Dist: types-PyYAML>=6.0.12.20260906; extra == "dev"
|
|
25
|
+
Requires-Dist: types-requests>=2.33.0.20260906; extra == "dev"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# infraro-core
|
|
29
|
+
|
|
30
|
+
组织级演进引擎:自进化/审计/门禁体系的共享基础设施。
|
|
31
|
+
|
|
32
|
+
## 定位
|
|
33
|
+
|
|
34
|
+
infraro-core 是从 memory-core 抽离的组织级共享引擎,提供:
|
|
35
|
+
|
|
36
|
+
> **可见性现状(2026-09-25 flip 完成)**:本仓已转为**私有引擎仓**(真源);对外交付统一经公开镜像仓 [hdot123/infraro-core-mirror](https://github.com/hdot123/infraro-core-mirror)——release 机械同步、确定性脱敏变换(内网标识过滤替换)、只读(无 issue/PR)。此前的公开仓直连交付形态已由「私有真源 + 官方公开镜像」取代。
|
|
37
|
+
|
|
38
|
+
- **四层体系**(Evolution Core / Governance / Rule Packs / Delivery):Evolution Core 核心能力(scanner、utils、adapters、heartbeat、self-audit、version-sync)+ Governance 治理判定(`governance.py` + `substrate/gates/`)+ Rule Packs 规则包(memory pack:daily-audit、layout-audit、hygiene、error-patterns 等)+ Delivery 交付编排(workflows / actions / shell / webhook 脚本 / droid-review 分片发布 / 锚点助手与 anchor_gate 等寄居件)。权威归属表与路径清单见 [`docs/architecture.md` §1.1](docs/architecture.md)
|
|
39
|
+
- **webhook 脚本**:manifest + trigger 家族(生产同步源)
|
|
40
|
+
- **CI/CD**:reusable workflows + composite actions
|
|
41
|
+
- **CLI**:infra-cli 统一入口
|
|
42
|
+
- **发版公告链路**:引擎发版时自动广播升级公告,消费仓自动接单开 pin-bump PR(详见[发版公告与下游自动接单](#发版公告与下游自动接单))
|
|
43
|
+
|
|
44
|
+
## 旧世界引擎层下线状态
|
|
45
|
+
|
|
46
|
+
- org 旧引擎仓(hdot123-org / infra-core,运行时拼接构造的冻结仓)已于 2026-09-18 正式下线:archived=true,18/19 workflow 已停用(仅 Dependency Graph 内置件保留,GitHub 不可禁用)。
|
|
47
|
+
- 全部能力已迁移到新世界双仓:引擎仓 hdot123/infraro-core + 声明仓 hdot123/infraro。
|
|
48
|
+
- 交付标准详见声明仓 docs/delivery-standard.md(三层交付模型 + 机械验收门)。
|
|
49
|
+
- 终局处置记录见 substrate/infra-core-termination-record.md。
|
|
50
|
+
|
|
51
|
+
## 安装
|
|
52
|
+
|
|
53
|
+
要求 Python 3.12(`requires-python = "==3.12.*"` 锁定)。
|
|
54
|
+
|
|
55
|
+
### 获取 Python 3.12
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# 方式一:Homebrew
|
|
59
|
+
brew install python@3.12
|
|
60
|
+
|
|
61
|
+
# 方式二:uv(推荐的 Python 版本管理器)
|
|
62
|
+
uv python install 3.12
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 安装 infraro-core
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# 从源码安装(开发模式)
|
|
69
|
+
pip install -e .
|
|
70
|
+
|
|
71
|
+
# 从公开镜像仓安装(免认证;v0.19.0 为当前已发布 tag)
|
|
72
|
+
# 真源(本仓)已于 2026-09-25 转为私有,镜像仓是唯一公开消费面,release 机械同步
|
|
73
|
+
pip install git+https://github.com/hdot123/infraro-core-mirror.git@v0.19.0
|
|
74
|
+
|
|
75
|
+
# 安装开发依赖
|
|
76
|
+
pip install -e ".[dev]"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 使用
|
|
80
|
+
|
|
81
|
+
### CLI 命令
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# 查看帮助
|
|
85
|
+
infra-cli --help
|
|
86
|
+
|
|
87
|
+
# 扫描仓库(只读模式,不创建 issue)
|
|
88
|
+
infra-cli scan --report-only --repo-root /path/to/repo
|
|
89
|
+
|
|
90
|
+
# 审计(尚未实现,cli.py 当前固定 return 1)
|
|
91
|
+
infra-cli audit --target /path/to/project
|
|
92
|
+
|
|
93
|
+
# 版本同步
|
|
94
|
+
infra-cli version-sweep --target /path/to/project
|
|
95
|
+
|
|
96
|
+
# venv 环境工具组(创建独立 venv 并安装依赖)
|
|
97
|
+
infra-cli venv create --path .venv --extras dev
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
独立审计入口(随包安装提供):`infra-self-audit`、`infra-daily-audit`、`infra-layout-audit`、`infra-hygiene-audit`、`infra-error-patterns`。
|
|
101
|
+
|
|
102
|
+
### 规则包
|
|
103
|
+
|
|
104
|
+
消费仓通过 `.evolution/config.yml` 声明使用的规则包:
|
|
105
|
+
|
|
106
|
+
```yaml
|
|
107
|
+
rule_packs:
|
|
108
|
+
- pack: memory
|
|
109
|
+
|
|
110
|
+
audit_tools:
|
|
111
|
+
- name: consistency_check
|
|
112
|
+
command: "memory-consistency-check --json"
|
|
113
|
+
output_format: json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 消费仓接入
|
|
117
|
+
|
|
118
|
+
新仓库接入引擎只需三件事:复制 thin-caller workflow 模板、声明 `.evolution/config.yml`、配置 secrets,引擎版本由 workflow 引用(SHA 级真源 job.workflow_sha)决定,经 pip install git+ 从**镜像仓**交付(唯一公开消费面,真源引擎仓已转私有),非 Python 仓通过条件安装守卫自动跳过。接入资格注意三套独立控制:仓库权限、scheduler 白名单、runner 类型互相独立(公开仓 GitHub-hosted runner / 私有仓自建 runner),仓库权限不蕴含引擎资格。详见[消费仓接入指南](docs/onboarding/consumer-onboarding.md),thin-caller 模板位于 `docs/onboarding/templates/`。
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
## 发版公告与下游自动接单
|
|
122
|
+
|
|
123
|
+
infraro-core 发版时,通过两条触发面(推送 + 轮询)自动广播升级公告,消费仓(`engineConsumer: true`)自动接单开 pin-bump PR,CI → auto-merge 闭环。
|
|
124
|
+
|
|
125
|
+
**链路要素**:
|
|
126
|
+
- **推送触发面**:`release-announce.yml` workflow(on: release published)POST 到 Mac 侧 webhook → `trigger-release.sh` 派发 droid session
|
|
127
|
+
- **轮询触发面**(默认):`poll-releases.sh` + launchd 定时轮询 GitHub Releases API,发现新 release 后调用 `trigger-release.sh`
|
|
128
|
+
- **接单 skill**:`release-gateway` skill 指导 droid 升级消费仓 infraro-core pin(pyproject git+、workflow @tag、测试断言、文档等)
|
|
129
|
+
- **幂等保证**:per-tag 锁文件,重复触发零副作用
|
|
130
|
+
- **双触发面共存**:推送 + 轮询经幂等锁天然共存,推送面可休眠(secret 缺失时优雅跳过)
|
|
131
|
+
|
|
132
|
+
**消费仓接入**:在 `~/.factory/config/repositories.yml` 中添加 `engineConsumer: true` 标记即可自动接收升级公告。
|
|
133
|
+
|
|
134
|
+
详细架构:[`docs/architecture.md` §7 发版公告链路](docs/architecture.md) § C9 轮询触发面;消费仓接入指南:[`docs/onboarding/consumer-onboarding.md`](docs/onboarding/consumer-onboarding.md)。组织治理规范与「批准即执行」变更 playbook:[`docs/governance/`](docs/governance/)(org-governance-spec.md / change-playbook.md / source-of-truth.md / templates/ / correction-plan.md),供下一个 mission 执行。
|
|
135
|
+
|
|
136
|
+
## 架构
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
infraro-core/
|
|
140
|
+
├── src/infra_core/
|
|
141
|
+
│ ├── engine/ # 自进化引擎单源(scanner/utils/adapters/heartbeat/self-audit/version-sync/锚点助手)
|
|
142
|
+
│ ├── packs/ # 规则包(memory 等,经 entry points 发现;memory 为平铺模块 + 门面)
|
|
143
|
+
│ ├── shell/ # shell 辅助层(auto-merge/branch-cleanup 家族源码)
|
|
144
|
+
│ ├── governance.py # 治理自检(受保护路径修改判定,fail-closed)
|
|
145
|
+
│ └── cli.py # infra-cli 统一入口
|
|
146
|
+
├── actions/ # composite actions(auto-merge / branch-cleanup / droid-review-aggregate / governance-check)
|
|
147
|
+
├── .github/workflows/ # reusable workflows + CI/QA 门禁
|
|
148
|
+
├── webhook-scripts/ # webhook 脚本(生产同步源)
|
|
149
|
+
└── tests/ # 测试套件
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## 开发
|
|
153
|
+
|
|
154
|
+
### 版本对齐说明
|
|
155
|
+
|
|
156
|
+
CI 通过 `runner-tools.toml` 固定工具版本(见 `[tools]` 段)。本地开发建议与 CI 对齐:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# ruff:CI 钉 0.16.3,本地建议安装同版本
|
|
160
|
+
pip install ruff==0.16.3
|
|
161
|
+
|
|
162
|
+
# actionlint / shellcheck:CI 使用宿主二进制,本地需单独安装
|
|
163
|
+
brew install actionlint shellcheck
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
版本不一致可能导致本地通过但 CI 失败(或反之),以 CI 为准。
|
|
167
|
+
|
|
168
|
+
### 本地开发流程
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# 安装开发依赖
|
|
172
|
+
pip install -e ".[dev]"
|
|
173
|
+
|
|
174
|
+
# 运行测试
|
|
175
|
+
pytest
|
|
176
|
+
|
|
177
|
+
# 代码检查
|
|
178
|
+
ruff check .
|
|
179
|
+
ruff format --check .
|
|
180
|
+
|
|
181
|
+
# GitHub Actions 检查
|
|
182
|
+
actionlint
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### 全流程测试计划与 live-truth 探针
|
|
186
|
+
|
|
187
|
+
- 全流程测试计划入口:[docs/guides/fullstack-test-plan.md](docs/guides/fullstack-test-plan.md)
|
|
188
|
+
- live-truth 探针用法:`python3 scripts/livetruth_probes.py --t1`(本地零凭证)/ `--t2`(gh 只读巡检)/ `--t3`(Mac 本机快照);T3 挂载为周检的设计口径见脚本头注释
|
|
189
|
+
|
|
190
|
+
## 治理自检 dry-run
|
|
191
|
+
|
|
192
|
+
governance 门禁(workflow `Evolution Governance` + composite action `actions/governance-check`)的判定核心可本地模拟验证(fail-closed、路径感知):
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# 非 owner 修改受保护路径 → 退出码 1(拒绝)
|
|
196
|
+
python -m infra_core.governance --author someone-else --files .evolution/config.yml
|
|
197
|
+
|
|
198
|
+
# 非 owner 修改普通文件 → 退出码 0(放行)
|
|
199
|
+
python -m infra_core.governance --author someone-else --files README.md
|
|
200
|
+
|
|
201
|
+
# owner 修改受保护路径 → 退出码 0(放行)
|
|
202
|
+
python -m infra_core.governance --author hdot123 --files .evolution/config.yml
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## 命名契约
|
|
206
|
+
|
|
207
|
+
以下字符串构成隐式契约网络,任何一处改动会静默杀死 auto-merge/watchdog:
|
|
208
|
+
|
|
209
|
+
- workflow 名:`Droid Auto Review`、`Evolution Governance`、`CI`、`QA`
|
|
210
|
+
- check 名:`droid-review`(job key)、`Block non-owner governance modifications`(governance job 显示名)
|
|
211
|
+
- artifact 前缀:`droid-review-debug-`
|
|
212
|
+
- workflow 文件名:`evolution-scan.yml`
|
|
213
|
+
|
|
214
|
+
详见 [architecture.md](docs/architecture.md)。
|
|
215
|
+
|
|
216
|
+
## License
|
|
217
|
+
|
|
218
|
+
MIT
|
|
219
|
+
|
|
220
|
+
## 防线现状(2026-09 审计防线加固)
|
|
221
|
+
|
|
222
|
+
本仓库已完成四项审计防线加固,
|
|
223
|
+
|
|
224
|
+
- **接口门(Gate1)fail-closed**:模板 / tags 不可验证时显式红而非软通过(`substrate/gates/gate1_interface.py:306,327-332`);
|
|
225
|
+
- **heartbeat liveness conclusion 维度**:conclusion ∈ {failure, timed_out, cancelled} 连续 3 次判 stale,streak 告警穿透 self-heal 抑制链(`src/infra_core/engine/evolution_heartbeat.py` streak 判定+穿透);
|
|
226
|
+
- **零红聚合时序**:ci-ok 内零红聚合在 droid-review 轮询之后执行(`.github/workflows/ci.yml` ci-ok step-order + `TestCiOkStepOrder`);
|
|
227
|
+
- **Core↛Delivery 反向 import**:由 AST 契约测试强制(`tests/test_core_delivery_import_contract.py`)。
|
|
228
|
+
|
|
229
|
+
## CI / 分支保护 / 治理基线(2026-09 现状)
|
|
230
|
+
|
|
231
|
+
### CI 结构
|
|
232
|
+
|
|
233
|
+
CI 门由可复用 workflow 组成,聚合为显式 check:
|
|
234
|
+
|
|
235
|
+
- `quality-gate`:外层聚合门,把 ci / qa / substrate 三路结论收敛为单一 required check
|
|
236
|
+
- `ci-ok`:pytest(`-rA` 逐测试结果行)、集成 / e2e / guards / health-check 聚合门(内部已轮询 droid-review)
|
|
237
|
+
- `qa-ok`:QA 门聚合(正确处理 schedule-only job 的 skipped 状态)
|
|
238
|
+
- `substrate-gate-suite`:substrate 五门聚合(job 显示名即 required context)
|
|
239
|
+
|
|
240
|
+
release-please 发版链路经 `setup-venv` composite action 使用 uv relock,保证发版 PR 与 tag 的锁文件一致性。
|
|
241
|
+
|
|
242
|
+
### 分支保护硬化
|
|
243
|
+
|
|
244
|
+
main 分支 ruleset(active,作用域 `~DEFAULT_BRANCH`):
|
|
245
|
+
|
|
246
|
+
- required checks = `quality-gate` + `droid-review` + `substrate-gate-suite`,strict(要求分支最新)
|
|
247
|
+
- pull_request:squash-only、0 审批(自动化骨干仓)+ unattributed 变更额外审批、review 线程必须解决
|
|
248
|
+
- `non_fast_forward`(禁强推)、`deletion`(禁删分支)、`required_linear_history`;bypass actors 为空——owner 亦无豁免
|
|
249
|
+
- fork PR 由 droid-review fail-closed 身份检查拦截(见下文 Fork PR 政策)
|
|
250
|
+
|
|
251
|
+
### 治理基线(2026-09 账号级全量施工)
|
|
252
|
+
|
|
253
|
+
- **GITHUB_TOKEN 默认权限 `read`**,且禁止 GITHUB_TOKEN 审批 PR;workflow 级 write 已下放到 job 级
|
|
254
|
+
- **allowed actions 收敛为 `selected`**:github-owned + verified 放行,叠加 `hdot123/*` 白名单;本仓额外保留 `googleapis/*`(release-please 链路依赖)
|
|
255
|
+
- **secret scanning + push protection 已启用**(本仓 2026-09-25 转私,公开交付面由镜像仓承担,私有仓计划限制依旧,见治理报告 blocked-by-plan 清单)
|
|
256
|
+
- **`production` environment**:发版与公告链路 job 走 required reviewer 审批门(branch main + tag `v*`)
|
|
257
|
+
- **CODEOWNERS + Dependabot**:owner 兜底 + 敏感路径;依赖更新覆盖 github-actions / pip(本仓)
|
|
258
|
+
- **预算守卫**:`.github/workflows/actions-budget-guard.yml` 每周汇总各仓 runs 分钟数与失败率,超阈值开 automation Issue
|
|
259
|
+
- 账号级 27 仓(Tier A/B/C)已按同一基线施工,本仓为参照实现;其余仓为同构副本
|
|
260
|
+
|
|
261
|
+
### droid-review 自定义模型(go-github + dynamic routing)
|
|
262
|
+
|
|
263
|
+
BYOM 链路(droid exec AI 评审)已同步至 main @ a17ad26 的最新配置(服役 PR #137 合入)。新链路基于 CF AI Gateway 的 go-github worker + 动态路由,完全脱离旧 NVIDIA Kong 内网。
|
|
264
|
+
|
|
265
|
+
- **baseUrl**:`https://gh.lumivane.dpdns.org/compat`(CF AI Gateway go-github 网关 + 动态路由)
|
|
266
|
+
- **模型**:`dynamic/droid-review`(主模型 deepseek-v4.1-flash@opencode-go,备用 Workers AI),模型 id `custom:DeepSeek-V4.1-Flash-Go`(不含内部拓扑字符串,避免 substrate gate3 泄露检查)
|
|
267
|
+
- **认证三要素**:`cf-aig-authorization: Bearer <GO_GITHUB_RUN_TOKEN>` + `Authorization: Bearer <OPENCODE_GO_KEY>` + `x-opencode-session`(上游必需)
|
|
268
|
+
- **密钥位置**:1Password vault `sever`(条目「OpenCode go / API Key」对应 OPENCODE_GO_KEY;「Cloudflare AI Gateway / lumivane / 调用凭证」对应 GO_GITHUB_RUN_TOKEN);仓库/runner-hub secrets 注入,文档零明文密钥
|
|
269
|
+
- **手动分片重试**:`droid-review-shards.yml`(workflow_dispatch)接受同两个 secret(`opencode-go-key` / `go-github-run-token`)
|
|
270
|
+
|
|
271
|
+
## Fork PR 政策(droid-review)
|
|
272
|
+
|
|
273
|
+
自 v0.15.2 起(PR #250),droid-review 链对 `pull_request_target` 事件做 fail-closed 身份检查:PR head 来自 fork(`head.repo` != 本仓)或 `head.repo` 缺失时,AI 审查直接失败退出,防止 fork 经 AGENTS.md 注入指令操纵审查。同仓分支 PR 不受影响;维护者可通过 `workflow_dispatch` 手动触发审查.
|
|
274
|
+
|
|
275
|
+
<!-- Variables updated: 2026-09-25 -->
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# infraro-core
|
|
2
|
+
|
|
3
|
+
组织级演进引擎:自进化/审计/门禁体系的共享基础设施。
|
|
4
|
+
|
|
5
|
+
## 定位
|
|
6
|
+
|
|
7
|
+
infraro-core 是从 memory-core 抽离的组织级共享引擎,提供:
|
|
8
|
+
|
|
9
|
+
> **可见性现状(2026-09-25 flip 完成)**:本仓已转为**私有引擎仓**(真源);对外交付统一经公开镜像仓 [hdot123/infraro-core-mirror](https://github.com/hdot123/infraro-core-mirror)——release 机械同步、确定性脱敏变换(内网标识过滤替换)、只读(无 issue/PR)。此前的公开仓直连交付形态已由「私有真源 + 官方公开镜像」取代。
|
|
10
|
+
|
|
11
|
+
- **四层体系**(Evolution Core / Governance / Rule Packs / Delivery):Evolution Core 核心能力(scanner、utils、adapters、heartbeat、self-audit、version-sync)+ Governance 治理判定(`governance.py` + `substrate/gates/`)+ Rule Packs 规则包(memory pack:daily-audit、layout-audit、hygiene、error-patterns 等)+ Delivery 交付编排(workflows / actions / shell / webhook 脚本 / droid-review 分片发布 / 锚点助手与 anchor_gate 等寄居件)。权威归属表与路径清单见 [`docs/architecture.md` §1.1](docs/architecture.md)
|
|
12
|
+
- **webhook 脚本**:manifest + trigger 家族(生产同步源)
|
|
13
|
+
- **CI/CD**:reusable workflows + composite actions
|
|
14
|
+
- **CLI**:infra-cli 统一入口
|
|
15
|
+
- **发版公告链路**:引擎发版时自动广播升级公告,消费仓自动接单开 pin-bump PR(详见[发版公告与下游自动接单](#发版公告与下游自动接单))
|
|
16
|
+
|
|
17
|
+
## 旧世界引擎层下线状态
|
|
18
|
+
|
|
19
|
+
- org 旧引擎仓(hdot123-org / infra-core,运行时拼接构造的冻结仓)已于 2026-09-18 正式下线:archived=true,18/19 workflow 已停用(仅 Dependency Graph 内置件保留,GitHub 不可禁用)。
|
|
20
|
+
- 全部能力已迁移到新世界双仓:引擎仓 hdot123/infraro-core + 声明仓 hdot123/infraro。
|
|
21
|
+
- 交付标准详见声明仓 docs/delivery-standard.md(三层交付模型 + 机械验收门)。
|
|
22
|
+
- 终局处置记录见 substrate/infra-core-termination-record.md。
|
|
23
|
+
|
|
24
|
+
## 安装
|
|
25
|
+
|
|
26
|
+
要求 Python 3.12(`requires-python = "==3.12.*"` 锁定)。
|
|
27
|
+
|
|
28
|
+
### 获取 Python 3.12
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# 方式一:Homebrew
|
|
32
|
+
brew install python@3.12
|
|
33
|
+
|
|
34
|
+
# 方式二:uv(推荐的 Python 版本管理器)
|
|
35
|
+
uv python install 3.12
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 安装 infraro-core
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# 从源码安装(开发模式)
|
|
42
|
+
pip install -e .
|
|
43
|
+
|
|
44
|
+
# 从公开镜像仓安装(免认证;v0.19.0 为当前已发布 tag)
|
|
45
|
+
# 真源(本仓)已于 2026-09-25 转为私有,镜像仓是唯一公开消费面,release 机械同步
|
|
46
|
+
pip install git+https://github.com/hdot123/infraro-core-mirror.git@v0.19.0
|
|
47
|
+
|
|
48
|
+
# 安装开发依赖
|
|
49
|
+
pip install -e ".[dev]"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 使用
|
|
53
|
+
|
|
54
|
+
### CLI 命令
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# 查看帮助
|
|
58
|
+
infra-cli --help
|
|
59
|
+
|
|
60
|
+
# 扫描仓库(只读模式,不创建 issue)
|
|
61
|
+
infra-cli scan --report-only --repo-root /path/to/repo
|
|
62
|
+
|
|
63
|
+
# 审计(尚未实现,cli.py 当前固定 return 1)
|
|
64
|
+
infra-cli audit --target /path/to/project
|
|
65
|
+
|
|
66
|
+
# 版本同步
|
|
67
|
+
infra-cli version-sweep --target /path/to/project
|
|
68
|
+
|
|
69
|
+
# venv 环境工具组(创建独立 venv 并安装依赖)
|
|
70
|
+
infra-cli venv create --path .venv --extras dev
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
独立审计入口(随包安装提供):`infra-self-audit`、`infra-daily-audit`、`infra-layout-audit`、`infra-hygiene-audit`、`infra-error-patterns`。
|
|
74
|
+
|
|
75
|
+
### 规则包
|
|
76
|
+
|
|
77
|
+
消费仓通过 `.evolution/config.yml` 声明使用的规则包:
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
rule_packs:
|
|
81
|
+
- pack: memory
|
|
82
|
+
|
|
83
|
+
audit_tools:
|
|
84
|
+
- name: consistency_check
|
|
85
|
+
command: "memory-consistency-check --json"
|
|
86
|
+
output_format: json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 消费仓接入
|
|
90
|
+
|
|
91
|
+
新仓库接入引擎只需三件事:复制 thin-caller workflow 模板、声明 `.evolution/config.yml`、配置 secrets,引擎版本由 workflow 引用(SHA 级真源 job.workflow_sha)决定,经 pip install git+ 从**镜像仓**交付(唯一公开消费面,真源引擎仓已转私有),非 Python 仓通过条件安装守卫自动跳过。接入资格注意三套独立控制:仓库权限、scheduler 白名单、runner 类型互相独立(公开仓 GitHub-hosted runner / 私有仓自建 runner),仓库权限不蕴含引擎资格。详见[消费仓接入指南](docs/onboarding/consumer-onboarding.md),thin-caller 模板位于 `docs/onboarding/templates/`。
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 发版公告与下游自动接单
|
|
95
|
+
|
|
96
|
+
infraro-core 发版时,通过两条触发面(推送 + 轮询)自动广播升级公告,消费仓(`engineConsumer: true`)自动接单开 pin-bump PR,CI → auto-merge 闭环。
|
|
97
|
+
|
|
98
|
+
**链路要素**:
|
|
99
|
+
- **推送触发面**:`release-announce.yml` workflow(on: release published)POST 到 Mac 侧 webhook → `trigger-release.sh` 派发 droid session
|
|
100
|
+
- **轮询触发面**(默认):`poll-releases.sh` + launchd 定时轮询 GitHub Releases API,发现新 release 后调用 `trigger-release.sh`
|
|
101
|
+
- **接单 skill**:`release-gateway` skill 指导 droid 升级消费仓 infraro-core pin(pyproject git+、workflow @tag、测试断言、文档等)
|
|
102
|
+
- **幂等保证**:per-tag 锁文件,重复触发零副作用
|
|
103
|
+
- **双触发面共存**:推送 + 轮询经幂等锁天然共存,推送面可休眠(secret 缺失时优雅跳过)
|
|
104
|
+
|
|
105
|
+
**消费仓接入**:在 `~/.factory/config/repositories.yml` 中添加 `engineConsumer: true` 标记即可自动接收升级公告。
|
|
106
|
+
|
|
107
|
+
详细架构:[`docs/architecture.md` §7 发版公告链路](docs/architecture.md) § C9 轮询触发面;消费仓接入指南:[`docs/onboarding/consumer-onboarding.md`](docs/onboarding/consumer-onboarding.md)。组织治理规范与「批准即执行」变更 playbook:[`docs/governance/`](docs/governance/)(org-governance-spec.md / change-playbook.md / source-of-truth.md / templates/ / correction-plan.md),供下一个 mission 执行。
|
|
108
|
+
|
|
109
|
+
## 架构
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
infraro-core/
|
|
113
|
+
├── src/infra_core/
|
|
114
|
+
│ ├── engine/ # 自进化引擎单源(scanner/utils/adapters/heartbeat/self-audit/version-sync/锚点助手)
|
|
115
|
+
│ ├── packs/ # 规则包(memory 等,经 entry points 发现;memory 为平铺模块 + 门面)
|
|
116
|
+
│ ├── shell/ # shell 辅助层(auto-merge/branch-cleanup 家族源码)
|
|
117
|
+
│ ├── governance.py # 治理自检(受保护路径修改判定,fail-closed)
|
|
118
|
+
│ └── cli.py # infra-cli 统一入口
|
|
119
|
+
├── actions/ # composite actions(auto-merge / branch-cleanup / droid-review-aggregate / governance-check)
|
|
120
|
+
├── .github/workflows/ # reusable workflows + CI/QA 门禁
|
|
121
|
+
├── webhook-scripts/ # webhook 脚本(生产同步源)
|
|
122
|
+
└── tests/ # 测试套件
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 开发
|
|
126
|
+
|
|
127
|
+
### 版本对齐说明
|
|
128
|
+
|
|
129
|
+
CI 通过 `runner-tools.toml` 固定工具版本(见 `[tools]` 段)。本地开发建议与 CI 对齐:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# ruff:CI 钉 0.16.3,本地建议安装同版本
|
|
133
|
+
pip install ruff==0.16.3
|
|
134
|
+
|
|
135
|
+
# actionlint / shellcheck:CI 使用宿主二进制,本地需单独安装
|
|
136
|
+
brew install actionlint shellcheck
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
版本不一致可能导致本地通过但 CI 失败(或反之),以 CI 为准。
|
|
140
|
+
|
|
141
|
+
### 本地开发流程
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# 安装开发依赖
|
|
145
|
+
pip install -e ".[dev]"
|
|
146
|
+
|
|
147
|
+
# 运行测试
|
|
148
|
+
pytest
|
|
149
|
+
|
|
150
|
+
# 代码检查
|
|
151
|
+
ruff check .
|
|
152
|
+
ruff format --check .
|
|
153
|
+
|
|
154
|
+
# GitHub Actions 检查
|
|
155
|
+
actionlint
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 全流程测试计划与 live-truth 探针
|
|
159
|
+
|
|
160
|
+
- 全流程测试计划入口:[docs/guides/fullstack-test-plan.md](docs/guides/fullstack-test-plan.md)
|
|
161
|
+
- live-truth 探针用法:`python3 scripts/livetruth_probes.py --t1`(本地零凭证)/ `--t2`(gh 只读巡检)/ `--t3`(Mac 本机快照);T3 挂载为周检的设计口径见脚本头注释
|
|
162
|
+
|
|
163
|
+
## 治理自检 dry-run
|
|
164
|
+
|
|
165
|
+
governance 门禁(workflow `Evolution Governance` + composite action `actions/governance-check`)的判定核心可本地模拟验证(fail-closed、路径感知):
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# 非 owner 修改受保护路径 → 退出码 1(拒绝)
|
|
169
|
+
python -m infra_core.governance --author someone-else --files .evolution/config.yml
|
|
170
|
+
|
|
171
|
+
# 非 owner 修改普通文件 → 退出码 0(放行)
|
|
172
|
+
python -m infra_core.governance --author someone-else --files README.md
|
|
173
|
+
|
|
174
|
+
# owner 修改受保护路径 → 退出码 0(放行)
|
|
175
|
+
python -m infra_core.governance --author hdot123 --files .evolution/config.yml
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## 命名契约
|
|
179
|
+
|
|
180
|
+
以下字符串构成隐式契约网络,任何一处改动会静默杀死 auto-merge/watchdog:
|
|
181
|
+
|
|
182
|
+
- workflow 名:`Droid Auto Review`、`Evolution Governance`、`CI`、`QA`
|
|
183
|
+
- check 名:`droid-review`(job key)、`Block non-owner governance modifications`(governance job 显示名)
|
|
184
|
+
- artifact 前缀:`droid-review-debug-`
|
|
185
|
+
- workflow 文件名:`evolution-scan.yml`
|
|
186
|
+
|
|
187
|
+
详见 [architecture.md](docs/architecture.md)。
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
MIT
|
|
192
|
+
|
|
193
|
+
## 防线现状(2026-09 审计防线加固)
|
|
194
|
+
|
|
195
|
+
本仓库已完成四项审计防线加固,
|
|
196
|
+
|
|
197
|
+
- **接口门(Gate1)fail-closed**:模板 / tags 不可验证时显式红而非软通过(`substrate/gates/gate1_interface.py:306,327-332`);
|
|
198
|
+
- **heartbeat liveness conclusion 维度**:conclusion ∈ {failure, timed_out, cancelled} 连续 3 次判 stale,streak 告警穿透 self-heal 抑制链(`src/infra_core/engine/evolution_heartbeat.py` streak 判定+穿透);
|
|
199
|
+
- **零红聚合时序**:ci-ok 内零红聚合在 droid-review 轮询之后执行(`.github/workflows/ci.yml` ci-ok step-order + `TestCiOkStepOrder`);
|
|
200
|
+
- **Core↛Delivery 反向 import**:由 AST 契约测试强制(`tests/test_core_delivery_import_contract.py`)。
|
|
201
|
+
|
|
202
|
+
## CI / 分支保护 / 治理基线(2026-09 现状)
|
|
203
|
+
|
|
204
|
+
### CI 结构
|
|
205
|
+
|
|
206
|
+
CI 门由可复用 workflow 组成,聚合为显式 check:
|
|
207
|
+
|
|
208
|
+
- `quality-gate`:外层聚合门,把 ci / qa / substrate 三路结论收敛为单一 required check
|
|
209
|
+
- `ci-ok`:pytest(`-rA` 逐测试结果行)、集成 / e2e / guards / health-check 聚合门(内部已轮询 droid-review)
|
|
210
|
+
- `qa-ok`:QA 门聚合(正确处理 schedule-only job 的 skipped 状态)
|
|
211
|
+
- `substrate-gate-suite`:substrate 五门聚合(job 显示名即 required context)
|
|
212
|
+
|
|
213
|
+
release-please 发版链路经 `setup-venv` composite action 使用 uv relock,保证发版 PR 与 tag 的锁文件一致性。
|
|
214
|
+
|
|
215
|
+
### 分支保护硬化
|
|
216
|
+
|
|
217
|
+
main 分支 ruleset(active,作用域 `~DEFAULT_BRANCH`):
|
|
218
|
+
|
|
219
|
+
- required checks = `quality-gate` + `droid-review` + `substrate-gate-suite`,strict(要求分支最新)
|
|
220
|
+
- pull_request:squash-only、0 审批(自动化骨干仓)+ unattributed 变更额外审批、review 线程必须解决
|
|
221
|
+
- `non_fast_forward`(禁强推)、`deletion`(禁删分支)、`required_linear_history`;bypass actors 为空——owner 亦无豁免
|
|
222
|
+
- fork PR 由 droid-review fail-closed 身份检查拦截(见下文 Fork PR 政策)
|
|
223
|
+
|
|
224
|
+
### 治理基线(2026-09 账号级全量施工)
|
|
225
|
+
|
|
226
|
+
- **GITHUB_TOKEN 默认权限 `read`**,且禁止 GITHUB_TOKEN 审批 PR;workflow 级 write 已下放到 job 级
|
|
227
|
+
- **allowed actions 收敛为 `selected`**:github-owned + verified 放行,叠加 `hdot123/*` 白名单;本仓额外保留 `googleapis/*`(release-please 链路依赖)
|
|
228
|
+
- **secret scanning + push protection 已启用**(本仓 2026-09-25 转私,公开交付面由镜像仓承担,私有仓计划限制依旧,见治理报告 blocked-by-plan 清单)
|
|
229
|
+
- **`production` environment**:发版与公告链路 job 走 required reviewer 审批门(branch main + tag `v*`)
|
|
230
|
+
- **CODEOWNERS + Dependabot**:owner 兜底 + 敏感路径;依赖更新覆盖 github-actions / pip(本仓)
|
|
231
|
+
- **预算守卫**:`.github/workflows/actions-budget-guard.yml` 每周汇总各仓 runs 分钟数与失败率,超阈值开 automation Issue
|
|
232
|
+
- 账号级 27 仓(Tier A/B/C)已按同一基线施工,本仓为参照实现;其余仓为同构副本
|
|
233
|
+
|
|
234
|
+
### droid-review 自定义模型(go-github + dynamic routing)
|
|
235
|
+
|
|
236
|
+
BYOM 链路(droid exec AI 评审)已同步至 main @ a17ad26 的最新配置(服役 PR #137 合入)。新链路基于 CF AI Gateway 的 go-github worker + 动态路由,完全脱离旧 NVIDIA Kong 内网。
|
|
237
|
+
|
|
238
|
+
- **baseUrl**:`https://gh.lumivane.dpdns.org/compat`(CF AI Gateway go-github 网关 + 动态路由)
|
|
239
|
+
- **模型**:`dynamic/droid-review`(主模型 deepseek-v4.1-flash@opencode-go,备用 Workers AI),模型 id `custom:DeepSeek-V4.1-Flash-Go`(不含内部拓扑字符串,避免 substrate gate3 泄露检查)
|
|
240
|
+
- **认证三要素**:`cf-aig-authorization: Bearer <GO_GITHUB_RUN_TOKEN>` + `Authorization: Bearer <OPENCODE_GO_KEY>` + `x-opencode-session`(上游必需)
|
|
241
|
+
- **密钥位置**:1Password vault `sever`(条目「OpenCode go / API Key」对应 OPENCODE_GO_KEY;「Cloudflare AI Gateway / lumivane / 调用凭证」对应 GO_GITHUB_RUN_TOKEN);仓库/runner-hub secrets 注入,文档零明文密钥
|
|
242
|
+
- **手动分片重试**:`droid-review-shards.yml`(workflow_dispatch)接受同两个 secret(`opencode-go-key` / `go-github-run-token`)
|
|
243
|
+
|
|
244
|
+
## Fork PR 政策(droid-review)
|
|
245
|
+
|
|
246
|
+
自 v0.15.2 起(PR #250),droid-review 链对 `pull_request_target` 事件做 fail-closed 身份检查:PR head 来自 fork(`head.repo` != 本仓)或 `head.repo` 缺失时,AI 审查直接失败退出,防止 fork 经 AGENTS.md 注入指令操纵审查。同仓分支 PR 不受影响;维护者可通过 `workflow_dispatch` 手动触发审查.
|
|
247
|
+
|
|
248
|
+
<!-- Variables updated: 2026-09-25 -->
|