Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions governance/evidence-query.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ open(sys.argv[2], "w", encoding="utf-8", newline="\n").write(
PYEOF
return 0
fi
if grep -qi 'not found' "$TMP/api.err" 2>/dev/null; then
return 1 # 源缺席(尚无影子记录)——过渡期合法,非红
# 404 两种报文都算源缺席:路径不存在="Not Found";ref(分支)不存在=
# "No ref found for ..."(不含 "not found" 字样——2026-08-29 波次通道实测抓出:
# butler-ledger 分支未建被误判"非 404 拉取失败"→ INFRA exit 2,源缺席本应合法跳过)
if grep -qiE 'not found|no ref found' "$TMP/api.err" 2>/dev/null; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Missing adr-nnnn reference 📘 Rule violation § Compliance

This PR modifies files under the C1 governance/ path, but neither its title nor description
contains an ADR-NNNN reference. Add the applicable ADR identifier to the PR metadata to satisfy
the governance-path requirement.
Agent Prompt
## Issue description
The PR changes C1 governance paths but its title and description contain no reference matching `ADR-[0-9]{4}`.

## Issue Context
Compliance rule 2778538 requires at least one applicable `ADR-NNNN` reference in the PR title or description whenever a file under `governance/` is modified. Update the PR metadata rather than the implementation unless a code comment is also desirable.

## Fix Focus Areas
- governance/evidence-query.sh[47-47]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

return 1 # 源缺席(尚无影子记录/账本分支未建)——过渡期合法,非红
fi
echo "FATAL: $repo@$branch $path 拉取失败(非 404):" >&2; cat "$TMP/api.err" >&2; exit 2
}
Expand All @@ -57,7 +60,7 @@ for ent in json.load(open(sys.argv[1], encoding="utf-8")):
base64.b64decode(ent["content"]).decode("utf-8"))
PYEOF
else
if ! grep -qi 'not found' "$TMP/api.err" 2>/dev/null; then
if ! grep -qiE 'not found|no ref found' "$TMP/api.err" 2>/dev/null; then
echo "FATAL: metering-ledger 目录拉取失败:" >&2; cat "$TMP/api.err" >&2; exit 2
fi
fi
Expand Down
9 changes: 9 additions & 0 deletions governance/tests/test-evidence-shadow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ case "$url" in
if [[ -f "$F/drill-tampered.json" ]]; then cat "$F/drill-tampered.json"; else cat "$F/drill.json"; fi ;;
"repos/Cloudbird-Software/.github/contents/governance/butler/shadow-evidence.jsonl?ref=butler-ledger")
if [[ "${GH_STUB_BUTLER_MISSING:-}" == "1" ]]; then echo "gh: Not Found (HTTP 404)" >&2; exit 1; fi
if [[ "${GH_STUB_BUTLER_MISSING:-}" == "2" ]]; then
echo 'gh: No ref found for "butler-ledger" in repo Cloudbird-Software/.github (HTTP 404)' >&2; exit 1
fi
cat "$F/butler.json" ;;
*) echo "gh-stub: 意外 URL $url" >&2; exit 1 ;;
esac
Expand All @@ -173,6 +176,12 @@ MOUT=$(GH="$GHSTUB" GH_STUB_FIXTURES="$TMP/fixtures" GH_TOKEN=stub GH_STUB_BUTLE
bash "$DIR/governance/evidence-query.sh" 2>"$TMP/m.err"); MRC=$?
MN=$(nlines "$MOUT")
[[ $MRC -eq 0 && "$MN" -eq 4 ]] && pass "butler 源缺席(404)→ 跳过非红(4 条)" || fail "源缺席误红(rc=$MRC 行=$MN)"
# 源缺席(404 第二报文形态——账本分支未建 "No ref found"):同跳过非红
# (2026-08-29 波次通道实测回归:该形态曾被误判"非 404"→ INFRA exit 2)
ROUT=$(GH="$GHSTUB" GH_STUB_FIXTURES="$TMP/fixtures" GH_TOKEN=stub GH_STUB_BUTLER_MISSING=2 \
bash "$DIR/governance/evidence-query.sh" 2>"$TMP/r.err"); RRC=$?
RN=$(nlines "$ROUT")
[[ $RRC -eq 0 && "$RN" -eq 4 ]] && pass "源缺席(No ref found 分支未建)→ 跳过非红(4 条)" || fail "分支未建误红(rc=$RRC 行=$RN)"
# 负向:任一源链断 → exit 3 且 stdout 零输出(不可信数据不出结果)
python3 - "$TMP/fixtures" <<'PYEOF'
import base64, json, sys
Expand Down