Repository navigation
fix: align path-form expectations with rubash #556 POSIX persona - #283
Merged
Merged
Conversation
rubash#556 (P0 rubash#537) made the engine render $PWD/`pwd` in the POSIX persona form (/c/...) unconditionally and retired the native-style hatch. It reached niubash through the branch = master git dependency (CI clones rubash master into ../rubash), turning command_mode_compound_commands_keep_home_paths_native red on every PR (#278 first). The owner ruling: PWD form is shell semantics (msys persona consistency, nvm find_up death loop, GNU parity); native drive spelling is correct only at the Win32 spawn boundary (path contract). Engine-side alignment (niubash-runtime): - The host cwd sync (startup + per-command) re-stamped the executor PWD into native drive form, making the rendered form depend on which route executed (simple sequences native, compound lines/cmdsub persona) - exactly the inconsistency the ruling kills. The stamps now go through rubash's own canonical renderer (shell_pwd_display_path) after the root mapping, so PWD is persona everywhere while the process-cwd sync, PATH translation, and child argv stay native spawn-boundary behavior. - Drop the inert NIU_SHELL_PATH_STYLE / WINUXSH_SHELL_PATH_STYLE exports: rubash#556 deleted the engine-side readers, so the vars only misinformed children (the AGENTS.md bridge policy requires removal once rubash retires its readers). Test alignment (assertions updated, with the ruling cited inline): - repl_command: command_mode_compound_commands_keep_home_paths_native -> command_mode_compound_commands_posix_pwd_and_native_spawn_argv; PWD/ pwd expected persona, catrc:ok spawn-boundary guard kept. The persona assertions pin the FORM (drive prefix + home basename, native drive spelling asserted absent) instead of full-path bytes: the first cut compared full strings and was red on the CI merge-ref while green locally, so environment path-spelling variance is explicitly out of the contract under test. - host_contract: cwd_cd_pwd_and_windows_child_process_agree, slash_drive_paths_are_compat_input_not_default_output (renamed to slash_drive_input_cd_works_and_pwd_renders_persona_form), slash_drive_root_cd_switches_to_drive_root, native_backslash_drive_paths_work_for_cd, drive_only_cd_and_bare_drive_commands_switch_to_drive_root, tilde_resolves_to_normal_windows_home: pwd lines expect persona; cmd.exe child lines keep native expectations. - cwd_state: normalize() maps drive-colon paths onto the persona form so the suite keeps pinning the cwd-state contract, not the rendering. - shell.rs unit test interactive_cd_syncs_process_cwd_and_normalizes_pwd expects the persona form. Unchanged by design (rubash#556-preserved): mktemp native output (slash_drive_mktemp_template_creates_file), TMPDIR child boundary (issue162), bare-slash argv (issue153), PATH translations.
caomengxuan666
force-pushed
the
fix/path-form-alignment-556
branch
from
October 12, 2026 07:01
d3a5031 to
52cd888
Compare
caomengxuan666
added a commit
that referenced
this pull request
Oct 13, 2026
…1.4.0 section (#326) - The [Unreleased] entries (#284/#287, #293-#304, #313) move into [1.4.0]; [Unreleased] is empty again. - Newly recorded (today's wave): Git Bash compatible factory default prompt (#292, headline), WT-form shortcuts (#290/#211), the paste burst trailing-Enter fix (#308/#291), self-update SHA256 + release pinning (#311/#312), managed-block convergence (#324), completion tables/NIU_COMPDEFS/NIU_ENV probe (#305-#307), -s on-demand stdin (rubash#586 host half), bash/rbash invocation faces (#321/#322). - Older gaps recorded: closed-stdout pipe contract (#245/#286), history session-end write-back (#265), sh POSIX contract (#262), PWD persona alignment (#283), one-shot fast path (#270), --cwd-state (#272), --encoded-command (#271), REPL-command highlighting (#281), docs passes (#255/#225/#226/#227), MSRV (#267), easter-egg prune (#264). CHANGELOG-only change; no version claims.
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.
Background
rubash#556 (P0 rubash#537, owner-adjudicated 2026-10-12) made the engine render
$PWD/pwdin the POSIX persona form (/c/...) unconditionally and retired the native-style hatch that starved nvm'sfind_uploop. It reached niubash through thebranch = mastergit dependency (CI clones rubash master into../rubash; the lock only pins the version), turningcommand_mode_compound_commands_keep_home_paths_native(tests/repl_command.rs:191) red on every PR — #278 was the first to hit it.What the failing test originally protected
Introduced in e10b9f0 ("Prepare plugin-first 0.10.0 release"), the test pinned two contracts on one compound
-cline:echo PWD=$PWD; pwdhad to stay native (!stdout.contains("/c/")).cat ~/.niubashrc >/dev/nullredirects the cat shim'sarg=echo to /dev/null, so the/c/scan could only ever trip on the PWD/pwd output — it is purely a PWD-rendering assertion.catrc:ok: the tilde-expanded argv handed to an externalcat.cmdmust stay usable; the shim exits/b 12on a slash-drive first argument.Judgment (per the #556 ruling; no re-litigation)
Assertion (1) is a PWD-rendering pin → aligned to the persona form. Assertion (2) is the spawn boundary → kept as-is; empirically it still passes post-#556. No #556 overreach regression found — nothing to escalate upstream on that front.
Finding: niubash's own remaining hatch
With post-#556 rubash, niu's PWD form was shape-dependent: the host cwd sync (
Shell::newstartup +sync_process_cwd_from_executor_pwdper command) re-stamped the executor PWD into native drive form, soniu -c 'cd X; pwd'printed native whileniu -c 'cd X && pwd'printed persona. That is precisely the inconsistency the ruling retires, so this PR routes every host PWD stamp through rubash's own canonical renderer (shell_pwd_display_path, after the root mapping). The spawn boundary is untouched: process cwd sync, PATH translation, child argv, TMPDIR exports all keep native spelling.Also drops the inert
NIU_SHELL_PATH_STYLE/WINUXSH_SHELL_PATH_STYLEexports (rubash#556 deleted the engine-side readers — "no remaining readers"; AGENTS.md's bridge policy requires removal once rubash retires its readers) and updates the AGENTS.md bridge line accordingly.Alignment list
tests/repl_command.rs:command_mode_compound_commands_keep_home_paths_native→command_mode_compound_commands_posix_pwd_and_native_spawn_argv(persona PWD/pwd expected;catrc:okkept; ruling cited in the doc comment).tests/host_contract.rs:cwd_cd_pwd_and_windows_child_process_agree,slash_drive_paths_are_compat_input_not_default_output(renamedslash_drive_input_cd_works_and_pwd_renders_persona_form),slash_drive_root_cd_switches_to_drive_root,native_backslash_drive_paths_work_for_cd,drive_only_cd_and_bare_drive_commands_switch_to_drive_root,tilde_resolves_to_normal_windows_home— pwd lines expect persona;cmd.exe /C cdchild lines keep native expectations.tests/cwd_state.rs:normalize()maps drive-colon paths onto the persona form — the suite keeps pinning the cwd-state contract, not the rendering form.crates/niubash-runtime/src/shell.rs: persona PWD stamps + unit testinteractive_cd_syncs_process_cwd_and_normalizes_pwdaligned.slash_drive_mktemp_template_creates_file(mktemp native output is upstream-locked), issue162 TMPDIR child boundary, issue153 bare-slash argv.Rebase on #281/#262 and the merge-ref CI incident
2a6a12a(P3 sweep: self-update highlight (niu#260) + android cross-check gates (niu#207 step 1) + rc-0 history flush restore #281fe4dd52rc-0 normal return + fix(sh): honor the sh invocation contract through the shim forward #262 sh-shim contract). No P3 sweep: self-update highlight (niu#260) + android cross-check gates (niu#207 step 1) + rc-0 history flush restore #281 semantic interaction found with the persona stamps: the stamps run insideexecute_script/per-command syncs, strictly beforefinish_one_shot, and P3 sweep: self-update highlight (niu#260) + android cross-check gates (niu#207 step 1) + rc-0 history flush restore #281 only changes the rc-0 teardown path (no PWD writes there). The merge-ref tree GitHub built was verified byte-identical to this branch's tree (git merge-tree:a8c82eb7both sides), so the first CI red with a locally-green run was environment variance, not content.PWD=/{drive}/prefix +/homebasename + native-drive absence + the barepwdline — instead of full-path bytes (commit message documents this; environment path-spelling variance is explicitly out of the contract under test).history -c清掉的行仍留在共享历史文件(已清行复活) #569/[P1][history][历史污染残留] 双会话同文命令被内容去重吞掉一份(丢失) #570 carries anunused Resultwarning atsrc/executor/command_prepare.rs:2837(finish_heredoc_expansion_error); niubash CI builds withRUSTFLAGS: -D warnings, socargo buildfails on every niubash PR until rubash lands the one-line fix (let _ = ...or real handling). Verified locally against rubash tipf9fe68c6.Verification
Reproduced first with a post-#556 rubash checkout, then re-verified after the rebase against rubash tip
f9fe68c6:PWD=/c/...+ personapwd+catrc:ok, panic at repl_command.rs:191 — exactly the style: cargo fmt — clear master fmt debt from #544 #556 flip.cargo test --workspace --locked --no-fail-faston this branch vs the same run on fresh master2a6a12a(both against post-style: cargo fmt — clear master fmt debt from #544 #556 rubash): failure sets match name-for-name, except the aligned test, which now passes.history_and_fc_use_the_host_history_provideris green on both sides post-P3 sweep: self-update highlight (niu#260) + android cross-check gates (niu#207 step 1) + rc-0 history flush restore #281. The remaining local failures (interactiveConPTY family,bashit_theme_history_interlock_survives_prompt_cycles,d2/d3wizard journeys) are identical on both sides and pre-existing on this machine.cargo fmt --allclean;cargo test -p niubash-runtime --lib455/455; repl_command (11/11), host_contract (43/43), cwd_state (11/11) green against rubash tip.