Skip to content

WIP: R6 comsub heredoc 双实现收敛(冗余清扫 D 类) - #1980

Merged
caomengxuan666 merged 1 commit into
masterfrom
clean/rubash-comsub-dedupe
Oct 28, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
clean/rubash-comsub-dedupe

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

冗余审计 R6 施工(用户 2026-10-28 裁定 A+B+C+D 全批):command_substitution_heredoc_output_mut_typed 与 command_substitution_heredoc_output 两份近同构实现收敛为一份准入(heredoc_comsub_plan)+ 一份生产(heredoc_comsub_produce,按调用方 fetch 参数化);decline 链加 decline-only memo,同一输入至多一次准入 parse;timed-cat 与词级 cat 臂 B 只共享读字节梯子与 fd-0 消费,T2 语义分叉原样保留、未动行为(timed 静默/恒 0/UTF-8 严格 vs 词级诊断/status=1/字节保真)。

零可观察行为变更,证据:33 例平价矩阵(heredoc-comsub 全形 + 两臂分叉形 + decline 形)改前/改后 stdout/stderr/rc 逐字节同(t 形 raw stderr 仅计时数值差,过滤后同);lib 904/1/3、regression 171/4/1 失败集与 pristine fa17033 逐名同;diffcorpus 306 失败集 ⊆ 已知 flake 集(隔离复跑双 PASS);per-file rustfmt 净、CR=0。-D warnings 终检与 Windows CI 为合并门(主会话合,不自合)。

报告:~/workspace/clean-rubash-comsub/REPORT.md

…lan/produce pair

Redundancy audit R6 (~/workspace/redundancy-hunt/rubash/REPORT.md):
command_substitution_heredoc_output_mut_typed and
command_substitution_heredoc_output carried two near-identical copies
of the same admission whitelist (real parse, cat + stands-down,
rubash#320 file-redirect refusal, rubash#1130 expansion-error refusal,
multi-cat concatenation, [sort,-u] pipeline arm). They now share one
admission (Executor::heredoc_comsub_plan) and one production
(heredoc_comsub_produce) parameterized by the caller's stdin fetch —
typed (side-effecting) for the mut entry, readback for the &self
entry. Here-document warnings stay owned by the typed entry only,
exactly as before.

Decline chain: a typed attempt that declines records a decline-only
memo (Executor::heredoc_admission_declined_source) so the readback
retry of the same source inside the same expansion episode no longer
re-runs the tokenize/parse + admission pass before falling through to
the real executor (the general path's own parse is unchanged). The
memo can never admit: a hit only routes the body to the real
executor, so a stale record costs the shortcut, never semantics.

timed-cat: the byte-read ladder (registry -> synthetic link -> fs)
and the fd-0 FUNCTION_STDIN consumption are now shared with the
word-level cat arm via comsub_cat_operand_bytes /
comsub_cat_function_stdin_text. The T2 policy fork stays explicit in
the arms and is NOT unified: timed keeps UTF-8-strict reads, silent
skips and status 0; word-level keeps raw bytes as content,
per-file diagnostics and status 1 (rubash#772).

Zero observable behavior change: 33-case parity matrix
(heredoc-comsub all shapes, timed/word cat fork shapes, decline
shapes) byte-identical before/after on stdout/stderr/rc; lib
904/1/3 and regression 171/4/1 failure sets name-identical to the
pristine fa17033 tree; diffcorpus 306 with failure set inside the
known timing-flake set on both sides.
@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 28, 2026 14:36
@caomengxuan666
caomengxuan666 merged commit 7e8b7b9 into master Oct 28, 2026
11 checks passed
@caomengxuan666
caomengxuan666 deleted the clean/rubash-comsub-dedupe 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