Repository navigation
WIP: 1.5.0 row 6 — §5.3 state views + WP-6 inspection rendering - #1883
Merged
Merged
Conversation
DeclarationAttrs and the print_declaration/print_unset_declaration printers go pub(crate), and print.rs gains declaration_line(): the single-name entry to the same printer the declare builtin's loop uses. The 1.5.0 state views (PLAN row 6) render variable snapshots through here so an inspection snapshot and declare -p NAME can never drift into two formatters. No behavior change: the builtin keeps its own loop (it prebuilds the mark sets once per listing).
New in-tree api module (pub(crate) until the workspace split moves it wholesale, 150-c precedent): live StateViews (variables / options / environment / cwd / positional / aliases / functions / last_status) plus owned snapshots for inspection. Every capture reads the engine's own stores and dynamic views — dynamic declaration view for dynamic parameters, the composed stack views for FUNCNAME/BASH_SOURCE/BASH_LINENO, pipestatus_entries for PIPESTATUS — and every write delegates to the machinery the shell itself uses: set_env, the array state stores, cd's execute_with_io + sync_cd_variables, the unset builtin's leaf sequence. No shadow bookkeeping anywhere. Executor helpers live in executor/state_views.rs (capture_variable resolves as the debuggee does: dynamics, then the visible binding in the global stores — a live local's value sits there while its scope maps hold the saved outer binding for restore — with the declared-unset guard of the read path, rubash#409). Exit gate in api/consumer_tests.rs: a niu-sized consumer act drives a session through the views only, and a debugger act stops a real debuggee and checks the snapshot item by item against the debuggee's own declare -p / caller output at the same stop.
DebugSession gains an inspection slot; the funnel consult (debugger_serve_stop) captures an InspectionSnapshot from the live engine state and installs it before the stop loop runs — the one minimal executor seam, so frontends render exactly the state the debuggee stopped in. debugger/inspect.rs renders where / caller / variables (partitioned) / info-args / dynamic state purely from the §5.3 snapshots: render_caller reproduces caller.def's frame arithmetic and the environment source presentation, and variable listings join the snapshot's shared-printer declaration lines instead of re-rendering anything.
Three CI-only reds on PR #1883, all in test shape, none in product: - act1 compared the shell's pwd output byte-for-byte against the native canonical path. pwd prints the shell spelling (shell namespace + 8.3 short names on Windows, the logical path through the /private symlink on macOS); compare filesystem identity instead — canonicalize the printed spelling and require the same directory the view set. - act2 interpolated the debuggee's native Windows path into shell source unquoted; a backslash in a bare word is an escape, so the separators were eaten and the source failed (status 1) before anything ran. Quote the path. - gate::session_active_global_roundtrip was the only consumer of GATE_TEST_LOCK acquiring it with unwrap(): any GateTestSpan holder panicking mid-span (the known goldens wiring failures) poisons the mutex and this test exploded on the poison. Acquire poison-tolerantly like every GateTestSpan; the flag itself is restored by the span's Drop disarm.
The Rust tests job runs scripts/check-utf8-boundary-hygiene.sh, which rejects every unreviewed byte->char widening (niubash#92 class). shell_spelling_to_native widened the drive byte with `as char`; parse the spelling with chars() instead — the drive letter is a real char by then, no widening and no byte slicing, and the hygiene scan stays clean without an allowlist entry.
caomengxuan666
marked this pull request as ready for review
October 27, 2026 18:51
SpookyWaste
pushed a commit
to SpookyWaste/rubash
that referenced
this pull request
Oct 29, 2026
The 8 debugger::wiring_tests that have failed only in the Windows goldens job since unixwin#1878 all drive the debuggee through sourced_script(), which interpolated the temp script's native path into the driver input unquoted: `. C:\Users\...`. In a bare word the lexer treats `\` as an escape, every separator was eaten, `.` never found the file, and each debuggee exited status 1 having executed nothing (de01's status assertion at wiring_tests.rs:142 — left 1, right 0). Quote the path at the helper, the single interpolation point all nine call sites share — the same harness shape the api consumer tests were fixed with in unixwin#1883. No product code changes; the debuggee scripts and their status semantics are untouched.
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.
PLAN row 6 (S3 views part + WP-6) from the 1.5.0 program (designs: rubash#595 API / rubash#497 debugger, docs PR #1535).
What lands
src/api/, pub(crate) until the workspace split moves the module wholesale — 150-c precedent; no split long-branch in this cluster, rationale in the cluster REPORT): liveStateViews(variables / options / environment / cwd / positional / aliases / functions / last_status) + owned snapshots (VariableSnapshot/FrameSnapshot/DynamicStateSnapshot/InspectionSnapshot).declare -pprinter are the single source for both the API and the debugger's inspection. The declare printer is widened (pub(crate)) plus a single-name entrydeclaration_line(); captures snapshot the printer's bytes at capture time, so a snapshot anddeclare -pcannot disagree.src/debugger/inspect.rs): where / caller / partitioned variable listings / info-args / dynamic state, rendered purely from the snapshots.render_callerreproduces caller.def's arithmetic + theenvironmentsource presentation. The funnel consult captures the snapshot into the session before the stop loop runs (one minimal seam indebugger_serve_stop).set_env, the array state stores,cd'sexecute_with_io+sync_cd_variables, and the unset builtin's leaf sequence.Exit gate (in-tree, green)
src/api/consumer_tests.rs— a niu-sized consumer test in two acts:declare -p, options, $?, positional, cwd, aliases, functions, unset, PIPESTATUS).declare -p(12-name battery incl. locals, declared-unset, nameref, FUNCNAME, PIPESTATUS) andcaller 0/1output printed at the same stops.Gates
ownership_unary_operators_check_existing_file).cargo check --libwith-D warnings: clean.Not in this PR
declare -plisting omits declared-unset names vs GNU; $BASH_COMMAND at a funnel stop reads the last-begun command; BASH_ARGC/ARGV omit the bottom frame + sourced-file arg vs GNU) — evidence in the cluster REPORT; the views report engine state faithfully rather than papering over them.Draft: do not merge — cluster delivery for main-session review.