Skip to content

feat(cli): route output through vip.output and enable ruff T201 - #847

Merged
ian-flores merged 9 commits into
mainfrom
cli-output-layer-736
Nov 19, 2026
Merged

ian-flores merged 9 commits into
mainfrom
cli-output-layer-736

Conversation

@ian-flores

Copy link
Copy Markdown
Collaborator

Closes #736. Part of #831.

VIP used bare print() as its output layer. This adds src/vip/output.py, moves every call site onto it, and turns on ruff T201 so new prints fail lint.

Function Stream Hidden by
out(): results (report path, plans, status, JSON) stdout never
info(): progress stderr -q
warn(), error() stderr never
debug(): diagnostics stderr shown only with -v
  • New root flags vip -q / vip -v. vip verify --verbose still means full tracebacks and also turns on debug; -q wins.
  • VIP_VERBOSITY carries the level into the pytest subprocess, so auth output honours it.
  • vip.* logging goes through the same layer. It replaces cleanup's own handler and the idp._verbose flag.
  • Message text is unchanged. Prompts that need the user to act use warn(), so -q cannot hide them.

Behaviour change: warnings and progress, including all of vip cleanup's counts, now go to stderr. Scripts that grep stdout for them need 2>&1.

Root -q/--quiet and -v/--verbose set the vip.output level before any
subcommand runs. They use their own argparse dests so a subparser default
cannot clobber them; `vip verify --verbose` keeps meaning tracebacks and
now also enables debug output. `vip verify` exports VIP_VERBOSITY to the
pytest subprocess so the auth code in the plugin honours the level.

The CLI entry point now calls configure_logging() for every command
instead of only cleanup, so vip.* log records reach stderr uniformly and
cleanup._ensure_cli_logging is deleted. idp._verbose/_log_verbose are
folded into output.debug; start_headless_auth(verbose=True) raises the
level to verbose.
Each print becomes out (command results: report/bundle paths, install and
uninstall plans, status table, scaffold results, version, minted-key JSON),
info (progress and status), warn (warnings and prompts that need user
action), error (failures) or debug (mint cookie diagnostics). Streams
change deliberately: progress and warnings now go to stderr so stdout
carries only results. Message text is unchanged.

Interactive auth is unaffected by the stream move: pytest_configure output
is not captured on either stream (checked with a probe conftest), and
action-required prompts use warn so `vip -q` cannot hide them. Selftests
that read capsys .out for moved messages now read .err; negative
assertions check both streams.
These lines only print when minting fails, and they are the evidence for an XSRF or wrong-path failure, so hiding them behind -v forced users to rerun.
Copilot AI balanced review requested due to automatic review settings November 19, 2026 19:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The legacy verbose flag overrides quiet mode, while pytest subprocesses lack the logging bridge needed to show diagnostics at the selected verbosity.

2 open issues
What changed in this PR

This PR centralizes VIP’s terminal output, separating command results from diagnostics and adding verbosity controls. It addresses #736 as part of the upkeep work in #831.

Changes:

  • Adds vip.output, root quiet/verbose flags, subprocess verbosity propagation, and a logging bridge.
  • Migrates output calls across CLI commands, authentication, installation, and product tests; progress and warnings now use stderr.
  • Enables Ruff T201 and updates selftests and documentation for the output contract.
File Description
website/​src/​pages/​guide.astro Documents quiet mode and precedence.
src/​vip/​proxy.py Routes proxy notices through info().
src/​vip/​plugin/​results.py Routes unproven-check warnings through warn().
src/​vip/​output.py Adds output helpers, verbosity, and logging integration.
src/​vip/​install/​runner.py Separates plans from installation diagnostics.
src/​vip/​install/​playwright.py Routes installation progress to stderr.
src/​vip/​idp.py Uses shared diagnostics and visible authentication prompts.
src/​vip/​cli/​version.py Routes version results through out().
src/​vip/​cli/​verify.py Propagates verbosity and migrates skip notices.
src/​vip/​cli/​status.py Routes status results through out().
src/​vip/​cli/​scaffold.py Separates scaffold results and warnings.
src/​vip/​cli/​report.py Separates report results, progress, and warnings.
src/​vip/​cli/​install.py Migrates install plans and cleanup warnings.
src/​vip/​cli/​cleanup.py Moves cleanup messages to shared output helpers.
src/​vip/​cli/​bundle.py Separates bundle results and warnings.
src/​vip/​cli/​auth.py Routes JSON results and errors through shared helpers.
src/​vip/​cli/​app.py Adds verbosity flags and initializes logging.
src/​vip/​auth/​workbench.py Migrates authentication progress, prompts, and warnings.
src/​vip/​auth/​sso.py Uses shared debug output.
src/​vip/​auth/​scheme.py Routes connection and TLS warnings to stderr.
src/​vip/​auth/​flows.py Migrates login output and headless verbosity handling.
src/​vip/​auth/​cache.py Routes cache notices through info().
src/​vip/​auth/​browser.py Routes key-cleanup warnings through warn().
src/​vip/​auth/​apikey.py Migrates key-management diagnostics and warnings.
src/​vip_tests/​workbench/​test_publish_to_connect.py Migrates timestamped deployment progress.
src/​vip_tests/​performance/​test_resource_usage.py Migrates request diagnostics.
src/​vip_tests/​connect/​test_content_deploy.py Migrates deployment retry notices.
selftests/​test_scheme_resolution_proxy.py Checks warning redaction on stderr.
selftests/​test_output.py Tests streams, verbosity, and logging behavior.
selftests/​test_idp.py Tests stderr prompts and verbose diagnostics.
selftests/​test_cli_verify.py Tests stderr notices and verbosity propagation.
selftests/​test_cli_verbosity.py Tests root flags and logging initialization.
selftests/​test_cli_url_scheme.py Updates cleanup output assertions.
selftests/​test_cli_cleanup.py Checks cleanup messages on stderr.
selftests/​test_auth_scheme.py Checks connection warnings on stderr.
selftests/​test_auth_interactive.py Updates authentication warning assertions.
selftests/​test_auth_cache.py Updates cache notice and silence assertions.
selftests/​test_auth_apikey.py Checks key diagnostics on stderr.
selftests/​install/​test_runner.py Checks installation errors on stderr.
selftests/​install/​test_playwright.py Distinguishes child output from VIP progress.
selftests/​conftest.py Restores output and logging state between tests.
pyproject.toml Enables T201 with standalone-script exceptions.
docs/​development.md Documents the output lint rule and helpers.
AGENTS.md Documents output routing and verbosity conventions.

Review effort: Balanced

Comment thread src/vip/auth/flows.py Resolved
Comment thread src/vip/cli/verify.py Resolved
start_headless_auth(verbose=True) no longer lifts a quiet level, and pytest_configure now attaches the vip logging handler so vip -v verify shows child-side debug logs.
@ian-flores

Copy link
Copy Markdown
Collaborator Author

Both Copilot findings are fixed in 7986440: -q now wins over --vip-verbose, and the pytest subprocess attaches the vip logging bridge so vip -v verify shows child-side logs.

@ian-flores
ian-flores marked this pull request as ready for review November 19, 2026 19:41
@ian-flores
ian-flores requested a balanced review from Copilot November 19, 2026 19:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Quiet mode still emits Locust diagnostics during verbose user-simulation runs because the diagnostic writer bypasses the resolved output verbosity.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Suppress Locust diagnostics when resolved output verbosity is QUIET

src/​vip/​cli/​app.py:660

A user-simulation run such as vip -q verify --verbose --categories performance -- -n 0 still emits Locust diagnostics: --vip-verbose reaches run_user_simulation(), whose diagnostic writer bypasses vip.output. Make the vip_verbose fixture or the Locust diagnostic gate also check the resolved output verbosity, so QUIET suppresses these messages without changing --verbose's full-traceback behavior.

2 resolved since last review

Review effort: Balanced

The Locust request log and [load] lines gate on vip_verbose, so vip -q verify --verbose printed them despite -q.
@ian-flores

Copy link
Copy Markdown
Collaborator Author

Fixed the Locust finding in 441ceef: the vip_verbose fixture is now False when the output level is quiet, so vip -q verify --verbose no longer prints the Locust request log or the load lines. Full tracebacks still follow --verbose.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The review reports no active issues with the shared CLI output and verbosity changes.

No open issues 🎉

Review effort: Balanced

@ian-flores

Copy link
Copy Markdown
Collaborator Author

Thanks, Copilot. No open issues at 441ceef, nothing further to change.

@ian-flores
ian-flores merged commit ecbb391 into main Nov 19, 2026
51 checks passed
@ian-flores
ian-flores deleted the cli-output-layer-736 branch November 19, 2026 22:00
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.2
Preview removed because the pull request was closed.
2026-11-19 22:00 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] Decide on a CLI output layer before enabling ruff T201

2 participants