fix(deps): preserve local identity display boundaries#2174
Merged
danielmeppiel merged 1 commit intoJul 12, 2026
Conversation
Derive absolute local dependency labels from cross-platform basenames and redact physical hash slots only after confirming they are orphaned. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 425fcf34-8659-4f23-a91e-a5a590208239
Collaborator
Author
Docs sync advisoryVerdict: no_change * Pages affected: 0 * LLM calls: 1/15 * Took: 2s No documentation impact detected. The PR changes only internal rendering of existing |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens the user-facing apm deps list/tree display boundary for local and local-looking identities by (1) rendering absolute local paths as a portable _local/<basename> label even when parsed cross-platform, and (2) only applying _local/<12hex>/... hash-slot redaction when a package is actually confirmed orphaned.
Changes:
- Add
_absolute_local_display()and use it in_dep_display_name()so absolute local paths (POSIX,~, Windows drive/UNC) display as_local/<basename>rather than leaking host-specific path structure. - Reorder orphan detection in
_resolve_scope_deps()so hash-slot redaction is applied only after orphan status is determined. - Add regression tests covering Windows absolute local parsing on non-Windows hosts and ensuring a declared “remote” identity shaped like a hash slot is not shortened.
Show a summary per file
| File | Description |
|---|---|
src/apm_cli/commands/deps/cli.py |
Adds portable absolute-local display helper and gates hash-slot redaction on confirmed orphan status. |
tests/unit/commands/test_deps_cli_helpers.py |
Adds unit regression tests for cross-platform Windows absolute path rendering and non-redaction of declared hash-shaped identities. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Low
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.
fix(deps): preserve local identity display boundaries
TL;DR
This follow-up closes two display edge cases found after #2173 merged: Windows absolute local paths parsed on a POSIX host could still reach
deps tree, and a declared remote identity shaped like a local hash slot could be shortened incorrectly. The patch derives absolute-local labels from the declared path's cross-platform basename and limits hash redaction to confirmed orphan slots.Important
This is a narrow release-recovery follow-up on top of merged PR #2173; it does not change local dependency storage, resolution, or lockfile identity.
Problem (WHY)
DependencyReference.parse(r"C:\Users\alice\pkg")toLockedDependencyflow rendered_local/C:\Users\alice\pkg@lateston POSIX instead of_local/pkg@latest._logical_local_display()ran before orphan status was known, so a declared remote identity such as_local/abcdef123456/pkgwas displayed as_local/pkg.apm deps list/treeoutput added in fix(deps): render logical local dep keys in deps list/tree; refresh stale v0.25.0 release tests #2173, so they must preserve logical identity without exposing host-specific paths.The two regression tests were added first and failed with the exact outputs above. That keeps the follow-up grounded in "deterministic tool execution transforms probabilistic generation into verifiable action".
Approach (WHAT)
_local/<basename>withPureWindowsPathorPurePosixPath; keep relative paths and missing-path fallbacks unchanged._local/<12-hex>/only for confirmed unmapped orphan slots; preserve declared remote identities byte-for-byte.Implementation (HOW)
src/apm_cli/commands/deps/cli.py- adds a small absolute-local display helper and moves the orphan predicate ahead of display-name selection. Physical identity remains the authority for orphan detection; only the rendered orphan label is sanitized.tests/unit/commands/test_deps_cli_helpers.py- adds a parser-to-lock-to-display Windows regression and a real lockfile/filesystem case proving that a declared remote hash-shaped identity is neither orphaned nor shortened.Diagrams
Legend: the dashed nodes are the two rendering decisions introduced by this follow-up; storage and lockfile identity stay unchanged.
flowchart LR subgraph Inputs[Inputs] L[Locked dependency] S[Scanned package identity] end subgraph Decide[Decide] A{Absolute local path} O{Confirmed orphan} end subgraph Render[Render] B["_local/basename"]:::new K[Declared logical identity] H["Hash-free orphan name"]:::new end L --> A A -->|yes| B A -->|no| K S --> O O -->|yes| H O -->|no| K classDef new stroke-dasharray: 5 5;Trade-offs
Benefits
_local/pkg, on POSIX and Windows hosts._local/<12-hex>/pkgretains all three path segments and remains non-orphaned.Validation
uv run --extra dev pytest -q tests/unit/commands/test_deps_cli_helpers.py:APM_RUN_INTEGRATION_TESTS=1 APM_E2E_TESTS=1 uv run --extra dev pytest -q tests/integration/test_transitive_chain_e2e.py:Broader command and lint evidence
uv run --extra dev pytest -q tests/unit/commands -k deps:CI lint mirror:
Scenario Evidence
apm deps treenever prints a Windows host path when a local dependency was parsed on POSIXtests/unit/commands/test_deps_cli_helpers.py::TestDepDisplayNameLocal::test_parsed_windows_absolute_path_renders_cross_platform_logical_name(regression trap for #2173 follow-up)tests/unit/commands/test_deps_cli_helpers.py::TestResolveScopeDepsOrphanHashSlot::test_declared_remote_hash_shaped_identity_is_not_redacted(regression trap for #2173 follow-up)tests/integration/test_transitive_chain_e2e.py::test_deps_commands_follow_full_lock_graph_and_ignore_embedded_manifestsHow to test
apm deps listandapm deps treefor a transitive local chain; expect nolocal:/, absolute host path, or_local/<12-hex>/orphan hash in user-facing output.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com