fix: F5 debug launch not entering interactive mode - #100
Open
ayeshurun wants to merge 11 commits into
Open
Conversation
AB#1694265 ## Summary Scaffold feature 1694265 and add the Fabric CLI-specific design and seven-slice implementation plan for Azure CLI authentication. ## Prompting Intent Draft the repo design spec from the Feature Registry artifacts, create an implementation plan and task breakdown, and prepare the design readiness gate required before syncing tasks to ADO. ## Linked Sources - Requirements spec: https://[email protected]/powerbi/Trident/_git/PlatformDevFeatureRegistry?path=/Features/active/1694265/requirements-spec.md - Engineering design: https://[email protected]/powerbi/Trident/_git/PlatformDevFeatureRegistry?path=/Features/active/1694265/engineering-design.md - Implementation handoff: https://[email protected]/powerbi/Trident/_git/PlatformDevFeatureRegistry?path=/Features/active/1694265/implementation-handoff.md - Test plan: https://[email protected]/powerbi/Trident/_git/PlatformDevFeatureRegistry?path=/Features/active/1694265/test-plan.md ## Rationale Translate the locked cross-cutting contract into concrete Fabric CLI modules and reviewable workstreams while leaving security, host-integration, and rollout decisions as explicit gates. Task work items are intentionally deferred until this design is merged, as required by the feature readiness policy. Co-authored-by: Copilot <[email protected]> Copilot-Session: 9c368147-9689-45f9-9f29-fc882429424b
chore: Draft Azure CLI authentication design AB#1694265
Co-authored-by: Aviat Cohen <[email protected]> Co-authored-by: Copilot Autofix powered by AI <[email protected]>
) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The default launch configuration prompted for arguments via
${command:pickArgs}. Submitting an empty prompt yields no arguments, so
main falls through to interactive mode, but the session then ended
immediately after printing the welcome banner.
Two independent problems:
1. launch.json prompted for arguments on every F5 and offered a second
configuration using "externalTerminal" with stopOnEntry, which cannot
attach to a terminal inside a dev container. The default config now
passes no arguments and always uses the integrated terminal, which
interactive mode requires because prompt_toolkit needs a TTY. The
argument prompt is kept as an explicitly named second configuration.
${workspaceRoot} is also replaced with the current ${workspaceFolder}.
2. start_interactive caught EOFError in the loop's generic
"except Exception" branch, which made the outer
"except (EOFError, KeyboardInterrupt)" handler unreachable from inside
the loop. Because str(EOFError()) is the empty string, both Ctrl+D and
a non-terminal stdin printed a bare "Error in interactive session:".
EOFError is now re-raised so the session exits with its normal goodbye
message, and a non-terminal stdin additionally explains the cause
instead of exiting without a reason.
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 0c37de44-e0a0-4090-8f7e-299889108578
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.
Problem
Pressing F5 and submitting an empty argument prompt printed the welcome banner and then exited with a bare
Error in interactive session:instead of entering the REPL.Reproduced locally. Two independent defects, both pre-existing (
.vscode/launch.jsonis unchanged since the initial commitac4dc95).Root cause
1.
.vscode/launch.json"args": "${command:pickArgs}". An empty prompt yields[], somain.pycorrectly falls through to interactive mode — the prompt was just noise on the common path."console": "externalTerminal"withstopOnEntry, which cannot attach a terminal inside a dev container.${workspaceRoot}instead of${workspaceFolder}.2.
src/fabric_cli/core/fab_interactive.pyEOFErroris a subclass ofException, so the loop's genericexcept Exception as ecaught it before the outerexcept (EOFError, KeyboardInterrupt)— making that outer handler unreachable from inside the loop. Sincestr(EOFError())is the empty string, the message printed wasError in interactive session:with nothing after it.This affected two cases:
prompt_toolkitraisesEOFErrorimmediately at the first prompt.Changes
.vscode/launch.jsonFabric CLI Debug (Interactive):"args": [],"module": "fabric_cli.main","console": "integratedTerminal". Interactive mode requires a TTY, which the Debug Console does not provide.Fabric CLI Debug (Prompt for args)keeps${command:pickArgs}for one-shot commands, also on the integrated terminal.externalTerminal/stopOnEntryconfiguration.${workspaceRoot}→${workspaceFolder}.src/fabric_cli/core/fab_interactive.pyEOFErrorfrom the loop so the outer handler runs.except EOFErrorandexcept KeyboardInterrupt. OnEOFError, if stdin is not a TTY, additionally explain why interactive mode cannot start; the normal exit message is printed in both branches.tests/test_core/test_fab_interactive.pytest_start_interactive_eof_error_failureasserted the buggy blank message, so it encoded the defect and had to be rewritten. Added coverage for terminal and non-terminal stdin.interactive_cli.session.promptis a module-level mock shared through theInteractiveCLIsingleton, soreset_mock()is required before assertingcall_count.Verification
pty.fork): banner →fab:/$prompt →exit→ goodbye message.python3 -m pytest tests/test_core tests/test_utils→ 553 passed.mypyclean on both changed files;black --checkreports no new diffs (3 pre-existing violations in these files are left untouched).Not verified
I could not determine why the reporter's debug session had non-terminal stdin — that requires VS Code and
debugpy, which are not available in this environment. The fix handles every branch regardless, and the non-TTY case now reports its own cause rather than failing silently.