Skip to content

Commit 26a6358

Browse files
committed
merge: 对齐 main v0.15.5(版本面竞态取 0.16.0,内容面取双方并集)
2 parents 34e0cca + 05b3280 commit 26a6358

21 files changed

Lines changed: 433 additions & 9 deletions

File tree

‎hooks/pre_tool_git_guard.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
inline_skip_gate,
3939
)
4040
from codeguard.hook_state import completed_event, record_completed_event, session_scope
41+
from codeguard.repository_policy import env_skip_gate
4142
from detect_lang import ensure_user_path, load_user_config
4243
from gate_lib import ( # 兼容原有 Python 导入接口
4344
check_commit_safety,
@@ -116,7 +117,7 @@ def _main(payload: dict) -> int:
116117
extract_command(payload),
117118
cwd=Path(os.getcwd()),
118119
load_config=load_user_config,
119-
bypass_env=bool(os.environ.get("CODEGUARD_SKIP_GATE")),
120+
bypass_env=env_skip_gate(),
120121
)
121122
for context in result.contexts:
122123
print(json.dumps({"hookSpecificOutput": {

‎hooks/user_prompt_validator.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from codeguard import prompt_application, prompt_policy
1616
from codeguard.hook_state import session_scope
17+
from codeguard.repository_policy import env_skip_gate
1718
from detect_lang import ( # 兼容原有 Python 导入接口
1819
LANG_COMMANDS,
1920
detect_languages,
@@ -93,7 +94,7 @@ def _main(payload: dict) -> int:
9394
project_root=find_project_root(os.getcwd()),
9495
session_id=payload.get("session_id"),
9596
load_config=load_user_config,
96-
bypass_env=bool(os.environ.get("CODEGUARD_SKIP_GATE")),
97+
bypass_env=env_skip_gate(),
9798
)
9899
if result.notification:
99100
notify(*result.notification)

openspec/changes/2026-09-23-fix-heredoc-git-attribution/proposal.md renamed to openspec/changes/archive/2026-09-23-fix-heredoc-git-attribution/proposal.md

File renamed without changes.

openspec/changes/2026-09-23-fix-heredoc-git-attribution/specs/hook-protocol/spec.md renamed to openspec/changes/archive/2026-09-23-fix-heredoc-git-attribution/specs/hook-protocol/spec.md

File renamed without changes.

openspec/changes/2026-09-23-fix-heredoc-git-attribution/tasks.md renamed to openspec/changes/archive/2026-09-23-fix-heredoc-git-attribution/tasks.md

File renamed without changes.

openspec/changes/2026-09-23-fix-release-chain-and-gate-attribution/design.md renamed to openspec/changes/archive/2026-09-23-fix-release-chain-and-gate-attribution/design.md

File renamed without changes.

openspec/changes/2026-09-23-fix-release-chain-and-gate-attribution/proposal.md renamed to openspec/changes/archive/2026-09-23-fix-release-chain-and-gate-attribution/proposal.md

File renamed without changes.

openspec/changes/2026-09-23-fix-release-chain-and-gate-attribution/specs/hook-protocol/spec.md renamed to openspec/changes/archive/2026-09-23-fix-release-chain-and-gate-attribution/specs/hook-protocol/spec.md

File renamed without changes.

openspec/changes/2026-09-23-fix-release-chain-and-gate-attribution/tasks.md renamed to openspec/changes/archive/2026-09-23-fix-release-chain-and-gate-attribution/tasks.md

File renamed without changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Context
2+
3+
三件事同源:文档说一套、代码做一套、行为没有测试。P0 的机制修复(scoped_plan + touched_others)
4+
已在库内但零锁定;`CODEGUARD_SKIP_GATE` 存在性判断与 git config 严格词表并存;文档矛盾家族 7 例
5+
全部靠人工考古发现。
6+
7+
## Goals / Non-Goals
8+
9+
**Goals:** 豁免值语义统一且文案一致;save 范围行为锁定;文档可执行断言测试化。
10+
11+
**Non-Goals:** 不改 scoped_plan 的收束算法本身(已正确);不动锁内技能;不做全量文档审校
12+
(只钉可机器判定的断言)。
13+
14+
## Decisions
15+
16+
**严格词表与 git config 对齐(1/true/yes)。** 两条豁免路径共用一份语义,`=0` 是缺陷不是特性。
17+
**断言双向取值。** 测试同时读文档文本与实现——只测实现的测试在文档漂移时是绿的,恰是病根。
18+
**save 范围锁三态 + 越界告警。** 机制已在,测试补齐即防回退;裸命令的项目级 formatter
19+
(cargo fmt 类)追加文件参数后失败退出也不改全仓——测试覆盖追加形态即可。
20+
21+
## Risks
22+
23+
- `=0` 不再豁免是行为变更:此前误依赖该行为的调用方会被拦——这是把静默关闭变显式拦截,方向正确。
24+
- 文档断言测试对文案措辞有轻微耦合:断言用关键词而非全文匹配,控制脆性。

0 commit comments

Comments
 (0)