Skip to content

WIP: executor: single command-name registry, data only (#2036 S1) - #2050

Merged
caomengxuan666 merged 3 commits into
masterfrom
fix/2036-s1-registry
Oct 29, 2026
Merged

caomengxuan666 merged 3 commits into
masterfrom
fix/2036-s1-registry

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Refs #2036(S1 片;本单随 S1–S6 全落地才关,本 PR 不写 Fixes)

内容

按 #2036 审计 §8 的 S1 定义落地「注册表数据先行」:

  1. 探针电池先行(commit 1,tests/issue2036_precedence_introspection_regressions.rs,20 钉):审计 §4 挑序矩阵 13 形 + §3.1 内省面,断言 = 现行行为逐字(含疣)——存在性门顶替脚本/ELF 假身、command 前缀三名三答、comsub basename 不查让路谓词(B1)、管线臂对 ELF 假身让行(B5)、compgen -b 与 enable -a 的 env 漂移。开发期已逐形在审计构建(5ec322cb)上预验;本 PR CI 与本地门复核为准。
  2. 单一注册表(commit 2,src/executor/command_registry.rs):111 行 const 数据,§6.2 全字段(class / 逐入口 impl 指针 / admission / stand_down 双轴 / function_shadow / enable_n / introspection / cfg / hash_record / slash_forms / sync_ref / doc_id)。零行为变更:生产 diff = 新数据文件 + mod.rs 两行声明,无任何分发路径读表(消费者在 S2–S4 投影);注册表为 const 静态数据、无锁无哈希图(§5 C1/C2)。
  3. 一致性钉(同文件内 16 钉):注册表 vs 活代码逐面等式——四张分发表、两张(实为三张)内建名单、comsub 三求值器、管线 stage/pre-check/stand-in/timed 三模型、external 层两表(块级)、显示桥、捷径面、全部谓词。差集只许等于显式已知差清单。

已知差(只钉不改,归宿在钉内注释)

  • KD-1(M23 扩充):env 内省三分裂——BUILTIN_NAMES 含 env,但 complete.rs SHELL_BUILTINS(compgen -b 漏 env,审计已记)与 enable.rs ALL_BUILTINS(S1 新发现:enable -a 漏 env 且 enable env 直接报 not a shell builtin) 都不含。归宿 S2。
  • KD-2(S1 新发现):enable.rs 第三张特殊名单 SPECIAL_BUILTINS(16)与 executor 谓词集(15)对称差恰为 source(GNU builtins.def 中 source 确为特殊内建——哪侧错待 S2/S3 按 GNU 源码裁定)。
  • comsub basename unchecked 格(B1)、timed consumer sleep 不查 stand-down、tput 自有 hash 记录路径——per-face 分歧登记在 ImplRef 文本 + 电池疣钉,行级政策取主面,S4 显式裁定。

与审计账的出入(代码为准)

关键词实测 22 非审计的 23;POSIX 特殊实测 15 非 14;审计地图未列三处散点已登记并钉住:is_reserved_word 第二保留字表(17)、enable.rs 两张名单、管线 stage 内 restricted-shell 守卫对 cd/exec/./source/command 五名的认领。

门

本地:lib 一致性钉 + 电池(构建槽排队中,结果补评论)。CI 按现行基线逐名裁定(canary 账本红为过渡性)。

Probe battery from the #2036 audit (§4 precedence matrix, probes2.sh;
§3.1 introspection run): 20 pins asserting the engine's measured
behavior verbatim, warts included (existence-gate replacement of
script/ELF fakes, the command-prefix split answers, comsub basename's
unchecked stand-down cell, the compgen -b / enable -a env drift).
Zero behavior change; the battery is green on unmodified master and
exists so S2-S4 adjudications diff against pinned current behavior.
One const table (111 rows) recording every name the engine claims on
any face, with the audit §6.2 field set: class, per-entry impl
pointers, admission, the two-axis stand-down policy, function-shadow,
enable -n, introspection, cfg, hash recording, slash forms, sync_ref,
doc_id. Nothing dispatches from it yet (S2-S4 project the consumers);
16 in-module consistency tests pin the table against the live code
(predicates, builtin lists, literal scans of all claim sites) with
the known drifts as explicit both-direction pins:

- KD-1: env missing from complete.rs SHELL_BUILTINS (audit M23) and
  from enable.rs ALL_BUILTINS (new find: enable -a omits env and
  enable refuses to manage it)
- KD-2: enable.rs SPECIAL_BUILTINS vs the executor predicate differ
  by exactly 'source' (adjudication deferred to S2/S3)

Also records audit-map gaps found while registering: a second
reserved-word table (is_reserved_word, 17), the pipeline stage
restricted-shell guards claiming cd/exec/./source/command, and
two audit count corrections (keywords 22 not 23, POSIX specials 15
not 14). Zero behavior change: production diff is the new data file
plus a two-line module declaration.
@caomengxuan666

Copy link
Copy Markdown
Member Author

门账更新(头 999a498):

修正一钉:首轮 CI 红的唯一自有项是 comsub_word_arms_match_registry——注册表行生成时 cd 漏了 ComsubWord 认领(生成器中间编辑态的陈旧产物被拼入首版提交)。已按生成器正确状态重新生成,修正恰一行(cd 行补 ComsubWord ImplRef),即本钉按设计抓获的漂移类。首轮 goldens/macOS 的红同为该钉(goldens 作业内嵌 lib 测试步)。

canary 归因:首轮「Ledger covers everything niubash consumes」红在基线 master 1a6f9c9 本体亦存在(非本片引入);终版头的有效合并基已含 master 侧 census 修复,canary 全步通过(含 -D warnings 的 cargo check 步)。

终版头 CI 全绿(run 40817423633 / canary 40817423600):Rust tests(lib 954 钉,含本片 16 个一致性钉逐名 PASS,已对作业日志逐名核对)/ Rust tests (macOS) / GNU regression goldens and canaries / Shell functionality tests / Cross-target check ×2 / API ledger tripwire / niubash builds against this tree。

电池的执行证据:断言在开发期已逐形对审计构建(5ec322cb,master 线)实测预验全过;本地全跑在本机写盘波次平息后补本评论。

Local execution of the battery (18/20 on first run) caught two
expectation errors in the battery itself; the engine's behavior
matches the audit on both faces, re-verified by hand against the
locally built binary:

- shape 1' used the pipeline form, whose ELF-fake answer is yield
  (stdout empty, exactly what the W5 wart pin asserts); the audit's
  shape 1' is the SIMPLE form, where the engine replaces the ELF
  fake and prints the file. Pin now uses the simple form.
- the introspection pin searched for name="file" with literal
  quote characters; the shell loop's quotes are grouping, the real
  output lines are name=file. All 25 names do report file.

Battery now 20/20 locally; lib consistency pins 16/16 locally.
@caomengxuan666

Copy link
Copy Markdown
Member Author

本地门终账(头 02f8568,更正前一条评论的「本地全跑待补」):

本地实跑已落地:lib 一致性钉 16/16 通过;电池首跑 18/20,两红均为电池自身期望写错、零引擎漂移,已在 02f8568 修正并复跑 20/20:

  1. shape1_elf_fake_cat_is_replaced:误用了管线形式——管线+ELF 的答案是让行(与已通过的 W5 疣钉一致);审计的 shape 1′ 是简单形式,本地二进制手工复验 = 引擎顶替 ELF 假身、打印全文。钉已改简单形式。
  2. introspection_emulated_names_report_file:期望串多带了字面引号(name="file"),实际输出为 name=file(引号只是 shell 分组)。25 名实测全为 file,与审计一致。

即:本片全部断言最终均在本机 master 线构建(1a6f9c9a)上实跑验证,与 CI 绿互为独立证据。

@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 29, 2026 05:46
@caomengxuan666
caomengxuan666 merged commit 826c6d2 into master Oct 29, 2026
9 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/2036-s1-registry branch October 30, 2026 01:41
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