Uh oh!
There was an error while loading. Please reload this page.
Interactive mode: an answer applies to one occurrence, not the whole run - #3990
Interactive mode: an answer applies to one occurrence, not the whole run#3990Eljees wants to merge 4 commits into
Conversation
Eljees
commented
Aug 14, 2026
Ping — this has been open since 7 August with no review yet.
Only Happy to close it if you would rather solve #62 differently. |
larsoner
commented
Aug 18, 2026
@Eljees sorry for the slow response... to help me get to it I had Claude Opus 5 take a look and expand it a bit by having "A" (all) and "S" (skip) options in addition to just "Y" / "N". Can you look and see if you agree it's better? |
Eljees
commented
Aug 23, 2026
Yes - it is better, and the Three of your changes fix things I had wrong:
The EOF guard is worth having on its own - an unanswered prompt used to read as I re-ran the transcripts from my earlier note against
One gap. Either accepting |
Fixes#62.
The root cause is that
ask_for_word_fixanswers a question about one occurrence by mutating the sharedMisspellingobject, so a single answer leaks into every later occurrence of the word in the run. Observed on currentmaster(all transcripts scripted, answers fed on stdin):-w -i 1, the same word in two files, answersn,y: the second file never asks — the rejection turned the word off globally, and the queuedyis never consumed.-w -i 3, reject a word, then meet it in the next file: the prompt degrades from(Y/n)toChoose an option (blank for none): 0) ...— the "handled as a list of available fixes" behaviour from the issue, still alive.-w -i 2, a word with a single candidate, answer blank ("blank for none"): the file is changed anyway —FIXED: c.txt.Three changes:
ask_for_word_fixno longer mutatesmisspelling; it returns the answer for this occurrence.asked_forbecomes a dict and moves out of the per-line scope, where its reset meant "asked once per file" only held because of the mutation). Accepting and rejecting now behave symmetrically: each word is asked once per file, and the answer covers the rest of that file.--helpsays level 2 is for ("ask user to choose one fix when more than one is available"). Single-candidate words at-i 2are written without a prompt, as documented; the blank-accepts-anyway path is gone.These are the first tests for interactive mode in the suite; they feed answers through stdin. On the unpatched tree the three bug tests fail exactly on the behaviours above, the per-file control passes; with the fix all four pass. Full
test_basic.py: 86 passed, 3 failed — the same three failures (chardet import) as on a clean tree.ruff check,ruff format --checkclean; mypy reports the same two pre-existing errors as on a clean tree.AI-assisted (LLM used for drafting); the runs above are mine.