Skip to content

feat: 统一证据查询第 5 源(tickets)+ self-cloud-pool entry 注记 W2-C1 落地(IR-0006 W2-C1 / ADR-0103) - #444

Merged
randypanding merged 2 commits into
mainfrom
w2c1-tickets-source
Aug 29, 2026
Merged

feat: 统一证据查询第 5 源(tickets)+ self-cloud-pool entry 注记 W2-C1 落地(IR-0006 W2-C1 / ADR-0103)#444
randypanding merged 2 commits into
mainfrom
w2c1-tickets-source

Conversation

@randypanding

@randypanding randypanding commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Card: #412
ADR-0103(决策 4:云内网入图/可删除执行层)

摘要(W2-C1 治理面接缝,承 cnb-bridge PR #6

  • evidence-query.sh 源 5(tickets)Cloudbird-Software/cnb-bridge @ tickets-ledger tickets.jsonl——内网调度器短票据 grant/revoke 事件(AC-5b:短票据签发/收回事件按 schema v1 进统一账本)。同款纪律:HTTP 404=源缺席(过渡期合法非红);链断=fail-closed exit 3。
  • providers.yamlself-cloud-pool.entry 注记 W2-C1 v0 落位(cnb-bridge 仓 selfcloud/),承接卡 blastRadius .github: providers.yaml 条目注记
  • .gitignore.scratch/(工作区独立克隆目录;防 gitlink 误提交坏 CI checkout——fix: 移除误提交的工作区 gitlink,修复 main CI checkout #438 同类事故预防)。

实测证据

bash governance/evidence-query.sh --card "Cloudbird-Software/.github#412"
SUMMARY {... "by_source": {..., "tickets": 2}, "by_card_top": {"Cloudbird-Software/.github#412": 2}, "total": 2}
rc=0

tickets 源事件由 Go 发射器产出(selfcloud emit-ledger),链形态与 evidence_shadow.py 逐字节兼容(金向量锚定);本仓 Python 验链器直接验链通过。

INV 纪律

  • INV-02:tickets 源只是 schema v1 记录源之一,源缺席≠链断(fail-closed 语义不变);删除调度器后其余四源照常(REMOVAL 断言在 cnb-bridge 仓 §selfcloud)。
  • INV-04:票据 HMAC 密钥在内网域 Vault,事件 payload 零凭据。

C1 路径:本 PR 为治理接缝变更(evidence-query/providers.yaml),引用 ADR-0103;owner review 后合并。

Summary by CodeRabbit

  • 治理与可靠性
    • 新增工单记录来源,统一纳入证据查询及来源统计。
    • 强化记录链路校验与异常处理,缺失数据可安全跳过,其他错误保持严格拦截。
    • 更新云资源调度规范,明确任务执行、短期凭证、网络访问限制及无状态运行要求。
  • 维护
    • 优化工作区管理,避免临时内容被纳入版本控制。
    • 扩充相关验证场景,覆盖工单记录及来源缺失情况。

… W2-C1 / ADR-0103)

- evidence-query.sh:源 5 = cnb-bridge @ tickets-ledger tickets.jsonl(内网调度器
  短票据 grant/revoke,AC-5b 统一账本;404=源缺席非红,链断=fail-closed exit 3)
- providers.yaml:self-cloud-pool entry 注记 v0 落位(cnb-bridge/selfcloud)
- .gitignore:.scratch/(工作区独立克隆,防 gitlink 误提交坏 CI checkout)
- 实测:五源查询 #412 by_source tickets=2(Go 发射器产出,跨语言验链绿)

Card: #412
Copilot AI lite review requested due to automatic review settings August 29, 2026 10:37

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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Unify tickets ledger into evidence queries and register W2-C1 entry

✨ Enhancement ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Adds ticket grant and revoke events as the fifth unified evidence source.
• Preserves source-absence tolerance and fail-closed chain validation for ticket ledgers.
• Records the W2-C1 scheduler entry and ignores scratch workspaces.
Diagram

graph TD
  M[("Metering ledger")] --> Q["Evidence query"] --> V["Chain verifier"] --> O["Merged JSONL"] --> S["Source summary"]
  G[("Governance ledgers")] --> Q
  T[("Tickets ledger")] --> Q
Loading
High-Level Assessment

Extending the existing unified query and reusing evidence_shadow.py is the appropriate approach because tickets already conform to schema v1 and the established hash-chain format. A separate ticket-specific query would fragment evidence discovery and duplicate integrity semantics.

Files changed (3) +13 / -6

Enhancement (1) +10 / -5
evidence-query.shAdd tickets as the fifth evidence source +10/-5

Add tickets as the fifth evidence source

• Fetches the cnb-bridge tickets ledger, treats HTTP 404 as a valid absent source, and passes available records through the shared fail-closed chain verifier. Includes tickets in merged output and per-source summary counts.

governance/evidence-query.sh

Other (2) +3 / -1
.gitignoreIgnore scratch workspace clones +1/-0

Ignore scratch workspace clones

• Adds .scratch/ to the ignored workspace-clone directories, preventing accidental gitlink commits that can break CI checkout.

.gitignore

providers.yamlRegister the deployed W2-C1 scheduler entry +2/-1

Register the deployed W2-C1 scheduler entry

• Updates self-cloud-pool to identify the cnb-bridge selfcloud scheduler implementation and document its Job Contract, ticket issuance, egress allowlist, and stateless enforcement responsibilities.

governance/providers.yaml

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 46746272-122f-4828-8261-d0c422a7d748

📥 Commits

Reviewing files that changed from the base of the PR and between 82dd107 and 146992d.

📒 Files selected for processing (1)
  • governance/tests/test-evidence-shadow.sh

📝 Walkthrough

Walkthrough

Changes

新增 tickets 账本源,并将其纳入证据查询、验链、归并和测试。更新 self-cloud-pool 调度描述。新增 .scratch/ 忽略规则。

治理证据集成

Layer / File(s) Summary
tickets 账本源接入
governance/evidence-query.sh
新增 tickets-ledger/tickets.jsonl 拉取、验链、统一归并和来源统计。
证据查询测试覆盖
governance/tests/test-evidence-shadow.sh
新增 tickets grant/revoke、API 路由桩、按 card 查询和源缺席测试,并更新五源查询断言。
self-cloud-pool 调度契约
governance/providers.yaml
将调度入口更新为 cnb-bridgeselfcloud/ 服务器调度器,并记录 Job Contract、短票据、egress allowlist 和无状态约束。

工作区文件隔离

Layer / File(s) Summary
临时目录忽略规则
.gitignore
新增 .scratch/ 忽略规则。

Suggested labels: security, feature

Merge Risk: ⚪ Minimal · up to 82dd1

This PR adds the tickets evidence source, updates the provider annotation, and ignores workspace scratch files; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning 标题与变更内容相关,并使用了允许的 feat: 前缀;但标题长度为 87 个字符,超过 50 个字符的限制。 将标题缩短至不超过 50 个字符,同时保留 feat: 前缀和主要变更信息。
✅ 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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch w2c1-tickets-source

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

@qodo-code-review

qodo-code-review Bot commented Aug 29, 2026

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. 新增源打红治理测试 ✓ Resolved 🐞 Bug ≡ Correctness
Description
新增的 cnb-bridge API 请求未加入 test-evidence-shadow.sh 的 gh stub,所有统一查询用例都会命中默认分支并返回非 404,最终使该测试失败。CI
会自动执行全部 governance/tests/test-*.sh,因此当前 PR 无法通过 gate。
Code

governance/evidence-query.sh[76]

+TICKET_OK=0; fetch_file "Cloudbird-Software/cnb-bridge" "tickets-ledger" "tickets.jsonl" "$TMP/tickets.jsonl" && TICKET_OK=1 || [[ $? -eq 1 ]] || exit 2
Relevance

●●● Strong

Concrete CI stub mismatch causes the repository’s mandatory test gate to fail; accepted history
favors fixing fail-closed test wiring.

PR-#19
PR-#49

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
测试 stub 仅处理四个旧源,未知 URL 明确退出 1;fetch_file 将该非 404 失败转为 exit 2。该测试又被 gate 的通配循环无条件执行。

governance/tests/test-evidence-shadow.sh[152-191]
governance/tests/test-evidence-shadow.sh[196-215]
.github/workflows/gate.yml[181-192]

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

## Issue description
新增 tickets 源后,现有 gh stub 不认识该 API URL,导致治理测试和 CI gate 失败。

## Issue Context
为 tickets 创建有效链 fixture,并覆盖存在、404 缺席、篡改及统计/过滤场景;同步更新原四源断言和计数。

## Fix Focus Areas
- governance/tests/test-evidence-shadow.sh[152-215]
- governance/tests/test-evidence-shadow.sh[216-251]
- governance/evidence-query.sh[73-76]

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


2. 权限失败伪装源缺席 🐞 Bug ⛨ Security
Description
新增 cnb-bridge 仓未纳入脚本仍声明的“两仓可读”令牌契约,而 fetch_file 把所有 HTTP 404 都视为合法源缺席。GitHub 对无权访问的私有资源也返回
404,因此符合现有文档的细粒度 PAT 可让查询以 rc=0 成功却完全漏掉 tickets。
Code

governance/evidence-query.sh[76]

+TICKET_OK=0; fetch_file "Cloudbird-Software/cnb-bridge" "tickets-ledger" "tickets.jsonl" "$TMP/tickets.jsonl" && TICKET_OK=1 || [[ $? -eq 1 ]] || exit 2
Relevance

●● Moderate

Authorization-versus-404 ambiguity is a substantive security contract issue, but no close accepted
or rejected precedent appeared.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
代码文档仍只要求令牌读取“两仓”,且 404 无条件返回“源缺席”;GitHub 官方说明未正确认证私有资源时会故意返回 404,而不是 403。

governance/evidence-query.sh[18-18]
governance/evidence-query.sh[33-33]
governance/evidence-query.sh[38-55]
🌐 GitHub states that improperly authenticated access to an existing private resource returns 404 to avoid confirming that the private repository exists.

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

## Issue description
无法区分 tickets 文件缺席与调用者无权读取 cnb-bridge,权限错误会被静默放行。

## Issue Context
先对三个预期仓执行可见性/权限探测并 fail closed,再仅把已确认可见仓中的账本路径或 ref 404 当作过渡期缺席;同时更新 GH_TOKEN 契约和错误文案。

## Fix Focus Areas
- governance/evidence-query.sh[18-18]
- governance/evidence-query.sh[33-33]
- governance/evidence-query.sh[38-55]
- governance/evidence-query.sh[73-76]

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


3. Tickets 绕过完整模式校验 🐞 Bug ≡ Correctness
Description
新增 tickets 文件只经过 verify_file(),该函数不校验 schema v1 必需的 tskindactionverdictactor
或禁止额外字段。于是哈希链正确但 schema 非法的 Go 发射记录仍会被统一查询输出并计入证据统计。
Code

governance/evidence-query.sh[91]

+           "tickets": [tickets_f] if os.environ.get("TICKET_OK") == "1" else []}
Relevance

●● Moderate

Schema-validation gap is plausible, but closest malformed-input robustness suggestions were rejected
rather than accepted.

PR-#252

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
查询把 tickets 注册为普通证据源后只调用 verify_file;该验证器仅检查 JSON、链、tenant/card 和字符串 payload 大小,而正式 schema 还要求事件与
actor 字段并禁止额外属性。

governance/evidence-query.sh[91-104]
governance/evidence_shadow.py[97-119]
standards/evidence/record.schema.yaml[17-38]
standards/evidence/record.schema.yaml[59-69]
standards/evidence/record.schema.yaml[119-128]

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

## Issue description
统一查询仅复算 tickets 哈希链,没有验证记录满足 evidence schema v1,非法记录可被当作正式证据输出。

## Issue Context
让只读验证路径对每条已带链字段的记录执行完整 schema 校验,并以错误列表而非直接退出方式报告;至少覆盖 required、类型、枚举、时间格式和 additionalProperties。

## Fix Focus Areas
- governance/evidence-query.sh[91-104]
- governance/evidence_shadow.py[57-81]
- governance/evidence_shadow.py[97-119]
- standards/evidence/record.schema.yaml[17-38]
- standards/evidence/record.schema.yaml[59-69]
- standards/evidence/record.schema.yaml[119-128]

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



Remediation recommended

4. 大账本被静默清空 🐞 Bug ☼ Reliability
Description
tickets 是持续追加的单一 tickets.jsonl,但新增拉取沿用默认 Contents API JSON 响应;文件超过 1 MB 后 GitHub 会返回空 contentencoding: none。当前解码会写出空文件,随后查询跳过它并返回成功,造成整个 tickets 源静默消失。
Code

governance/evidence-query.sh[76]

+TICKET_OK=0; fetch_file "Cloudbird-Software/cnb-bridge" "tickets-ledger" "tickets.jsonl" "$TMP/tickets.jsonl" && TICKET_OK=1 || [[ $? -eq 1 ]] || exit 2
Relevance

●●● Strong

Historical governance reviews accept preventing silent false-green behavior from incomplete API
responses and pagination limits.

PR-#19
PR-#49

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
fetch_file 总是 base64 解码 JSON 的 content,而处理阶段将零长度文件直接跳过。GitHub 官方文档说明 1–100 MB 文件使用默认 object 响应时
content 为空且 encodingnone,必须使用 raw media type。

governance/evidence-query.sh[38-47]
governance/evidence-query.sh[93-99]
🌐 For files between 1 MB and 100 MB, GitHub says the object response has an empty content field and encoding "none"; callers must use the raw or object custom media types appropriately.

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

## Issue description
默认 Contents API 响应无法承载超过 1 MB 的持续增长 tickets 账本,查询会把其误读为空源。

## Issue Context
使用 GitHub raw media type 直接下载账本内容,检查响应形态,并为超过 1 MB 的 fixture/响应增加回归测试。

## Fix Focus Areas
- governance/evidence-query.sh[38-47]
- governance/evidence-query.sh[73-76]
- governance/evidence-query.sh[93-99]
- governance/tests/test-evidence-shadow.sh[152-215]

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


5. 畸形票据返回错误码 🐞 Bug ☼ Reliability
Description
当 tickets 中存在畸形 JSON 时,verify_file() 会记录链错误,但查询随即再次对同一行执行未捕获的 json.loads,在检查 errs 前抛出异常。命令因此返回
Python 的 exit 1 和 traceback,而不是脚本契约规定的链断 exit 3。
Code

governance/evidence-query.sh[91]

+           "tickets": [tickets_f] if os.environ.get("TICKET_OK") == "1" else []}
Relevance

●● Moderate

Unhandled malformed JSON is concrete, yet the closest parsing-hardening precedent was explicitly
rejected in a recent review.

PR-#252

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
验证器捕获 JSONDecodeError 并返回错误,但查询在到达 if errs 前再次无保护解析每一行;文件头明确承诺任一源链断返回 3。

governance/evidence-query.sh[19-20]
governance/evidence-query.sh[93-104]
governance/evidence_shadow.py[97-104]

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

## Issue description
畸形 tickets JSON 在统一错误处理前被二次解析并抛异常,破坏 exit 3 契约。

## Issue Context
先完成所有源验证;存在任何错误时统一打印并 exit 3,只有验证成功后才解析聚合,或让 verifier 返回已解析记录以避免二次解析。

## Fix Focus Areas
- governance/evidence-query.sh[93-104]
- governance/evidence_shadow.py[97-119]
- governance/tests/test-evidence-shadow.sh[238-251]

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


6. tickets fetch bypasses App identity 📘 Rule violation ⛨ Security
Description
The added tickets-ledger fetch executes a GitHub API operation through gh while the script accepts
an arbitrary ambient GH_TOKEN, explicitly including PATs, rather than obtaining a GitHub App token
through scripts/ghcb. This extends the non-standard credential path to
Cloudbird-Software/cnb-bridge.
Code

governance/evidence-query.sh[76]

+TICKET_OK=0; fetch_file "Cloudbird-Software/cnb-bridge" "tickets-ledger" "tickets.jsonl" "$TMP/tickets.jsonl" && TICKET_OK=1 || [[ $? -eq 1 ]] || exit 2
Relevance

●● Moderate

App-identity concerns are plausible, but available precedent rejects changing provider entry
semantics; no close fetch-helper precedent.

PR-#352

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 2778539 requires GitHub API scripts to obtain tokens exclusively through the standard App
helpers. The added line invokes fetch_file for cnb-bridge; fetch_file runs gh api, while the
same script documents and enforces an externally supplied GH_TOKEN that may be a PAT, and
scripts/ghcb provides the repository-standard App-token entry point.

Rule 2778539: Use GitHub App identity and ghcb script for agent GitHub operations
governance/evidence-query.sh[18-18]
governance/evidence-query.sh[33-40]
governance/evidence-query.sh[76-76]
scripts/ghcb[169-174]

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 new `tickets` source uses the script's caller-provided `GH_TOKEN`/PAT path instead of the repository-standard GitHub App identity.

## Issue Context
Compliance rule 2778539 requires scripts performing GitHub API calls to obtain tokens through `scripts/ghcb` or `scripts/gh-app-token.sh`. Because the query reads multiple private repositories, mint and use an appropriately repository-scoped App token for each fetch rather than accepting an arbitrary PAT.

## Fix Focus Areas
- governance/evidence-query.sh[18-40]
- governance/evidence-query.sh[73-76]

ⓘ 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
✅ Web pages:
  +7 more
Review mode: ⚖️ Balanced: This changes executable evidence-query behavior and provider configuration, including a new external ledger source and fail-closed integration semantics; it carries meaningful contract and governance risk, but is not dense enough to warrant extended review.

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

DRILL_OK=0; fetch_file "Cloudbird-Software/.github" "drill-ledger" "governance/drill/shadow-evidence.jsonl" "$TMP/drill.jsonl" && DRILL_OK=1 || [[ $? -eq 1 ]] || exit 2
BUTLER_OK=0; fetch_file "Cloudbird-Software/.github" "butler-ledger" "governance/butler/shadow-evidence.jsonl" "$TMP/butler.jsonl" && BUTLER_OK=1 || [[ $? -eq 1 ]] || exit 2
ELEV_OK=0; fetch_file "Cloudbird-Software/.github" "elevation-ledger" "governance/elevation/shadow-evidence.jsonl" "$TMP/elev.jsonl" && ELEV_OK=1 || [[ $? -eq 1 ]] || exit 2
TICKET_OK=0; fetch_file "Cloudbird-Software/cnb-bridge" "tickets-ledger" "tickets.jsonl" "$TMP/tickets.jsonl" && TICKET_OK=1 || [[ $? -eq 1 ]] || exit 2

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. tickets fetch bypasses app identity 📘 Rule violation ⛨ Security

The added tickets-ledger fetch executes a GitHub API operation through gh while the script accepts
an arbitrary ambient GH_TOKEN, explicitly including PATs, rather than obtaining a GitHub App token
through scripts/ghcb. This extends the non-standard credential path to
Cloudbird-Software/cnb-bridge.
Agent Prompt
## Issue description
The new `tickets` source uses the script's caller-provided `GH_TOKEN`/PAT path instead of the repository-standard GitHub App identity.

## Issue Context
Compliance rule 2778539 requires scripts performing GitHub API calls to obtain tokens through `scripts/ghcb` or `scripts/gh-app-token.sh`. Because the query reads multiple private repositories, mint and use an appropriately repository-scoped App token for each fetch rather than accepting an arbitrary PAT.

## Fix Focus Areas
- governance/evidence-query.sh[18-40]
- governance/evidence-query.sh[73-76]

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

Comment thread governance/evidence-query.sh
DRILL_OK=0; fetch_file "Cloudbird-Software/.github" "drill-ledger" "governance/drill/shadow-evidence.jsonl" "$TMP/drill.jsonl" && DRILL_OK=1 || [[ $? -eq 1 ]] || exit 2
BUTLER_OK=0; fetch_file "Cloudbird-Software/.github" "butler-ledger" "governance/butler/shadow-evidence.jsonl" "$TMP/butler.jsonl" && BUTLER_OK=1 || [[ $? -eq 1 ]] || exit 2
ELEV_OK=0; fetch_file "Cloudbird-Software/.github" "elevation-ledger" "governance/elevation/shadow-evidence.jsonl" "$TMP/elev.jsonl" && ELEV_OK=1 || [[ $? -eq 1 ]] || exit 2
TICKET_OK=0; fetch_file "Cloudbird-Software/cnb-bridge" "tickets-ledger" "tickets.jsonl" "$TMP/tickets.jsonl" && TICKET_OK=1 || [[ $? -eq 1 ]] || exit 2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. 权限失败伪装源缺席 🐞 Bug ⛨ Security

新增 cnb-bridge 仓未纳入脚本仍声明的“两仓可读”令牌契约,而 fetch_file 把所有 HTTP 404 都视为合法源缺席。GitHub 对无权访问的私有资源也返回
404,因此符合现有文档的细粒度 PAT 可让查询以 rc=0 成功却完全漏掉 tickets。
Agent Prompt
## Issue description
无法区分 tickets 文件缺席与调用者无权读取 cnb-bridge,权限错误会被静默放行。

## Issue Context
先对三个预期仓执行可见性/权限探测并 fail closed,再仅把已确认可见仓中的账本路径或 ref 404 当作过渡期缺席;同时更新 GH_TOKEN 契约和错误文案。

## Fix Focus Areas
- governance/evidence-query.sh[18-18]
- governance/evidence-query.sh[33-33]
- governance/evidence-query.sh[38-55]
- governance/evidence-query.sh[73-76]

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

DRILL_OK=0; fetch_file "Cloudbird-Software/.github" "drill-ledger" "governance/drill/shadow-evidence.jsonl" "$TMP/drill.jsonl" && DRILL_OK=1 || [[ $? -eq 1 ]] || exit 2
BUTLER_OK=0; fetch_file "Cloudbird-Software/.github" "butler-ledger" "governance/butler/shadow-evidence.jsonl" "$TMP/butler.jsonl" && BUTLER_OK=1 || [[ $? -eq 1 ]] || exit 2
ELEV_OK=0; fetch_file "Cloudbird-Software/.github" "elevation-ledger" "governance/elevation/shadow-evidence.jsonl" "$TMP/elev.jsonl" && ELEV_OK=1 || [[ $? -eq 1 ]] || exit 2
TICKET_OK=0; fetch_file "Cloudbird-Software/cnb-bridge" "tickets-ledger" "tickets.jsonl" "$TMP/tickets.jsonl" && TICKET_OK=1 || [[ $? -eq 1 ]] || exit 2

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

4. 大账本被静默清空 🐞 Bug ☼ Reliability

tickets 是持续追加的单一 tickets.jsonl,但新增拉取沿用默认 Contents API JSON 响应;文件超过 1 MB 后 GitHub 会返回空 contentencoding: none。当前解码会写出空文件,随后查询跳过它并返回成功,造成整个 tickets 源静默消失。
Agent Prompt
## Issue description
默认 Contents API 响应无法承载超过 1 MB 的持续增长 tickets 账本,查询会把其误读为空源。

## Issue Context
使用 GitHub raw media type 直接下载账本内容,检查响应形态,并为超过 1 MB 的 fixture/响应增加回归测试。

## Fix Focus Areas
- governance/evidence-query.sh[38-47]
- governance/evidence-query.sh[73-76]
- governance/evidence-query.sh[93-99]
- governance/tests/test-evidence-shadow.sh[152-215]

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

"butler": [butler_f] if os.environ.get("BUTLER_OK") == "1" else [],
"elevation": [elev_f] if os.environ.get("ELEV_OK") == "1" else []}
"elevation": [elev_f] if os.environ.get("ELEV_OK") == "1" else [],
"tickets": [tickets_f] if os.environ.get("TICKET_OK") == "1" else []}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

5. Tickets 绕过完整模式校验 🐞 Bug ≡ Correctness

新增 tickets 文件只经过 verify_file(),该函数不校验 schema v1 必需的 tskindactionverdictactor
或禁止额外字段。于是哈希链正确但 schema 非法的 Go 发射记录仍会被统一查询输出并计入证据统计。
Agent Prompt
## Issue description
统一查询仅复算 tickets 哈希链,没有验证记录满足 evidence schema v1,非法记录可被当作正式证据输出。

## Issue Context
让只读验证路径对每条已带链字段的记录执行完整 schema 校验,并以错误列表而非直接退出方式报告;至少覆盖 required、类型、枚举、时间格式和 additionalProperties。

## Fix Focus Areas
- governance/evidence-query.sh[91-104]
- governance/evidence_shadow.py[57-81]
- governance/evidence_shadow.py[97-119]
- standards/evidence/record.schema.yaml[17-38]
- standards/evidence/record.schema.yaml[59-69]
- standards/evidence/record.schema.yaml[119-128]

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

"butler": [butler_f] if os.environ.get("BUTLER_OK") == "1" else [],
"elevation": [elev_f] if os.environ.get("ELEV_OK") == "1" else []}
"elevation": [elev_f] if os.environ.get("ELEV_OK") == "1" else [],
"tickets": [tickets_f] if os.environ.get("TICKET_OK") == "1" else []}

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

6. 畸形票据返回错误码 🐞 Bug ☼ Reliability

当 tickets 中存在畸形 JSON 时,verify_file() 会记录链错误,但查询随即再次对同一行执行未捕获的 json.loads,在检查 errs 前抛出异常。命令因此返回
Python 的 exit 1 和 traceback,而不是脚本契约规定的链断 exit 3。
Agent Prompt
## Issue description
畸形 tickets JSON 在统一错误处理前被二次解析并抛异常,破坏 exit 3 契约。

## Issue Context
先完成所有源验证;存在任何错误时统一打印并 exit 3,只有验证成功后才解析聚合,或让 verifier 返回已解析记录以避免二次解析。

## Fix Focus Areas
- governance/evidence-query.sh[93-104]
- governance/evidence_shadow.py[97-119]
- governance/tests/test-evidence-shadow.sh[238-251]

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

… / AC-5b)

- gh 桩补 tickets.jsonl?ref=tickets-ledger case(含分支未建 404 变体)
- 计数更新:归并 6→8 条;源缺席 5→7;新增 tickets 缺席→6(REMOVAL:源消失≠链断)
- AC-5b 断言:#412 → grant/revoke 2 条 source=tickets

Card: #412
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants