Repository navigation
tests/regression: re-baseline stale suite snapshots + airtight snapshot env + CI golden-refresh artifact - #496
Merged
Conversation
…h artifact (drift protocol) The 'GNU regression goldens and canaries' job has been red on every PR since 10ff8a3 (#480): the ${var@P} marker-strip fix (#431) legitimately changed the exp slice's stdout, and tests/regression/snapshots/exp.snap was never re-recorded — every later PR inherited that red (26 passed / 1 failed, upstream_suite_slice_snapshots). Two structural fixes so a stale baseline cannot snowball again: 1. run_suite_snapshot now runs the suites in the same airtight environment as the goldens (env_clear + machine-infrastructure whitelist + PATH/HOME), instead of only removing OLDPWD/BASH_ENV/ WINUXSH_ROOT. The old ambient-env pass-through made snapshot bytes machine-dependent: exp.tests:416 executes `${THIS_SH} -c ...`, so any shell that exports THIS_SH records argv lines a clean runner never emits, and shell-option variables (BASHOPTS/SHELLOPTS/POSIXLY_CORRECT classes) are exactly what the alias-expansion machinery keys on. A snapshot byte that depends on ambient env cannot be a baseline. 2. The regression job records the snapshots on the runner and uploads them as the regression-snapshots artifact (always()). When the comparison fails because committed .snap files are stale, that artifact is the runner-true replacement content — no more hand-transcribing the truncated 40-line panic window. Module header documents the re-record protocol: a snapshot diff IS a semantic change; a recording commit must cite the behavior-fix issue/PR per slice, or the red baseline ships itself forward. Gate: cargo fmt clean; snapshot suites byte-identical on the recording path; full regression suite green modulo the stale exp.snap this PR re-records next.
…els strip the ignore markers (rubash#431 scope fix) #480 funneled the ${var@P} prompt transform through strip_prompt_ignore_markers alongside the render channels. For a PS1 the strip is display semantics (readline display.c expand_prompt assembles the prompt without the width-accounting bytes), but a script-visible transform result must keep bytes that were IN the value: upstream bash-tests exp8.sub:26 runs `recho ${var@P}` against var=$'x\001y\177z' and GNU 5.3.0 records `argv[1] = <x^Ay^?z>` in exp.right:253 — the literal \x01 survives. %q probes on WSL GNU 5.3.0 and Git 5.2.37 agree ($'x\001y\177z'). The strip ate the literal byte (`xy^?z`), a GNU-parity regression that the exp suite-slice snapshot pinned as a CI failure — the red 'GNU regression goldens and canaries' job every PR inherited since #480 was exactly this one byte. ${var@P} is decode_prompt_string and nothing else again: - the \`\\[\\]\` markers are already handled per GNU parse.y:6609-6622 inside decode_prompt_string (dropped when no line editor is active, marker bytes when emacs/vi is on) — the prompt_transform_strips_ ignore_markers regression stays green on that branch, not on a strip; - the render channels (expand_prompt_string{,_mut}, the piped -i driver) keep their strip: a terminal-bound prompt must not carry the width-accounting bytes. niubash's BashPrompt bridge is unaffected. Gate: issue431 regressions 4/4, parameter-transform tests green, full regression suite 26/27 locally (the snapshot leg is the OS-dependent comsub slice this machine cannot reproduce; the CI artifact from the previous commit proves the runner records the committed bytes for all 13 slices once this revert lands).
caomengxuan666
added a commit
that referenced
this pull request
Oct 13, 2026
…601) 40 commits (PRs #496-#600) folded into [1.4.0] by theme instead of per-commit listing: - GNU semantics waves 1-4b with their issue families - argv re-expansion P0 pair (#511/#555), PWD POSIX persona (#537) - -s on-demand stdin driver as the canonical library reader (#586) - CLI entry-shape semantics (#589-#591) and the GNU usage contract (#585) - diagnostic message fidelity (#551) and parser diagnostic tokens - Windows path contract (#568/#592) - lexer/executor performance rounds (#554/#562/#501) - docs: boundary invariants, platform gap, baselines, debugger M0 Commit message deliberately carries no release/version claim.
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.
结论
常红 job("GNU regression goldens and canaries",每个 PR 必红,
upstream_suite_slice_snapshots26 passed / 1 failed)的根因是 #480 对${var@P}的过度剥离——一个被快照系统正确抓住的 GNU 奇偶回归。本 PR 修复引擎语义 + 加固快照基础设施,13 个 golden 切片零字节改动。根因链(CI 日志 + oracle 实证)
exp.snap:359):argv[1] = <x^Ay^?z>→argv[1] = <xy^?z>。对应上游exp8.sub:26的recho ${var@P}(var=$'x\001y\177z')。exp.right:253记录argv[1] = <x^Ay^?z>——字面\x01必须在${var@P}结果中存活;WSL GNU 5.3.0 与 Git GNU 5.2.37 的%q双 oracle 一致($'x\001y\177z')。fix(prompt): strip \[ \] ignore-markers on every PS1 render path #480 把${var@P}也接入了strip_prompt_ignore_markers,把值里字面的\x01/\x02误当宽度标记剥掉了。修复
${var@P}还原为 GNU 语义——decode_prompt_string本身(\[/\]的处理按 parse.y:6609-6622 已在解码器内完成:无行编辑时丢弃、emacs/vi 开时产出标记字节);字面\x01/\x02原样透传。渲染通道(expand_prompt_string{,_mut}、piped-i驱动、niubash BashPrompt 桥)保持剥离不变。#431回归 4/4 绿、parameter-transform 测试全绿。run_suite_snapshot改用与 goldens 相同的密闭环境(env_clear+ 机器基础设施白名单 + 显式 PATH/HOME)。原实现泄漏环境变量,快照字节因此机器相关——实锤:exp.tests:416执行${THIS_SH} -c ...,导出 THIS_SH 的 shell 会录出干净 runner 永不产生的行;regression-snapshotsartifact:golden 过期时 artifact 即替换内容的真值,不再手工转录 40 行截断 panic 窗口。本次调查正是用它把漂移精确锁定到一行;tests/regression.rs模块头写明重录协议:重录只能用RUBASH_REGRESSION_RECORD=1,且录制提交信息必须按切片引用导致字节变化的行为修复 ISSUE/PR——"update golden" 不带行为出处 = 基线红灯自我复制(fix(prompt): strip \[ \] ignore-markers on every PS1 render path #480 事故正是如此)。Golden 状态
零改动。CI 录制 artifact 与提交版逐字节比对:修掉
${var@P}过度剥离后,13 个切片全部与tests/regression/snapshots/一致(修复前仅 exp 一行漂移,且该漂移是回归不是改进)。子模块 gitlink(b460816)全程未变,排除上游输入漂移。验证
if: github.event_name != 'pull_request'设计在 PR 上跳过)。--test regression26/27 绿——唯一失败是 comsub 切片在本机(Win10 19045)与 runner(Server 镜像)间的 OS 级输出差异,runner 与 GNU 侧一致、与提交版字节一致(artifact 证明),本机差异已由密闭环境最小化、以 runner 为准。cargo fmt干净;--lib在本机有 2 个既有的机器相关失败(pwd 驱动器格式/path 虚拟根),与本 PR 无关且 CI 上为绿。