Repository navigation
fix(output): escape non-ASCII paths; print each uninstall removal line once (#4330, #4331) - #4425
Closed
Daniel Meppiel (danielmeppiel) wants to merge 6 commits into
Closed
Daniel Meppiel (danielmeppiel) wants to merge 6 commits into
Daniel Meppiel (danielmeppiel) wants to merge 6 commits into
Conversation
… line once (#4330, #4331) #4330: the ASCII Rich console (utils/console.py) escapes non-ASCII text to printable ASCII (`\xfc`) in render_str, before layout so table columns size the escaped text, and in its render-buffer pass for pre-built renderables; the click fallback escapes too. Every status helper, table and tree prints through this console, so a non-ASCII package or project path never reaches a cp1252 terminal raw. #4331: uninstall prints each removal line once when one package has several declarations sharing a public label (found in apm.yml, the dry-run plan, and "Removed ... from dependencies.apm in apm.yml"); the second declaration of an already removed apm_modules copy no longer warns "not found". Both strict output cells (command-echoes-non-ascii-path, uninstall-duplicate-declaration-lines) are removed; installed-CLI tests fail before and pass after. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 16:59
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Non-ASCII characters in pre-built Text cells are escaped after table layout, causing column misalignment and potential console-width overflow.
1 open issue
What changed in this PR
This PR addresses two CLI output defects exposed by the lifecycle output oracle: raw non-ASCII paths (#4330) and repeated uninstall messages (#4331).
Changes:
- Escapes non-ASCII text through the shared console and its Click fallback.
- Deduplicates uninstall progress messages and skips package directories already removed.
- Adds lifecycle regression coverage, removes corresponding oracle exemptions, and records the fixes.
| File | Description |
|---|---|
tests/utils/lifecycle_evidence.py |
Removes the two known-output exemptions. |
tests/integration/test_non_ascii_path_output_lifecycle.py |
Tests escaped paths across install, list, and uninstall. |
tests/integration/test_duplicate_declaration_lifecycle.py |
Checks that duplicate declarations produce each removal line once. |
tests/fixtures/lifecycle_bug_ledger.json |
Links both fixes to regression tests. |
src/apm_cli/utils/console.py |
Adds ASCII escaping for strings, rendered segments, and fallbacks. |
src/apm_cli/commands/uninstall/engine.py |
Deduplicates progress and avoids repeated directory removals. |
src/apm_cli/commands/uninstall/cli.py |
Deduplicates manifest-removal messages. |
CHANGELOG.md |
Documents both user-visible output fixes. |
Review effort: Balanced
#4331) The generator's evidence anchors move with the new _progress_once helper (engine.py) and the added import (cli.py); obligations regenerated. The unit test that passed a package twice now expects its 'found in apm.yml' line once, which is the #4331 fix. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Regenerate tests/quality/lifecycle_obligations.json on the merged tree. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Review: a Text cell bypasses render_str, so escaping it in the render-buffer pass widened its cell after measurement. The ASCII console's print now escapes Text (directly or inside a table, panel, padding, tree or group) before Rich measures it, keeping style spans (ascii_text splits at span boundaries). Narrow-table regression with ASCII and non-ASCII Text cells. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Main dropped the #4333 cell; this PR drops #4330 and #4331. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…install removal line once (#4330, #4331) Co-authored-by: Copilot App <[email protected]> # Conflicts: # tests/fixtures/lifecycle_bug_ledger.json # tests/lifecycle/generator/rules.py # tests/quality/lifecycle_obligations.json # tests/utils/lifecycle_evidence.py
5 of 10 tasks
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…xpects #4425's escaped output) Co-authored-by: Copilot App <[email protected]>
Collaborator
Author
|
Closing as superseded: this change shipped in v0.37.0 through the release train (#4424). Its core source and test files are byte-identical on main, and the linked issues are closed as completed in 0.37.0. The only remaining differences are in shared files that every train PR touches (CHANGELOG, bug ledger, owner registry). Nothing is left to land. -- regent, 0.37 milestone close-out |
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.

Description
Two 0.37 bug-sweep output defects found by the lifecycle output oracle (#4113).
[+] /tmp/x/pkg-über), which can raiseUnicodeEncodeErroron cp1252 terminals. Fixed at the console owner,src/apm_cli/utils/console.py: the one ASCII Rich console class (_ascii_console, used by_get_console,_get_stderr_consoleandnew_console) now escapes non-ASCII text withascii_safe()(\u00fc->\xfc). Escaping happens inrender_str, before layout, so table columns size the escaped text; the render-buffer pass escapes any pre-built renderable; the click fallback escapes too. Every status helper,CommandLogger, table and tree prints through this console.apm uninstallof a package declared more than once printed identical lines once per declaration (found in apm.yml, the dry-run plan,Removed <pkg> from dependencies.apm in apm.yml), and warnednot found in apm_modules/for the second declaration of a copy it had just removed. Each distinct removal line now prints once (_progress_onceincommands/uninstall/engine.py, used by the engine andcli.py), and an already removed path is skipped silently. Counts in the summary lines are unchanged.Strict cells flipped
command-echoes-non-ascii-path(apm install echoes a non-ASCII project path raw in its output #4330) -- removed fromtests/utils/lifecycle_evidence.pyuninstall-duplicate-declaration-lines(apm uninstall prints the same removal lines once per duplicate declaration #4331) -- removed fromtests/utils/lifecycle_evidence.pyIssue and approved scope
Fixes #4330 (scope record: #4330 (comment))
Fixes #4331 (scope record: #4331 (comment))
Remaining (follow-up, not in this PR): a few raw
click.echo/printcalls outside the console (Rich-unavailable fallbacks and legacy adapters) are not routed throughascii_safe; the global oracle covers every lifecycle-tested command.Type of change
Testing
Commands (host load ~0, sequential,
-n 0, single nodes):APM_BINARY_PATH=.venv/bin/apm uv run --extra dev pytest -n 0 tests/integration/test_non_ascii_path_output_lifecycle.py "tests/integration/test_duplicate_declaration_lifecycle.py::test_uninstall_removes_every_declaration_of_one_package"-- 2 passed; with main'ssrc/-- 2 failed (output above).ruff check/ruff format --check(uv.lock-pinned) on touched files -- passed.Changelog
## [Unreleased]inCHANGELOG.md.Spec conformance (OpenAPM v0.1)
No normative behavior changes.