Repository navigation
test(repl): execution-level paste regressions for empty-line fidelity and #309 coverage (refs #291) - #317
Merged
Conversation
… and #309 coverage (refs #291) The niubash#291 "minimal repro" is a false positive: the scratch probe's negative assertion !screen.contains("cho two") fails on a CORRECT run too, because "cho two" is a strict substring of the intact rendering "echo two". Every captured failure screen shows "echo two" complete with both outputs correct on a single submit; ~70 execution-level runs across builds/claim/write-shapes reproduce no byte loss. #291 therefore stays OPEN pending owner-side evidence (history bytes / rc / terminal / IME / build provenance) - this PR closes nothing. What lands here, all test-only (zero runtime code changed): - Unit (crates/niubash-runtime/src/repl.rs): feed_paste_burst() feeds the exact console event stream of a one-write CRLF paste through PasteChunkEditMode (scripted lookahead queue, post-#309 semantics: every pasted CR consumes its queued LF partner) and reassembles the text reaching reedline from the translated events. Four shapes must reassemble byte-for-byte: the reported empty-line burst, two consecutive empty lines, an indented line after an empty line, and a no-empty-line CRLF control. - Interactive (tests/interactive.rs): execution-level marker technique - the pasted body carries `echo RES_$((40+2))`-shaped lines, so the output RES_42 appears nowhere in the echoed input and proves the line executed with every leading byte intact; a swallowed head leaves no marker. Substring assertions against the screen are banned in this suite (the probe's trap). Shapes: the owner burst with a settled submit, the SAME-burst submit Enter (one write - niubash#309 coverage on the empty-line shape: first Enter must submit, the test sends nothing else), two consecutive empty lines, indented line, the no-empty-line control, and the claimed/custom-PS1 surface from issue comment 3 (the one variable the original 30-run sweep never varied). Adjacent semantics pinned green on current master: whole-CRLF-block integrity (#288 surface), burst interior Enters stay data (#284), the burst-settled Enter submits the whole chunk once, and #309's first-Enter submit holds on the empty-line shapes. Verification: cargo fmt --check clean; RUSTFLAGS="-D warnings" cargo check --all-targets clean; RUST_TEST_THREADS=1 NIU_INTERACTIVE_TESTS=1 cargo test --test interactive: new suite green; lib suite green.
caomengxuan666
added a commit
that referenced
this pull request
Oct 13, 2026
…d the #317 execution-level paste regressions
This was referenced Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景(纠偏后重开,取代 #315)
#291 的"最小复现"被证伪:探针
zz_minimal_empty_line_paste_probe的负断言!screen.contains("cho two")是子串陷阱——"cho two"是正确渲染"echo two"的严格子串,健康 shell 也必失败。抓取的失败屏幕里echo two渲染完整、双输出正确、单次提交;另一路 ~70 次执行级验证(debug/release/已装 × 出厂/claim × 6 种写入形态)零复现。本 PR 不关 #291——它等 owner 侧一手证据(history 字节 / rc 内容 / 终端版本 / IME / 构建来源)。本 PR 交付(全部测试,零运行时代码改动)
echo RES_$((40+2))形态,断言输出RES_42——该串不存在于回显输入(回显是未展开的$((40+2))),marker 出现即证明该行逐字节完整地执行了;吞掉行首则命令变cho RES_...not-found、无 marker、必红。全套禁用 screen 子串断言。形态覆盖:owner burst + 静默后独立 Enter、连续两个空行、空行后缩进行、纯 CRLF 无空行对照、claimed/custom-PS1(issue comment 3 指出、原 30 连跑从未覆盖的变量)。empty_line_paste_same_burst_enter_submits_on_first_enter—— 粘贴体(含空行)与提交 Enter 同一次写入(send(paste + "\r"),burst 窗口内),测试不再发送任何输入:首个 Enter 必须提交整块。判别力实测:pre-fix(repl): a paste burst's trailing bare Enter submits the buffered chunk (closes #308) #309(1f2180d)上红(Enter 被吞、无输出超时),master 上绿。feed_paste_burst()把一次写入 CRLF 粘贴的精确控制台事件流(每个 CR 的排队 LF partner 按 fix(repl): a paste burst's trailing bare Enter submits the buffered chunk (closes #308) #309 后语义被探针消费)灌过PasteChunkEditMode,从翻译后事件重组出到达 reedline 的文本,四种形态(owner burst / 连续两空行 / 缩进行 / 无空行对照)逐一断言与输入逐字节相等。相邻语义(全部保持,全绿)
paste_chunk_reassembles_crlf_block_without_empty_lines_byte_exact。paste_chunk_detector_*单元组全绿。\r路径。验证
cargo fmt --all --check干净;RUSTFLAGS="-D warnings" cargo check --all-targets干净。RUST_TEST_THREADS=1 NIU_INTERACTIVE_TESTS=1 cargo test --test interactive× 3:每次 49 passed,唯一红为既有基线ctrl_d_after_background_job_exits。cargo test --lib -p niubash-runtime:478 passed。#291 后续
保持 open,等 owner 在含 #309 的构建上重放原脚本;若再现,请提供:
niu --version的 rubash hash、%USERPROFILE%\.niubashrc内容、粘贴方式(WT 右键 / Ctrl-V / conhost QuickEdit)、终端版本、是否 IME 注入。history 字节(history输出对照原脚本)可直接定位丢失发生在输入路径还是执行路径。