ops: 删除 10 个零引用 ps1 + verify-doc-ssot 迁移 Python - #1610
Conversation
|
Warning Review limit reached
Next review available in: 4 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThe change adds a Python documentation SSOT verifier and removes multiple PowerShell verification and smoke-test scripts. The new verifier checks repository documentation, governance references, forbidden content, path mappings, and duplicate script names. ChangesDocumentation SSOT verifier
PowerShell verifier removal
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
8d1e978 to
9b46f0c
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/verify/verify-doc-ssot.py`:
- Around line 65-66: 更新 exists() 及 check_agents_md_paths()
使用根目录约束的路径解析逻辑:拒绝空值、绝对路径和包含 .. 的越界路径,并确保解析后的路径仍位于 ROOT 内且指向常规文件,而非目录。对映射表中每个展开后的
ref 执行该校验,避免通过跳过绝对路径绕过检查。
- Around line 129-137: The check_dated_governance function uses os.listdir which
only checks direct children of governance_dir, missing dated files in
subdirectories like docs/governance/reviews/2026-01-01.md. Replace the
os.listdir iteration with a recursive traversal (such as os.walk) that examines
all files throughout the governance_dir tree, and update the failure message to
report relative paths from the governance_dir root instead of just filenames.
- Around line 38-62: 更新 is_active_doc 及 check_forbidden_patterns
使用的活动文档判定,定义共享的活动文档清单或匹配规则,避免扫描范围分散。将根
README.md、docs/developer-quickstart.md、docs/architecture.md 及其架构子文档和其他所有 SSOT
入口文档纳入该清单,并确保禁止模式扫描复用同一判定。
- Around line 356-376: Update the validate job in `.github/workflows/checks.yml`
(around lines 818-824) to execute both the existing
`./scripts/verify/verify-doc-ssot.ps1` and the new Python verifier alongside it,
ensuring that a non-zero exit code from either verifier causes the job to fail.
Additionally, update the AGENTS.md mapping table entry for the doc-ssot verifier
to indicate that both the .ps1 and .py implementations are being executed during
this migration period, with the understanding that once Python becomes the
authoritative implementation, the mapping will be switched to reference only the
.py verifier.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 1cd22f2d-2784-4d85-9649-41ab0e560310
📒 Files selected for processing (11)
hub-server/scripts/check-local-edge-target-duplicates.ps1scripts/lib/evidence/verify-diff-proposal-manifest.ps1scripts/release/verify-agenthub-brand-assets.ps1scripts/release/verify-tauri-sidecar-runtime-evidence.ps1scripts/smoke/verify-edge-sqlite-durable-hardening.ps1scripts/smoke/verify-edge-sqlite-durable-observed-smoke.ps1scripts/smoke/verify-product-loop-observed-e2e.ps1scripts/smoke/verify-product-loop-qa.ps1scripts/verify/verify-doc-ssot.pyscripts/verify/verify-edge-cli-json-readiness.ps1scripts/verify/verify-test-sleep-budget.ps1
💤 Files with no reviewable changes (10)
- scripts/smoke/verify-edge-sqlite-durable-hardening.ps1
- scripts/smoke/verify-product-loop-observed-e2e.ps1
- scripts/release/verify-tauri-sidecar-runtime-evidence.ps1
- scripts/smoke/verify-edge-sqlite-durable-observed-smoke.ps1
- scripts/release/verify-agenthub-brand-assets.ps1
- hub-server/scripts/check-local-edge-target-duplicates.ps1
- scripts/verify/verify-edge-cli-json-readiness.ps1
- scripts/smoke/verify-product-loop-qa.ps1
- scripts/lib/evidence/verify-diff-proposal-manifest.ps1
- scripts/verify/verify-test-sleep-budget.ps1
| def is_active_doc(path: str) -> bool: | ||
| p = normalize_path(path) | ||
| if re.match(r"^docs/(archive|archives|audit|release)/", p): | ||
| return False | ||
| if p in ("AGENTS.md", "CONTRIBUTING.md", "reference/INDEX.md"): | ||
| return True | ||
| if p in ("api/README.md", "api/events.md", "api/conventions.md"): | ||
| return True | ||
| if p == "edge-server/README.md": | ||
| return True | ||
| if p in ("hub-server/README.md", "hub-server/deployments/README.md", "hub-server/tests/README.md"): | ||
| return True | ||
| if p in ("app/web/README.md", "app/desktop/README.md", "app/mobile-rn/README.md"): | ||
| return True | ||
| if p == "docs/reference/backend-performance-gates.md": | ||
| return True | ||
| if p in ("docs/README.md", "docs/history.md", "docs/decisions.md", "docs/reference/README.md", "docs/api-reference.md"): | ||
| return True | ||
| if p == "docs/roadmap.md": | ||
| return True | ||
| if re.match(r"^docs/(analysis|plan|progress|governance)/.+\.md$", p): | ||
| return True | ||
| if re.match(r"^\.agents/skills/.+\.md$", p): | ||
| return True | ||
| return False |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
将所有活动入口文档纳入禁止模式扫描。
check_forbidden_patterns() 只扫描 is_active_doc() 返回 True 的文件。该函数遗漏根 README.md,也遗漏 docs/developer-quickstart.md、docs/architecture.md 和架构子文档。任一 forbidden 模式都可进入这些受 SSOT 管理的入口文档,而检查仍会成功。
定义共享的活动文档清单,并让禁止模式扫描复用该清单。至少将根 README.md 和所有 SSOT 入口文档加入范围。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/verify/verify-doc-ssot.py` around lines 38 - 62, 更新 is_active_doc 及
check_forbidden_patterns 使用的活动文档判定,定义共享的活动文档清单或匹配规则,避免扫描范围分散。将根
README.md、docs/developer-quickstart.md、docs/architecture.md 及其架构子文档和其他所有 SSOT
入口文档纳入该清单,并确保禁止模式扫描复用同一判定。
| def exists(rel_path: str) -> bool: | ||
| return os.path.exists(os.path.join(ROOT, rel_path.replace("/", os.sep))) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
限制映射表脚本路径到仓库内的常规文件。
映射表中的 ref 直接传入 exists()。空值会解析为 ROOT,绝对路径会使 os.path.join() 忽略 ROOT,目录和 .. 路径也可通过存在性检查。check_agents_md_paths() 会跳过绝对路径,因此不会阻断此路径。
使用根目录约束的路径解析器,并要求每个展开后的映射值为非空的仓库内常规文件。
建议的校验边界
+def is_repo_file(rel_path: str) -> bool:
+ if not rel_path or os.path.isabs(rel_path):
+ return False
+ root = os.path.realpath(ROOT)
+ candidate = os.path.realpath(os.path.join(root, rel_path.replace("/", os.sep)))
+ try:
+ return os.path.commonpath((root, candidate)) == root and os.path.isfile(candidate)
+ except ValueError:
+ return False
+
...
- if not exists(candidate):
+ if not is_repo_file(candidate):
fail(f"AGENTS.md mapping table references missing path: {candidate}")Also applies to: 327-333
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/verify/verify-doc-ssot.py` around lines 65 - 66, 更新 exists() 及
check_agents_md_paths() 使用根目录约束的路径解析逻辑:拒绝空值、绝对路径和包含 .. 的越界路径,并确保解析后的路径仍位于 ROOT
内且指向常规文件,而非目录。对映射表中每个展开后的 ref 执行该校验,避免通过跳过绝对路径绕过检查。
| def check_dated_governance() -> None: | ||
| governance_dir = os.path.join(ROOT, "docs", "governance") | ||
| dated = [] | ||
| if os.path.isdir(governance_dir): | ||
| for name in os.listdir(governance_dir): | ||
| if name.endswith(".md") and re.search(r"\d{4}-\d{2}-\d{2}", name): | ||
| dated.append(name) | ||
| if dated: | ||
| fail("dated governance evidence must live in the external archive indexed by docs/history.md: " + ", ".join(sorted(dated))) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
递归检查带日期的治理文档。
os.listdir(governance_dir) 只检查直接子项。docs/governance/reviews/2026-01-01.md 会被 is_active_doc() 视为活动治理文档,但不会被此检查发现。
递归遍历 docs/governance,并在失败信息中报告相对路径。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/verify/verify-doc-ssot.py` around lines 129 - 137, The
check_dated_governance function uses os.listdir which only checks direct
children of governance_dir, missing dated files in subdirectories like
docs/governance/reviews/2026-01-01.md. Replace the os.listdir iteration with a
recursive traversal (such as os.walk) that examines all files throughout the
governance_dir tree, and update the failure message to report relative paths
from the governance_dir root instead of just filenames.
| def main() -> int: | ||
| check_root_entrypoints() | ||
| check_stale_paths() | ||
| check_dated_governance() | ||
| check_readme_entrypoints() | ||
| check_required_markers() | ||
| check_forbidden_patterns() | ||
| check_max_lines() | ||
| check_agents_md_paths() | ||
| check_agents_md_mapping_table() | ||
| check_no_script_mirror() | ||
| print("doc SSOT ok") | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| try: | ||
| sys.exit(main()) | ||
| except Exception as exc: # noqa: BLE001 —— 顶层兜底,对齐 ps1 $ErrorActionPreference='Stop' | ||
| print(f"ERROR: {exc}", file=sys.stderr) | ||
| sys.exit(1) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
在 validate job 中执行 Python verifier。
.github/workflows/checks.yml Line 818 through Line 824 仍只执行 ./scripts/verify/verify-doc-ssot.ps1。AGENTS.md 映射表也仍声明 .ps1 verifier。因此,新增 main() 当前没有 CI 调用方,Python 迁移的行为差异不会阻断合并。
迁移期间请在同一个 validate job 中双跑两个 verifier,并让任一非零退出码失败。Python 成为权威实现后,再将 AGENTS.md 映射切换到 .py。
🧰 Tools
🪛 Ruff (0.16.0)
[warning] 374-374: Comment contains ambiguous , (FULLWIDTH COMMA). Did you mean , (COMMA)?
(RUF003)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/verify/verify-doc-ssot.py` around lines 356 - 376, Update the
validate job in `.github/workflows/checks.yml` (around lines 818-824) to execute
both the existing `./scripts/verify/verify-doc-ssot.ps1` and the new Python
verifier alongside it, ensuring that a non-zero exit code from either verifier
causes the job to fail. Additionally, update the AGENTS.md mapping table entry
for the doc-ssot verifier to indicate that both the .ps1 and .py implementations
are being executed during this migration period, with the understanding that
once Python becomes the authoritative implementation, the mapping will be
switched to reference only the .py verifier.
9b46f0c to
959acfe
Compare
959acfe to
8e102e7
Compare
8e102e7 to
e1eeb9e
Compare
e1eeb9e to
b274ca4
Compare
删除全仓零引用 ps1(引用盘点:99 个 ps1 中 10 个无任何 yml/md/script 引用):
verify-doc-ssot.ps1 → verify-doc-ssot.py 迁移(双跑对照 0 diff:147 paths / 34 script paths / 32 CI files / doc SSOT ok,rc 0/0)。ps1 保留待 CI 验证后删除。
Summary by CodeRabbit
Documentation
Chores