Skip to content

fix: evidence-query 源缺席判定兼容 "No ref found" 404 报文形态(W2-C3 实测缺陷) - #436

Merged
randypanding merged 2 commits into
mainfrom
fix/evidence-query-no-ref-found
Aug 29, 2026
Merged

fix: evidence-query 源缺席判定兼容 "No ref found" 404 报文形态(W2-C3 实测缺陷)#436
randypanding merged 2 commits into
mainfrom
fix/evidence-query-no-ref-found

Conversation

@randypanding

@randypanding randypanding commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Card: #414
ADR-0103

问题(W2-C3 波次通道实测 run 33243560655 抓出)

butler-ledger 分支未建时,contents API 404 报文为 No ref found for "butler-ledger" ...——不含 not found 字样,被 evidence-query.sh fetch_file 误判为"非 404 拉取失败" → FATAL exit 2 → cost-check INFRA exit 2(cost-infra issue #435 已开出,fail-closed 方向正确:未盲熔断)。

源缺席(账本分支未建/尚无影子记录)本应是合法过渡态(W1-B2 / BEH-03 / ADR-0103)。

修复

  • fetch_file 与 metering 目录拉取两处的缺席判定 grep 'not found'grep -iE 'not found|no ref found'
  • 回归用例:test-evidence-shadow.sh 桩新增 GH_STUB_BUTLER_MISSING=2(No ref found 报文形态)→ 断言跳过非红

验证

  • bash governance/tests/test-evidence-shadow.sh PASS(含新增回归用例)
  • make gates-pr 全绿

波次通道实测(W2-C3 AC-9a/9b,run 33243560655)抓出:butler-ledger 分支
未建时 contents API 404 报文为 "No ref found for ..."(不含 "not found"),
被误判"非 404 拉取失败"→ INFRA exit 2——源缺席本应是合法过渡态(W1-B2)。
fail-closed 方向无误(未盲熔断、cost-infra issue #435 已开出),仅缺席
判定面修复。回归用例入 test-evidence-shadow.sh(GH_STUB_BUTLER_MISSING=2)。

ADR-0103 / IR-0006 W2-C3 / BEH-03
Copilot AI lite review requested due to automatic review settings August 29, 2026 08:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f9770ac5-4fba-4005-8e58-728e2044eef6

📥 Commits

Reviewing files that changed from the base of the PR and between 9a54b28 and bb1bc0e.

📒 Files selected for processing (3)
  • .archive-w1d1
  • .ciw
  • env-defs

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

Changes

整体变更扩展 GitHub 源缺席处理,并新增对应回归测试。同时更新三个子模块提交指针。

证据源缺席处理

Layer / File(s) Summary
处理源缺席响应
governance/evidence-query.sh
源文件和 metering-ledger 目录在收到 not foundno ref found 时跳过源。其他错误仍返回退出码 2。
验证账本分支缺席处理
governance/tests/test-evidence-shadow.sh
测试桩模拟 No ref found 404 响应。回归测试验证查询成功退出并返回其余 4 条记录。

子模块提交指针更新

Layer / File(s) Summary
更新子模块提交指针
.archive-w1d1, .ciw, env-defs
三个子模块指向新的子项目提交。

Suggested labels: bug

Merge Risk: ⚪ Minimal · up to bb1bc

The change recognizes the supported "No ref found" 404 response as a valid source-absence state, preventing an unnecessary fatal failure while preserving failure handling for other errors. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning 标题准确描述了修复内容,并使用了必需的 fix: 前缀。但标题长度为 63 个字符,超过 50 个字符的限制。 将标题缩短至不超过 50 个字符,同时保留 fix: 前缀和核心修复信息。
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/evidence-query-no-ref-found

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

修复 evidence-query 对 “No ref found” 404 的源缺席判定

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• 将 “No ref found” 404 识别为合法源缺席,避免误报基础设施故障。
• 增加账本分支未创建场景的回归测试,确认查询正常跳过该源。
Diagram

graph TD
  T["回归测试"] --> Q["证据查询"] --> A["Contents API"] --> D{"缺席报文?"}
  D -->|匹配| S["跳过该源"]
  D -->|不匹配| F["基础设施失败"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. 按 HTTP 状态码分类
  • ➕ 不依赖 GitHub CLI 错误文案
  • ➕ 可统一处理未来新增的 404 报文形态
  • ➖ 需要调整 gh 响应捕获方式
  • ➖ 改动范围和验证矩阵明显扩大

Recommendation: 当前正则扩展是针对已实测报文的最小风险修复,并通过回归用例保持既有 fail-closed 行为,适合本次缺陷修复。后续若继续出现文案变体,建议改为提取 HTTP 状态码,将所有明确的 404 统一归类为源缺席。

Files changed (2) +15 / -3

Bug fix (1) +6 / -3
evidence-query.sh兼容缺失分支的 No ref found 404 +6/-3

兼容缺失分支的 No ref found 404

• 将文件和 metering 目录拉取的缺席判定扩展为同时识别 Not Found 与 No ref found。未创建账本分支现在会作为合法过渡态跳过,其他 API 错误仍保持 fail-closed 退出。

governance/evidence-query.sh

Tests (1) +9 / -0
test-evidence-shadow.sh覆盖未创建账本分支的查询回归场景 +9/-0

覆盖未创建账本分支的查询回归场景

• 扩展 gh 桩以返回 No ref found 404,并断言 evidence-query 成功退出且仅省略 butler 源记录。该用例防止缺失分支再次被误判为基础设施故障。

governance/tests/test-evidence-shadow.sh

@coderabbitai coderabbitai Bot added the bug Something isn't working label Aug 29, 2026
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Missing ADR-NNNN reference 📘 Rule violation § Compliance
Description
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.
Code

governance/evidence-query.sh[47]

+  if grep -qiE 'not found|no ref found' "$TMP/api.err" 2>/dev/null; then
Relevance

●●● Strong

Recent governance history accepts enforcing ADR references for C1 changes; this PR lacks an ADR-NNNN
identifier.

PR-#19
PR-#50

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 2778538 applies because the PR adds logic at governance/evidence-query.sh line 47 (and also
changes another file under governance/). The supplied PR title and description contain no
substring matching ADR-NNNN.

Rule 2778538: Require ADR reference in PR description when changing C1 governance paths
governance/evidence-query.sh[47-47]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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


Grey Divider

Context sources
✅ Compliance rules (platform): 22 rules
Review mode: ⚖️ Balanced

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

# 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

@randypanding
randypanding force-pushed the fix/evidence-query-no-ref-found branch from bb1bc0e to 9a54b28 Compare August 29, 2026 08:54
@randypanding
randypanding merged commit 1ea31aa into main Aug 29, 2026
15 checks passed
@randypanding
randypanding deleted the fix/evidence-query-no-ref-found branch August 29, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants