Skip to content

fix(init): back-nav through silent step reaches previous prompt (#421)#423

Merged
pandas-studio merged 1 commit intomainfrom
fix/init-wizard-back-through-silent-step
Apr 23, 2026
Merged

fix(init): back-nav through silent step reaches previous prompt (#421)#423
pandas-studio merged 1 commit intomainfrom
fix/init-wizard-back-through-silent-step

Conversation

@pandas-studio
Copy link
Copy Markdown
Collaborator

Summary

Closes #421.

_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.
Same "boundary can't be crossed" shape as #371 / #418 but one step further
along the flow.

Fix

  • wizard.py: new silent_step decorator sets a _silent_in_back_nav
    attribute on the step function. run_steps's StepBack handler now walks
    back past any consecutive silent steps until it reaches an interactive one
    (or echoes (already at first step) if none precedes the current
    position). Forward direction is unchanged — silent steps still run their
    banner on the way through.
  • init_cmd.py: decorate _step_provider_dirs_auto with @silent_step
    and document the skip contract in the docstring. It is the only silent
    step today; the decorator is exposed generically from wizard.py so
    future silent steps opt in the same way.

Acceptance criteria (from #421)

  • b at _step_mcp lands the user back at the previous prompt
    (memory-dir), not on a silent step.
  • Silent step side effects (banners) don't re-fire on a back-pass-through.
  • New test that sequences CliRunner().invoke(init, input="...") and
    asserts the memory-dir prompt re-appears in the output.

Test plan

  • tests/test_wizard.py (new) — 9 unit tests covering the skip mechanism
    directly: single silent skip, multi-silent skip, forward-only flow,
    back-at-index-0, silent-at-position-zero, state persistence across back-nav.
  • TestBackNavThroughSilentStep in test_init_cmd.py — CliRunner regression
    that pins the real wiring. Memory Directory header must appear twice in
    captured 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, 46
    deselected.
  • ruff check + ruff format --check + mypy init_cmd.py wizard.py → clean.

Out of scope (tracked separately)

`_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]>
Copy link
Copy Markdown
Collaborator

@tsdata tsdata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — automated review pass.

Copy link
Copy Markdown
Collaborator

@tsdata tsdata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — automated review pass.

@pandas-studio pandas-studio merged commit 984d717 into main Apr 23, 2026
7 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 23, 2026
@memtomem memtomem deleted the fix/init-wizard-back-through-silent-step branch April 23, 2026 11:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

init wizard: b at _step_mcp silently re-runs _step_provider_dirs_auto instead of reaching a real prompt

2 participants