Skip to content

docs+ci(#595): API ledger (M-0) and niu pairing canary — 1.5.0 PLAN row 1 - #1536

Merged
caomengxuan666 merged 1 commit into
masterfrom
feat150/ledger-canary
Oct 25, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
feat150/ledger-canary

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

定位

1.5.0 实施计划(PLAN)行 1 落地:API 定版 S1 / §9 M-0 —— API 台账 + 配对 CI canary。Refs #595(本 PR 不关闭该 issue;合并归后续把关)。

定版依据:docs/design/1.5.0-workspace-and-engine-api.md(RFC)与已定版的 Session API 稿(#1535 入仓)。本行无代码拆分:先把「什么算契约面」从口头冻结变成 CI 机械执行,再开始任何代码搬家。

配套 PR(niubash 侧台账镜像 + 同源门):见下方「配套 PR」段(开 PR 后回填链接)。

内容(4 个新文件,零 src 改动)

  • docs/api-ledger.md —— API 台账初版:niu 实际消费的引擎表面普查与分层归属、目标家园,以及机器可检符号块。
  • scripts/check-api-ledger.py —— stdlib-only tripwire:校验台账符号块的每条符号在当前树中仍然存在(声明模式级存在性检查,是 tripwire 不是类型检查,权威信号是配对编译,台账 §5 已写明)。
  • .github/workflows/niu-canary.yml —— 新增 job,不动任何既有 job:ledger(tripwire + 检查器 --self-test)与 pairing(兄弟布局下把 niubash master 对本树 cargo check --workspace --locked,并 cmp 两仓台账副本)。
  • docs/api-ledger-canary-demo.md —— canary 演示记录(见下)。

台账口径(全部实测,规则写在台账 §0)

  • 基线:rubash abd9be95 / niubash b53e6bff(即本 PR 的 base / 配套 PR 的 base)。
  • niu 消费面:rubash:: 路径引用 118 次、并上 use rubash::{...} 后 61 个 distinct 路径,分布在恰好 6 个文件;Executor 方法经接收者核验 38 个 distinct 方法(get_env 以 84 次居首,是台账相对 RFC §3.2 原始计数的一处实质补充,映射上仍归 Tier A variables view)。
  • 与 RFC §3.2 对齐核验:其七个方法计数与 bind_registry 族 20 refs 在其口径下逐项精确复现(台账 §3)。
  • 机器可检符号块:100 条(item 45 + variant 15 + method 40)。
  • 一处 census drift 如实记录:RFC §3.1 的「20 public modules」在当前 HEAD 复现不出,实测 src/lib.rs 为 18 个 pub mod + 1 个 pub(crate) mod;台账 §1 以实测为准,RFC 原文是设计记录未回改。集成时已对当前 master 的 src/lib.rs 复核:与基线字节一致,导出面未变化。

Canary 演示(PLAN 行 1 验收项)

完整记录在 docs/api-ledger-canary-demo.md:在 scratch 副本上删除 builtins::kill::note_console_ctrl_c(当年静默消失、打断 niu master 的那个符号)——

  • 基线:all 100 ledger symbols present,rc=0
  • 删除后:MISSING item rubash::builtins::kill::note_console_ctrl_c,rc=1
  • 恢复后:全绿,rc=0;检查器 --self-test(伪造符号必须被报缺)通过

本地验证(集成时轻量复核)

  • python3 scripts/check-api-ledger.py → rc=0(100/100 在场);--self-test → rc=0
  • 两仓 docs/api-ledger.md cmp 字节一致
  • 两个新 workflow 文件 YAML 解析通过(job/trigger 结构如期)
  • 改动文件 CR 计数全 0;git diff --stat 仅 docs/scripts/.github,零 src 改动

未跑项(如实标注)

  • pairing job 的 niu 全量 cargo check --workspace --locked 未在本机跑(重型构建,按纪律不在本机跑);它在本 PR 的 CI 首跑即是其绿证据,请以 CI 结果为准。
  • 本片为 docs/CI-only,未跑任何 cargo 构建与仓库测试套件。

配套 PR

Freeze the engine surface niubash consumes, per the 1.5.0 Session
API RFC S1 / section 9 M-0:

- docs/api-ledger.md: the section 3.2 consumer census re-measured
  against rubash abd9be9 / niubash b53e6bff (61 distinct consumed
  paths over 6 files; 38 receiver-verified Executor methods), with
  counting rules, tier assignments and target homes per family, and
  a machine-checkable symbol block (100 entries). Records one census
  drift: lib.rs declares 18 pub modules at this HEAD, not the 20 the
  RFC text states.
- scripts/check-api-ledger.py: stdlib-only tripwire verifying every
  ledger symbol still exists in this tree, with a --self-test mode.
- .github/workflows/niu-canary.yml (new jobs only): the tripwire,
  plus a pairing job that compiles niubash master against this tree
  in the sibling [patch] layout and cmps the two ledger copies.
- docs/api-ledger-canary-demo.md: demonstration record -- deleting
  builtins::kill::note_console_ctrl_c (the hook whose loss once broke
  niubash master) turns the tripwire red, restoring it returns green.

Zero src changes.
@caomengxuan666

Copy link
Copy Markdown
Member Author

CI 首跑结果(集成方注记):

  • API ledger tripwire job —— 绿(检查器 self-test + 100 条符号在场,CI 实跑)。
  • niubash builds against this tree(pairing)job —— 红在 Ledger copies are identical 一步,cargo check 未及运行。原因不是内容分叉:该 job 检出的是 niubash master,而台账镜像还在 niubash 配套 PR docs+ci(rubash#595): API ledger mirror and sync canary — 1.5.0 PLAN row 1 niubash#560 里、未进其 master,master 侧文件不存在,cmp 必然失败。两份 PR 副本本地 cmp 实测字节一致。
  • 这是双仓同时引入「对对方 master 比对」型 canary 的自举窗口:任一侧先合并后,另一侧的同源检查即转绿;两侧都合并后,本仓 master 的 pairing 也随之转绿(在 niubash#560 合并前,本仓 master push 触发的 pairing 仍会红在同一步)。合并顺序与窗口期处理归把关决定,集成方不自行合并。
  • 因此 pairing 的 niu 全量 cargo check 绿证据仍待:窗口关闭后重跑本 PR 的 niu-canary 或看 master push 的运行结果。

@caomengxuan666
caomengxuan666 merged commit 3962566 into master Oct 25, 2026
6 of 10 checks passed
@caomengxuan666
caomengxuan666 deleted the feat150/ledger-canary branch October 25, 2026 04:52
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.

1 participant