Skip to content

test(regression): #803 re-record the nquote snapshot past the #789 panic; CRLF-normalize suite copies - #808

Merged
caomengxuan666 merged 2 commits into
masterfrom
fix/803-nquote-snapshot
Oct 18, 2026
Merged

caomengxuan666 merged 2 commits into
masterfrom
fix/803-nquote-snapshot

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Closes #803. Verdict: re-record, not a product regression. Three snapshots (nquote, comsub, heredoc) pinned runner-CRLF / interrupted-run bytes; the engine itself is GNU-true. Text corrected per CR round 1 (evidence chain replaced with the independently reproducible one; snap bytes untouched).

Adjudication (evidence chain, CR-verified)

  1. Red window. Push-event CI on master: last green 5f3fb55b (08:38), first red eee1aa6f (08:59, nquote: snapshot stdout differs from golden, 69/70), every later head red at the same point. The ticket's suspect 98794cb7 (mapfile fast path) postdates the first-red commit — exonerated.
  2. What eee1aa6f changed. It clamped the mark_literal_ifs_chars index-out-of-bounds panic on unclosed-quote braced words (a #789/d9ab4c7 regression). nquote2.sub exercises exactly that shape (unquoted t ${v/\'/x} family), so the suite run survives the word class that coincides with where the old recording stops.
  3. The old golden is a strict prefix of canonical output, and was transcribed from an interrupted run.
    • The committed 1045-byte nquote.snap is a strict byte-prefix of the canonical 1230-byte output — it ends mid-stream, one line short of a face boundary.
    • f7eaebf8 (the commit that recorded it, 07:37 that morning) says so itself: "lines 64-84 are not produced ... the test harness aborts" — the golden was transcribed from an aborted CI run rather than a completed one.
    • The pre-PR master CI artifact (run 39123676479) holds 1226 bytes: the byte-exact reproduction of what the engine emits on CRLF-materialized suite files, i.e. the runner bytes the old lane compared against.
  4. New golden triple-verified. For every one of the 13 slices: local LF-checkout output == committed re-record == this PR's CI artifact, and for nquote additionally == WSL GNU bash 5.3.0(1)-release (stdin method over nquote.tests + nquote1-5.sub, stdout rendered through the established recho argv-span caret convention). GPL discipline: the oracle is a run; no GNU source embedded.

The deeper cause: machine-dependent bytes (runner autocrlf)

windows-latest materializes the third_party/bash submodule with core.autocrlf=true; on CRLF suite bytes whole faces go silent (nquote4.sub's alias foo=$'echo foo\n\nquux\n' prints no foo: 1226 runner bytes vs 1230 LF). Every CI snapshot artifact of this wave held runner-CRLF bytes — and so did the pre-f7eaebf8 golden era. The lane now normalizes CRLF→LF while copying the suite files (run_suite_snapshot): the 144 tracked files matching the copy predicate (13 slices; a built submodule's disk may add untracked build artifacts such as recho) contain no CR in any canonical blob, so the pair-wise conversion is exactly the autocrlf inverse and cannot touch semantic CR bytes. Snapshot bytes stop depending on the checkout's line-ending config — the module's own machine-dependent-byte rule.

Re-record (protocol, RUBASH_REGRESSION_RECORD=1, debug profile)

slice bytes face
nquote 1045 → 1230 interrupted-run prefix resumed; the tail is GNU-verified byte-for-byte
comsub 926 → 1033 CRLF pin (LF output adds the ok 9/ok 8/date block and the full hey after x line)
heredoc 1445 → 1483 CRLF pin (LF output adds the tail: world + two here-doc lines)

The other 10 slices re-recorded byte-identical (the protocol leg rewrites all 13; only these three differ).

#746 ratchet: re-record path, not a product regression — no new catalogue case; the re-recorded bytes are themselves the ratchet (any future divergence fails CI again).

Verification

  • CI cross-check: this PR's first CI run (through the fixed harness) produced an artifact equal to the committed re-records on 13/13 slices; comsub/heredoc artifact bytes also equal LF-checkout runs — machine-stable on both sides.
  • Local: full cargo test --test regression -- --test-threads=1 → 70 passed / 0 failed (before this PR: 69/1; the combined snapshot test is green on a LF checkout for the first time). Baseline failure set elsewhere: unchanged.
  • Diff is fmt-clean; the repo-wide pre-commit gate trips only on pre-existing master drift (mapfile.rs, part_041.rs), deliberately not reflowed here.

The CR-flagged errors-slice machine-dependence (errors.snap:64/67/74 status lines, ${THIS_SH} degenerate face) is out of this PR's scope and tracked separately.

No merge from my side — review and merge as owner.

…omsub, heredoc); normalize suite copies

Verdict for #803: re-record, not a product regression. CI's red streak
starts at eee1aa6 (#705 followup): that clamp fixed the
mark_literal_ifs_chars index-out-of-bounds panic (a #789/d9ab4c7
regression) on unclosed-quote braced words, and nquote2.sub exercises
exactly that shape (the unquoted `t ${v/\'/x}` call), so the suite
now runs past the point where it used to die.

The committed nquote.snap was itself recorded from an aborting run:
f7eaebf's message says "lines 64-84 are not produced ... the test
harness aborts". Byte-proof: a scratch build with the clamp reverted
reproduces the committed golden exactly (1045 bytes) plus the panic
(`index out of bounds: the len is 12 but the index is 12`,
src/executor/command_prepare.rs:3869). 98794cb (mapfile fast path) is
exonerated - it postdates the first-red commit.

Oracle (WSL GNU bash 5.3.0(1)-release, stdin method, recho argv spans
rendered caret-wise like the PE helper): GNU's stdout is byte-identical
to today's engine output (1230 bytes), so the resumed lines 64-85 are
GNU-true and the golden was stale, not the engine.

Machine-dependence, the deeper cause: the windows-latest runner
materializes the third_party/bash submodule with core.autocrlf=true,
and CRLF suite bytes mute whole faces (nquote4.sub's
`alias foo=$'echo foo\n\nquux\n'` prints no `foo`). Every CI
snapshot artifact of this wave held runner-CRLF bytes, and the
pre-f7eaebf8 golden era pinned them too. The lane now normalizes
CRLF->LF while copying the suite files (run_suite_snapshot): canonical
blobs of all 13 slices contain no CR at all (153 files scanned), so the
pair-wise conversion is exactly the autocrlf inverse and cannot touch
semantic CR bytes; snapshot bytes stop depending on the checkout's
line-ending config, per the module's own machine-dependent-byte rule.

Re-recorded with RUBASH_REGRESSION_RECORD=1 (engine/harness change
reference, per slice):
- nquote 1045 -> 1230: resumes past the former panic point; GNU-verified
  byte-for-byte (oracle above).
- comsub 926 -> 1033: the committed golden was another truncated run
  (missed the trailing `ok 9`/`ok 8`/date block and clipped
  `hey after x`); runner-through-fix and a LF checkout both produce the
  full 1033 bytes.
- heredoc 1445 -> 1483: same class, the tail (`world` + two here-doc
  lines) was missing.

#746 ratchet: re-record path, not a product regression - no new
catalogue case; the re-recorded bytes themselves are the ratchet, any
future truncation fails CI again.

Verified: nquote/comsub/heredoc artifact bytes from the PR's own CI run
equal the committed re-records and equal LF-checkout runs (machine
stable); nquote additionally equals the WSL GNU 5.3.0 oracle. Full
--test-threads=1 regression battery after the re-record: 70 passed /
0 failed locally (the combined snapshot test is green on a LF checkout
for the first time). My hunk is rustfmt-clean; the repo-wide pre-commit
gate trips on pre-existing master drift (mapfile.rs, part_041.rs) which
this PR must not reflow.
@caomengxuan666
caomengxuan666 force-pushed the fix/803-nquote-snapshot branch from 99b657e to c8719d9 Compare October 18, 2026 13:09
@caomengxuan666

Copy link
Copy Markdown
Member Author

Independent CR of #808 (verdict re-check of the #803 ruling)

REQUEST-CHANGES — for the adjudication text only. The four changed files themselves are verified correct: I reproduce all three re-recorded snapshots byte-for-byte through three independent legs. What I cannot reproduce is the PR's central "byte-proof" (evidence chain item 3), and one of its claims fails verification on four separate engines.

What I verified independently (all byte-level)

  1. Diff surface: single commit c8719d9 on 74e60b0, 4 files, +60/−2, no submodule pointer change, cargo fmt --check clean on the PR tree. Checks: 5 pass + 1 skipped (Bash upstream test progress, scheduled job — 6 rows total, none failed).
  2. New snap bytes are engine truth — 3-way agreement holds:
    • Local LF run via a from-scratch replication of run_suite_snapshot+normalize_snapshot (self-checked byte-exact against the committed snaps first): nquote 1230, comsub 1033, heredoc 1483 — byte-identical to the committed files.
    • This PR's CI artifact (regression-snapshots of run 39130327326): 13/13 slices byte-identical to committed, including the 10 "unchanged" ones.
    • WSL GNU bash 5.3.0(1)-release oracle over canonical LF blobs (git cat-file, never the CRLF worktree), real upstream support/recho.c compiled to a temp dir, airtight env: nquote slice stdout = 1230 bytes, cmp-identical to the committed golden (verified under file-arg, chmod+x, and stdin-equivalent invocation; all identical). Oracle was only executed; no GNU source embedded.
  3. Old bytes are machine artifacts — confirmed, by a stronger route than the PR's own proof:
    • comsub 926 / heredoc 1445: the pre-PR master CI artifact (run 39123676479 @ 9055c96) is byte-identical to the old committed goldens, and my CRLF plain-copy runs reproduce them byte-for-byte locally. They are runner-CRLF pins, pure and simple — no crash involved.
    • nquote 1045: strict byte-prefix of the canonical 1230 output, and f7eaebf's own message admits it transcribed an aborted CI run ("lines 64-84 are not produced … the test harness aborts"). First-red CI run 39113556278 @ eee1aa6 failed at exactly nquote: snapshot stdout differs from golden — the ratchet doing its job.
    • CRLF mechanism proven exactly: pre-PR master artifact nquote = 1226 bytes; my plain-copy (CRLF) runs on f7eaebf, 0ac1751, 9055c96−clamp and cr-808−clamp all produce exactly those 1226 bytes.
  4. [test] regression catalogue: one case per filed issue, differential vs GNU, with the harness generalised beyond fast paths #746 ratchet: concur, no catalogue case needed — the divergence is pinned by assert_bytes_eq (tests/regression.rs:351); any future same-class truncation shifts the run bytes and goes red, exactly as seen live at eee1aa6.

Where I dissent: evidence-chain item 3 ("byte-proof") does not reproduce

The PR claims: "a scratch build of 9055c96 with only the clamp reverted reproduces the committed golden exactly — 1045 bytes + panicked at src\executor\command_prepare.rs:3869: index out of bounds: the len is 12 but the index is 12."

I could not reproduce this under any combination:

engine clamp suite files result
cr-808 (c8719d9) reverted LF normalized 1230 bytes, rc=127, no panic
cr-808 (c8719d9) reverted CRLF plain copy 1226 bytes, rc=127, no panic
9055c96 reverted LF / CRLF 1230 / 1226, no panic
f7eaebf (recording commit) natively absent CRLF 1226, no panic
0ac1751 (its parent) natively absent CRLF 1226, no panic

The harness side was replicated exactly (my replication is byte-identical to the committed snaps on pristine code, and byte-identical to real CI artifacts in CRLF mode, so it is runner-faithful). The eee1aa6 repro face (${v/\'/x} family, tests/nquote2.sub:20-30) also runs clean with rc=0 on 5f3fb55^ (the true pre-clamp tree). The after exit:-style 1045-truncation provenance therefore remains unpinned; nothing on master's first-parent line 0ac1751→HEAD panics in this slice today.

This does not flip the verdict (item 1-4 above prove "old = artifact, new = truth" independently), but a byte-evidence lane should not carry a headline proof that a second machine cannot reproduce. Please either name the exact tree/env that yields the panic or replace item 3 with the evidence that actually holds (prefix + f7eaebf admission + artifact equality).

Additional findings

  • tests/regression.rs:474-499 (nit): the pair-wise CRLF→LF conversion is correct and exactly the autocrlf inverse — I scanned every canonical blob the wanted predicate selects (145 files on disk / 144 tracked; recho is an untracked build artifact): 0 CR bytes in all of them, so no semantic CR can be touched. But the comment says "153 files scanned" — I cannot get 153 from the predicate; the real numbers are 144/145. Conclusion unaffected; the number should be.
  • comsub/heredoc table wording (nit): "another truncated pin" / "same class" mischaracterizes — those two are CRLF pins, not interruptions (the PR's own earlier "runner-CRLF or crash-truncated" phrasing is the accurate one).
  • Pre-existing, out of scope but directly on this lane's mission: the errors slice is still machine-dependent across Windows machines. On this machine cargo test --test regression upstream_suite_slice_snapshots fails at errors (after exit:/after shift: status lines differ from golden in both directions, e.g. tests/regression/snapshots/errors.snap:64,67,74) while CI passes it — so "local: 70 passed" does not generalize, and the lane has a machine-dependence axis beyond CRLF (the ${THIS_SH}-degradation faces in errors10.sub are the suspect). Not introduced by this PR; filing separately is fine, but the PR's framing ("snapshot bytes stop depending on the checkout's line-ending config") should not be read as the lane being machine-stable.

Bottom line

The change is correct and merge-worthy on its own evidence; the ruling's conclusion ("re-record, not a product regression") is one I independently concur with. Requesting changes only so the adjudication text matches reproducible reality: fix or withdraw the byte-proof paragraph, the 153 number, and the comsub/heredoc "truncated" wording. No changes requested to the snap bytes or the normalization code.

(Verification used six throwaway worktrees, all removed; the cr-808 clamp mutation was reverted before cleanup; the oracle ran read-only in WSL /tmp.)

…ount

CR review of #808: the 153 figure counted per-suite matches, not the
unique wanted-predicate file set. Accurate numbers: 144 tracked suite
files across the 13 slices (145 on a disk that carries a built-in
untracked recho artifact); none of the canonical blobs contains CR, so
the no-CR safety argument for the CRLF->LF copy normalization is
unchanged. Text only - no snapshot bytes touched.
@caomengxuan666

Copy link
Copy Markdown
Member Author

CR 修正轮已落地(5cff440f,纯文本,字节零改动——三个 snap 相对 c8719d9 无 diff):

  1. byte-proof 段已整体替换为 CR 验证站得住的四点链:①旧 nquote 1045 = 规范输出的严格前缀;②f7eaebf8 提交信息自认转录自中断 CI run;③pre-PR master artifact(run 39123676479)的 1226 = CRLF run 逐字节复现;④新 golden 三方一致(本地 LF == committed == PR CI artifact 13/13 切片;nquote 另 == GNU oracle)。原"还原 clamp → 复现 panic"的说法撤回。
  2. tests/regression.rs 注释计数改准:wanted 谓词下 144 tracked(本地实核;CR 磁盘 145 含自建未跟踪 recho),"规范 blob 无 CR"结论不变。
  3. 表格措辞:comsub/heredoc 改为 CRLF pin(不再称 truncated)。
  4. errors 切片机器依赖:同意不在本 PR 范围,等你的票。

PR 正文与票内两条评论已同步校准。等这颗文本 commit 的 CI 绿后即可合并。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant