fix(init): back-nav through silent step reaches previous prompt (#421)#423
Merged
pandas-studio merged 1 commit intomainfrom Apr 23, 2026
Merged
Conversation
`_step_provider_dirs_auto` sits between `_step_memory_dir` and `_step_mcp` but only emits a detection banner — it has no user prompt. Pre-fix, "b" at `_step_mcp` decremented onto this silent step, which re-emitted its banner and advanced straight back to `_step_mcp`, so "b" appeared to do nothing. `wizard.run_steps` now walks back past `@silent_step`-decorated functions when handling `StepBack`, so "b" lands on the previous *interactive* step (memory_dir) instead of stalling on the banner. If no interactive step precedes the current position, the existing `(already at first step)` message is echoed and the silent banner does not re-fire. * wizard.py: `silent_step` decorator + `_is_silent` helper; `StepBack` handler walks back until it hits a non-silent step. * init_cmd.py: decorate `_step_provider_dirs_auto` with `@silent_step` and document the skip contract inline. * tests/test_wizard.py (new): 9 unit tests pinning the skip mechanism — single and multi-silent sequences, silent-at-position-zero edge case, forward-flow regression, state-survives-back-nav. * tests/test_init_cmd.py::TestBackNavThroughSilentStep: CliRunner regression verifying the decoration is wired into the real wizard and the banner does not re-fire on the back-pass. * CHANGELOG: Fixed entry under [Unreleased]. Closes #421. Co-authored-by: Claude <[email protected]>
tsdata
approved these changes
Apr 23, 2026
Collaborator
tsdata
left a comment
There was a problem hiding this comment.
LGTM — automated review pass.
tsdata
approved these changes
Apr 23, 2026
Collaborator
tsdata
left a comment
There was a problem hiding this comment.
LGTM — automated review pass.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Closes #421.
_step_provider_dirs_autosits between_step_memory_dirand_step_mcpbut only emits a detection banner — it has no user prompt. Pre-fix, "b" at
_step_mcpdecremented onto this silent step, which re-emitted its bannerand advanced straight back to
_step_mcp, so "b" appeared to do nothing.Same "boundary can't be crossed" shape as #371 / #418 but one step further
along the flow.
Fix
wizard.py: newsilent_stepdecorator sets a_silent_in_back_navattribute on the step function.
run_steps'sStepBackhandler now walksback past any consecutive silent steps until it reaches an interactive one
(or echoes
(already at first step)if none precedes the currentposition). Forward direction is unchanged — silent steps still run their
banner on the way through.
init_cmd.py: decorate_step_provider_dirs_autowith@silent_stepand document the skip contract in the docstring. It is the only silent
step today; the decorator is exposed generically from
wizard.pysofuture silent steps opt in the same way.
Acceptance criteria (from #421)
bat_step_mcplands the user back at the previous prompt(memory-dir), not on a silent step.
CliRunner().invoke(init, input="...")andasserts the memory-dir prompt re-appears in the output.
Test plan
tests/test_wizard.py(new) — 9 unit tests covering the skip mechanismdirectly: single silent skip, multi-silent skip, forward-only flow,
back-at-index-0, silent-at-position-zero, state persistence across back-nav.
TestBackNavThroughSilentStepintest_init_cmd.py— CliRunner regressionthat pins the real wiring.
Memory Directoryheader must appear twice incaptured output (initial visit + post-back re-entry) and the banner text
must be absent from the slice between the first mcp prompt and the second
memory-dir header.
pytest packages/memtomem/tests -m "not ollama"→ 2233 passed, 46deselected.
ruff check+ruff format --check+mypy init_cmd.py wizard.py→ clean.Out of scope (tracked separately)
step_header(N, ...)hardcodes step number — preset flows show misleading positions #420) —step_headerstill hardcodes itsnumber regardless of the flow. Orthogonal UX polish; next PR.
--preset <name>false-advertises(b: back)(init --preset <name>: memory-dir step advertises(b: back)butbhas nothing to return to #422) — memory-dir isthe only step there, so "b" is legitimately a no-op but the hint lies.
Cosmetic twin, good-first-issue.