Skip to content

init: step_header(N, ...) hardcodes step number — preset flows show misleading positions #420

@pandas-studio

Description

@pandas-studio

Symptom

_step_memory_dir (and every other _step_* in init_cmd.py) hard-codes its step number via step_header(N, title). That number is correct for the --advanced flow (where memory-dir is step 3 of 10) but misleading in the two preset flows where memory-dir is the first interactive step the user actually sees:

Flow step_header shows Actually is
mm init --advanced 3. Memory Directory step 3 of 10 ✓
mm init --preset korean 3. Memory Directory step 1 of 3
mm init (default, preset chosen) 3. Memory Directory step 2 of 4 (picker + 3 follow-ups)

First-time users reading 3. without seeing steps 1 and 2 get a nagging "did I miss something?" signal, and the surrounding log ordering looks bizarre. (This may have contributed to the confusion in #3713. implies there was a previous step to return to.)

Root cause

packages/memtomem/src/memtomem/cli/init_cmd.py — each _step_* function opens with step_header(<hardcoded_int>, "<title>"). The integer is a property of the --advanced 10-step sequence, not of the function's position in whatever run_steps list actually invokes it. packages/memtomem/src/memtomem/cli/wizard.py:step_header takes the number as a parameter but has no way to know the step's real position inside the current run_steps queue.

Suggested directions

Pick one:

  1. Pass position through run_steps. run_steps knows i and len(steps); it could stash state["_wizard_position"] = (i + 1, len(steps)) before each step call. Step functions read that instead of hard-coding. One-time wiring, no signature change to step functions.
  2. Make step_header take a title only and derive the number from a state["_wizard_position"] seed. Same idea, different seam — the number lives in the helper instead of the step.
  3. Drop the number entirely from the preset flows (show only the title), or use word markers like "First. …" / "Next. …". Less structured but zero risk of drift.

Direction 1 or 2 is the right choice if we want the full sequence numbered consistently. Direction 3 is the lowest-touch escape hatch.

Acceptance criteria

  • In all three flows (advanced, --preset X, default-interactive preset), step headers reflect the actual position within the flow the user is taking.
  • No step function has to know or care which flow it runs in.
  • Existing step tests continue to pass.
  • New test that exercises the number display for at least one step in each flow (can use CliRunner().invoke(init, input=...) and grep the output).

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions