Skip to content

fix: 集成实跑校准——cnb-drill 实仓语义 + 燃料链契约对齐(#334 试点全链打通) - #105

Merged
randypanding merged 4 commits into
mainfrom
drill-hardening
Aug 25, 2026
Merged

fix: 集成实跑校准——cnb-drill 实仓语义 + 燃料链契约对齐(#334 试点全链打通)#105
randypanding merged 4 commits into
mainfrom
drill-hardening

Conversation

@randypanding

@randypanding randypanding commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

三处实跑校准:①cnb-drill:YAML 列表项 EX 节识别/自层模式(桥形判定)/green 终版语义(自层=REMOVAL 在即绿;治理=零越界)——双真仓复验 .github 绿+cnb-bridge 绿、44 自测全绿 ②divergence.py 燃料产物对齐 fanout/consumer 的 append 哈希链契约(B/C 两代理约定不一致的集成缝)③#334 自举试点链实测:三骨架→熵仪器(convergence 20%/零串通/契约 3 路线 3)→哈希链产物→消费者 exit 0。

依据

ADR-0085;IR-0004 rev6 AC-9/13/19。

Cards: Cloudbird-Software/.github#331 Cloudbird-Software/.github#332 Cloudbird-Software/.github#333 Cloudbird-Software/.github#334 Cloudbird-Software/.github#335

Copilot AI lite review requested due to automatic review settings August 25, 2026 01:33

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 25, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 4 minutes.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b770f35-d3c9-4d0d-9068-441d75fea121

📥 Commits

Reviewing files that changed from the base of the PR and between 87e36b1 and 1a27dd3.

📒 Files selected for processing (4)
  • pipeline/drill/cnb-drill.py
  • pipeline/entropy/divergence.py
  • pipeline/selftest-c/tests/fixtures/drill-noremoval/accounts.yaml
  • pipeline/selftest-c/tests/fixtures/drill-noremoval/cnb_pool.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch drill-hardening

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix cnb-drill static verdict: YAML EX-id, self-layer mode, REMOVAL semantics

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Recognize EX sections in GOVERNANCE.yaml when written as YAML list items.
• Add self-layer (bridge repo) mode and finalize green verdict semantics.
• Expand fixtures to cover noremoval bridge marker detection.
Diagram

graph TD
  A["Repo root"] --> B["cnb-drill.py (static)"] --> C["Scan files (skip .git/__pycache__)"] --> D{"Self-layer?\n(accounts.yaml + cnb_pool.py)"}
  D -->|"Yes"| E{"REMOVAL.md present?"} -->|"Yes"| G["Green verdict"]
  E -->|"No"| H["Not green"]
  D -->|"No"| F["Parse GOVERNANCE.yaml\n(EX heading/id matcher)"] --> I{"Any violations?"}
  I -->|"No"| G
  I -->|"Yes"| H
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Parse GOVERNANCE.yaml as YAML (no regex)
  • ➕ More robust to formatting changes (comments, indentation, list styles).
  • ➕ Can target exact fields (e.g., id, allowed paths) instead of line-based heuristics.
  • ➖ Requires defining/maintaining a schema for governance content.
  • ➖ May be harder to preserve current 'allowed lines' semantics if they are intentionally textual.
2. Explicit mode flag/config (instead of marker files)
  • ➕ Avoids false positives/negatives when files exist coincidentally.
  • ➕ Makes the repo classification explicit and auditable.
  • ➖ Adds another required file/setting to keep in sync across repos.
  • ➖ Harder to apply retroactively if many repos already rely on implicit detection.
3. Unify semantics: always require REMOVAL.md + no violations
  • ➕ Single mental model; fewer mode-dependent branches.
  • ➕ Potentially stricter correctness guarantees.
  • ➖ Conflicts with stated requirement: governance repo should only check out-of-bounds.
  • ➖ Likely breaks existing governance repos that should not carry REMOVAL obligations.

Recommendation: The PR’s approach is reasonable for a hardening hotfix: extend EX matching to cover YAML list items, introduce a pragmatic self-layer heuristic (accounts.yaml + cnb_pool.py), and align green verdict semantics with the stated responsibility split (bridge repo owns REMOVAL). If this logic is expected to evolve further, consider moving from regex/marker heuristics to explicit configuration or structured YAML parsing to reduce future edge cases.

Files changed (3) +18 / -4

Bug fix (1) +15 / -4
cnb-drill.pyHarden EX detection; add self-layer mode; finalize green verdict logic +15/-4

Harden EX detection; add self-layer mode; finalize green verdict logic

• Expands EX section detection to also match YAML list-item forms like '- id: EX-1'. Adds a self-layer (bridge repo) classification based on marker files, skips __pycache__ during scans, and treats specs/ content as seam-impacting documentation. Updates verdict semantics: self-layer is green iff REMOVAL.md exists; governance mode is green iff there are no violations.

pipeline/drill/cnb-drill.py

Tests (2) +3 / -0
accounts.yamlAdd bridge marker fixture: accounts.yaml +2/-0

Add bridge marker fixture: accounts.yaml

• Introduces an accounts.yaml fixture used to identify a repo as self-layer/bridge-shaped during static drill tests.

pipeline/selftest-c/tests/fixtures/drill-noremoval/accounts.yaml

cnb_pool.pyAdd bridge marker fixture: cnb_pool.py +1/-0

Add bridge marker fixture: cnb_pool.py

• Adds a minimal cnb_pool.py fixture as the second marker file required for self-layer (bridge) detection.

pipeline/selftest-c/tests/fixtures/drill-noremoval/cnb_pool.py

@randypanding randypanding changed the title fix: cnb-drill 实仓校准(YAML EX 节识别/自层模式/green 终版语义) fix: 集成实跑校准——cnb-drill 实仓语义 + 燃料链契约对齐(#334 试点全链打通) Aug 25, 2026
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Self-layer comment is wrong 🐞 Bug ⚙ Maintainability
Description
The newly added “自层模式” comment and the module docstring both describe REMOVAL.md as a
general/static-mode requirement and even as the basis for identifying a self-layer repo, but the
code actually detects self_layer via accounts.yaml and cnb_pool.py and only requires
REMOVAL.md when self_layer is true. This documentation/comment mismatch can mislead operators
about report/exit-code meaning and cause future changes to implement or test against an incorrect
mental model, potentially regressing detection and verdict behavior.
Code

pipeline/drill/cnb-drill.py[R84-87]

+    # 自层模式:根含 REMOVAL.md ⇒ 本仓即桥接层本体(整仓在删除区内)——
+    # 层内引用不构成越界(三接缝口径只约束治理仓),verdict 直接 green。
+    # 桥形判定:accounts.yaml+cnb_pool.py 共存(REMOVAL.md 有无正是被检项——
+    # dirty fixture 曾因含 REMOVAL 被误判自层,实测收紧 2026-08-25)
Relevance

●●● Strong

Accepted precedents require documentation to match runtime behavior; this comment and docstring
contradict the PR's verdict contract.

PR-#5

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The comment asserts that “自层模式”/self-layer identification is tied to the presence of REMOVAL.md,
yet the implementation sets `self_layer = (root / "accounts.yaml").is_file() and (root /
"cnb_pool.py").is_file()`, so the comment and code cannot both be correct. In addition, the updated
verdict logic only makes REMOVAL.md mandatory when self_layer is true (allowing governance-style
repos to be green without REMOVAL.md if there are no violations), while the module docstring still
documents the older, global behavior (“missing REMOVAL.md => red”), demonstrating a contract
mismatch between documentation and runtime behavior.

pipeline/drill/cnb-drill.py[84-88]
pipeline/drill/cnb-drill.py[4-11]
pipeline/drill/cnb-drill.py[19-20]
pipeline/drill/cnb-drill.py[88-90]
pipeline/drill/cnb-drill.py[114-121]

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

## Issue description
Update the documentation and comments in `pipeline/drill/cnb-drill.py` to accurately reflect the current behavior: `self_layer` detection is based on the presence of `accounts.yaml` and `cnb_pool.py` (not `REMOVAL.md`), and in static mode `REMOVAL.md` is only required for `self_layer` (bridge) repos while governance-style repos can be green without it when there are no violations.

## Issue Context
- Current self-layer detection logic is:
 ```py
 self_layer = (root / "accounts.yaml").is_file() and (root / "cnb_pool.py").is_file()
 ```
- The verdict/green computation depends on `removal_present` only when `self_layer` is true.
- The newly added “自层模式” comment currently implies self-layer is identified via `REMOVAL.md` presence (misleading).
- The module docstring still describes the old static-mode contract that missing `REMOVAL.md` makes the run red globally, which no longer matches the updated logic.

## Fix Focus Areas
- pipeline/drill/cnb-drill.py[1-20]
- pipeline/drill/cnb-drill.py[84-90]
- pipeline/drill/cnb-drill.py[114-133]

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


Grey Divider

Context sources
Review mode: ⚖️ Balanced

Grey Divider

Tip of the day
💡 Did you know, you can hide the parts of a finding you never read, like the evidence or the agent prompt

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment on lines +84 to +87
# 自层模式:根含 REMOVAL.md ⇒ 本仓即桥接层本体(整仓在删除区内)——
# 层内引用不构成越界(三接缝口径只约束治理仓),verdict 直接 green。
# 桥形判定:accounts.yaml+cnb_pool.py 共存(REMOVAL.md 有无正是被检项——
# dirty fixture 曾因含 REMOVAL 被误判自层,实测收紧 2026-08-25)

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. Self-layer comment is wrong 🐞 Bug ⚙ Maintainability

The newly added “自层模式” comment and the module docstring both describe REMOVAL.md as a
general/static-mode requirement and even as the basis for identifying a self-layer repo, but the
code actually detects self_layer via accounts.yaml and cnb_pool.py and only requires
REMOVAL.md when self_layer is true. This documentation/comment mismatch can mislead operators
about report/exit-code meaning and cause future changes to implement or test against an incorrect
mental model, potentially regressing detection and verdict behavior.
Agent Prompt
## Issue description
Update the documentation and comments in `pipeline/drill/cnb-drill.py` to accurately reflect the current behavior: `self_layer` detection is based on the presence of `accounts.yaml` and `cnb_pool.py` (not `REMOVAL.md`), and in static mode `REMOVAL.md` is only required for `self_layer` (bridge) repos while governance-style repos can be green without it when there are no violations.

## Issue Context
- Current self-layer detection logic is:
  ```py
  self_layer = (root / "accounts.yaml").is_file() and (root / "cnb_pool.py").is_file()
  ```
- The verdict/green computation depends on `removal_present` only when `self_layer` is true.
- The newly added “自层模式” comment currently implies self-layer is identified via `REMOVAL.md` presence (misleading).
- The module docstring still describes the old static-mode contract that missing `REMOVAL.md` makes the run red globally, which no longer matches the updated logic.

## Fix Focus Areas
- pipeline/drill/cnb-drill.py[1-20]
- pipeline/drill/cnb-drill.py[84-90]
- pipeline/drill/cnb-drill.py[114-133]

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

@randypanding
randypanding merged commit c20b282 into main Aug 25, 2026
33 checks passed
@randypanding
randypanding deleted the drill-hardening branch August 25, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants