-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 治理层对齐——ruleset 合并解锁+GOVERNANCE 口径+组织地图+gate 存在性(ADR-0021) #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dab9ac8
16e4452
7d70ba2
41b8d9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,13 +33,20 @@ jobs: | |
| exit 2 | ||
| fi | ||
| bash governance/drift-check.sh | tee drift-report.txt | ||
| - name: 发现漂移则开 issue(幂等) | ||
| - name: 发现漂移则开 issue(幂等;基础设施故障分通道——ADR-0021) | ||
| if: failure() | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| REPO: ${{ github.repository }} | ||
| run: | | ||
| TITLE="治理漂移检测:组织配置与 governance/ 落盘不一致" | ||
| # 分通道(红队 #66-G1):exit 2(token 缺失)与 API 故障不是漂移—— | ||
| # 此前一律按漂移开口径开 issue,限流/传输故障会在整点被误报为漂移。 | ||
| # 判据:报告里存在 DRIFT 行=真漂移;否则=检测器自身故障(标题/处置路径不同)。 | ||
| if ! grep -q '^DRIFT' drift-report.txt 2>/dev/null; then | ||
| TITLE="drift-check 运行失败(基础设施故障——非漂移)" | ||
| else | ||
| TITLE="治理漂移检测:组织配置与 governance/ 落盘不一致" | ||
|
Comment on lines
+45
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3. Api failures reported as drift The new classifier treats every report containing a DRIFT line as real governance drift, but drift-check.sh deliberately emits DRIFT for API, permission, rate-limit, and transport failures. Those detector outages will therefore continue to use the governance-drift title instead of the new infrastructure-failure channel. Agent Prompt
Comment on lines
+45
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4. Failure channels share issue Although the PR selects two titles, both outcomes still search and reuse the same auto-drift-report issue. If an infrastructure issue already exists, later genuine drift is appended beneath the “非漂移” title—or vice versa—so the incident type shown in the issue list remains wrong and the promised separate channels do not exist. Agent Prompt
|
||
| fi | ||
|
Comment on lines
+45
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- workflow ---'
cat -n .github/workflows/governance-drift.yml | sed -n '1,110p'
printf '%s\n' '--- action references ---'
rg -n 'uses:|permissions:|persist-credentials|run:|grep|drift-report' .github/workflows/governance-drift.yml
printf '%s\n' '--- tracked workflow status ---'
git diff --stat -- .github/workflows/governance-drift.ymlRepository: Cloudbird-Software/.github Length of output: 6138 🏁 Script executed: #!/bin/bash
set +e
run_case() {
name=$1
command=$2
printf '\n--- %s ---\n' "$name"
bash -e -o pipefail -c "$command"
printf 'exit=%s\n' "$?"
}
run_case "missing report" \
'if ! grep -q "^DRIFT" /tmp/nonexistent-drift-report.txt 2>/dev/null; then TITLE=failure; else TITLE=drift; fi
FP=$(grep "^DRIFT" /tmp/nonexistent-drift-report.txt | sed -E "s/回填时限=[0-9]+s/回填时限=<AGE>s/g" | sort -u | sha256sum | cut -d" " -f1)
printf "after FP=%s\n" "$FP"'
run_case "report without DRIFT" \
'if ! grep -q "^DRIFT" <(printf "%s\n" "OK healthy") 2>/dev/null; then TITLE=failure; else TITLE=drift; fi
FP=$(grep "^DRIFT" <(printf "%s\n" "OK healthy") | sed -E "s/回填时限=[0-9]+s/回填时限=<AGE>s/g" | sort -u | sha256sum | cut -d" " -f1)
printf "after FP=%s\n" "$FP"'
run_case "report with DRIFT" \
'if ! grep -q "^DRIFT" <(printf "%s\n" "DRIFT x 回填时限=123s") 2>/dev/null; then TITLE=failure; else TITLE=drift; fi
FP=$(grep "^DRIFT" <(printf "%s\n" "DRIFT x 回填时限=123s") | sed -E "s/回填时限=[0-9]+s/回填时限=<AGE>s/g" | sort -u | sha256sum | cut -d" " -f1)
printf "after TITLE=%s FP=%s\n" "$TITLE" "$FP"'
printf '\n--- fallback behavior ---\n'
bash -e -o pipefail -c \
'DRIFT_LINES=$(grep "^DRIFT" <(printf "%s\n" "OK healthy") 2>/dev/null || true)
FP=$(printf "%s\n" "$DRIFT_LINES" | sed -E "s/回填时限=[0-9]+s/回填时限=<AGE>s/g" | sort -u | sha256sum | cut -d" " -f1)
printf "fallback continues; FP=%s\n" "$FP"'
printf 'exit=%s\n' "$?"Repository: Cloudbird-Software/.github Length of output: 543 🏁 Script executed: #!/bin/bash
set +e
run_case() {
name=$1
command=$2
printf '\n--- %s ---\n' "$name"
bash -e -o pipefail -c "$command"
printf 'exit=%s\n' "$?"
}
run_case "report without DRIFT" \
'REPORT_CONTENT="OK healthy"
if ! grep -q "^DRIFT" <<<"$REPORT_CONTENT" 2>/dev/null; then TITLE=failure; else TITLE=drift; fi
FP=$(grep "^DRIFT" <<<"$REPORT_CONTENT" | sed -E "s/回填时限=[0-9]+s/回填时限=<AGE>s/g" | sort -u | sha256sum | cut -d" " -f1)
printf "after TITLE=%s FP=%s\n" "$TITLE" "$FP"'
run_case "report with DRIFT" \
'REPORT_CONTENT="DRIFT x 回填时限=123s"
if ! grep -q "^DRIFT" <<<"$REPORT_CONTENT" 2>/dev/null; then TITLE=failure; else TITLE=drift; fi
FP=$(grep "^DRIFT" <<<"$REPORT_CONTENT" | sed -E "s/回填时限=[0-9]+s/回填时限=<AGE>s/g" | sort -u | sha256sum | cut -d" " -f1)
printf "after TITLE=%s FP=%s\n" "$TITLE" "$FP"'Repository: Cloudbird-Software/.github Length of output: 321 为缺失报告和空漂移结果增加安全回退。 当 🤖 Prompt for AI Agents
Comment on lines
+45
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 将基础设施故障与治理漂移分离,并为两类结果使用独立生命周期。 当前工作流仅通过 📍 Affects 1 file
🤖 Prompt for AI Agents |
||
| # 归属标记(评审项):issue 归属判定用专属 label 而非标题搜索—— | ||
| # 标题搜索会把人工/其他来源的同名 issue 误当作本检测器的报告去评论/关闭 | ||
| LABEL="auto-drift-report" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ | |
| "parameters": { | ||
| "required_approving_review_count": 0, | ||
| "dismiss_stale_reviews_on_push": true, | ||
| "require_code_owner_review": true, | ||
| "require_code_owner_review": false, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Owner review no longer enforced Setting require_code_owner_review to false while the required approval count remains zero removes the enforced owner-only review barrier for every repository covered by main-protection. A collaborator or automation identity with merge capability can therefore merge a C1 governance change after gate passes without the owner-merge authorization required by the governance policy. Agent Prompt
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
printf '%s\n' '--- target file ---'
cat -n governance/rulesets/main-protection.json | sed -n '1,100p'
printf '%s\n' '--- related governance and workflow files ---'
git ls-files | rg '(^|/)(ADR|adr|governance|\.github/workflows|\.github/dependabot)' | sed -n '1,200p'
printf '%s\n' '--- relevant references ---'
rg -n -i 'ADR-0021|code.?owner|approv|gate|pull_request_target|workflow_call|branch protection|ruleset|bypass' governance .github README.md 2>/dev/null | sed -n '1,240p'
printf '%s\n' '--- target diff ---'
git diff -- governance/rulesets/main-protection.jsonRepository: Cloudbird-Software/.github Length of output: 16912 🏁 Script executed: #!/bin/bash
printf '%s\n' '--- gate workflow ---'
cat -n .github/workflows/gate.yml | sed -n '1,190p'
printf '%s\n' '--- governance merge and CI declarations ---'
cat -n governance/GOVERNANCE.yaml | sed -n '1,115p'
cat -n governance/GOVERNANCE.yaml | sed -n '130,210p'
printf '%s\n' '--- repository policy files ---'
for f in .github/CODEOWNERS CODEOWNERS governance/expected-state.json; do
if [ -f "$f" ]; then
echo "--- $f ---"
cat -n "$f" | sed -n '1,180p'
fi
done
printf '%s\n' '--- workflow and ruleset references ---'
rg -n -i 'on:|pull_request|pull_request_target|workflow_dispatch|permissions:|actions:|gate|owner-only|review|bypass|ADR-0021|C1' .github/workflows governance/GOVERNANCE.yaml governance/expected-state.json governance/drift-check.sh governance/apply.sh | sed -n '1,300p'Repository: Cloudbird-Software/.github Length of output: 34548 🏁 Script executed: #!/bin/bash
python3 - <<'PY'
import json
from pathlib import Path
ruleset = json.loads(Path("governance/rulesets/main-protection.json").read_text())
pr = next(rule["parameters"] for rule in ruleset["rules"] if rule["type"] == "pull_request")
checks = next(rule["parameters"]["required_status_checks"] for rule in ruleset["rules"] if rule["type"] == "required_status_checks")
print("required_approving_review_count =", pr["required_approving_review_count"])
print("require_code_owner_review =", pr["require_code_owner_review"])
print("required_status_check_contexts =", [c["context"] for c in checks])
print("bypass_actor_types =", [a["actor_type"] for a in ruleset["bypass_actors"]])
governance = Path("governance/GOVERNANCE.yaml").read_text()
codeowners = Path("CODEOWNERS").read_text()
gate = Path(".github/workflows/gate.yml").read_text()
print("governance_requires_owner_merge =", 'requires: [PR, "ADR(新建或引用编号)", "drift-check 本地预检", owner-merge]' in governance)
print("governance_declares_owner_only_review =", "owner-only review" in governance)
print("codeowners_has_randypanding_owner =", "`@randypanding`" in codeowners)
print("gate_contains_review_approval_check =", any(
token in gate for token in ("required_approving_review_count", "require_code_owner_review", "owner-only review")
))
PYRepository: Cloudbird-Software/.github Length of output: 487 恢复代码所有者审批
🤖 Prompt for AI Agents |
||
| "require_last_push_approval": false, | ||
| "required_review_thread_resolution": true, | ||
| "allowed_merge_methods": [ | ||
|
|
@@ -61,4 +61,4 @@ | |
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5. Non-files satisfy adr check
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools