Repository navigation
fix(outdated): report published registry versions beyond pins - #2874
Daniel Meppiel (danielmeppiel) merged 4 commits into
Conversation
Separate constraint-bound Wanted from published Latest without changing registry update resolution. Read legacy lockfiles through the canonical read-only owner and protect the route with behavioral and static regressions. Fixes #2871. Co-authored-by: Copilot App <[email protected]>
Fold the two remaining docs-sync findings for #2871 without changing update semantics. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is well-scoped to reporting semantics, includes architecture enforcement plus targeted unit/component/integration regressions, and only leaves minor output/doc clarity nits.
Review tier: Lite
Findings: 4
New issues introduced by this change (4)
| Severity | Finding |
|---|---|
docs/src/content/docs/reference/cli/outdated.md — The phrase "no manifest ... writes" is a bit ambiguous (it can read like the command doesn't read… |
|
packages/apm-guide/.apm/skills/apm-usage/commands.md — The description "no manifest ... writes" is ambiguous (it can be read as "doesn't read the… |
|
src/apm_cli/commands/outdated.py — In the plain-text fallback, the separator line is hard-coded to 82 dashes, but the header can be… |
|
src/apm_cli/commands/outdated.py — The summary message for unknown rows says "(branch/commit refs)", but Unknown can also come from… |
What changed in this PR
This PR fixes apm outdated for registry-backed deps so that reporting distinguishes Current (installed), constraint-bound Wanted, and highest published Latest, ensuring exact/equal pins don’t hide newer releases while keeping install/update constraint-respecting and making lockfile reads truly read-only (including legacy apm.lock).
Changes:
- Registry outdated: compute published
Latestindependently of constraint-boundWanted, and surface anoutside_constraintsignal whenLatestdoes not satisfy the manifest selector. - CLI output: render an optional
Wantedcolumn and keep meaningful rows visible even when Current equals Latest but a newer published version exists outside the constraint; read legacy lockfiles in place without migration. - Guard + tests + docs: extend the architecture linter to enforce the read-only lockfile owner route, add unit/component/integration regression tests, and update command reference docs.
| File | Description |
|---|---|
| src/apm_cli/deps/registry/outdated.py | Separates published Latest from constraint-bound Wanted and computes outside_constraint. |
| src/apm_cli/deps/outdated_row.py | Extends OutdatedRow with optional wanted and outside_constraint fields. |
| src/apm_cli/commands/outdated.py | Uses read-only lockfile resolution; renders optional Wanted column and outside-constraint messaging. |
| scripts/architecture_linter/checks/contracts_test_taxonomy.py | Enforces that outdated routes lockfile reads through resolve_lockfile_path_for_read(..., read_only=True). |
| tests/unit/registry/test_outdated.py | Adds unit regressions for Latest vs Wanted independence and semver precedence. |
| tests/unit/registry/test_outdated_reporting.py | Adds CLI-level reporting test ensuring no project writes and legacy lockfile read-in-place. |
| tests/unit/registry/test_resolver.py | Ensures resolver/download stays constraint-bound even when reporting shows a newer outside-constraint Latest. |
| tests/integration/test_architecture_pack_lockfile_read.py | Adds architecture mutation test preventing read-only owner bypass in outdated. |
| docs/src/content/docs/reference/cli/outdated.md | Updates the reference to define Current/Wanted/Latest and legacy lockfile read-in-place behavior. |
| docs/src/content/docs/reference/cli/update.md | Clarifies that update remains constraint-respecting even when outdated reports newer Latest. |
| packages/apm-guide/.apm/skills/apm-usage/commands.md | Updates the agent-facing command reference for the new outdated reporting semantics. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Docs sync advisoryVerdict: in_place * Pages affected: 2 * LLM calls: 8/15 The CLI reference and agent usage resource already cover Current, Wanted,
These surgical corrections were folded under the approved issue scope. No S7 evidence: actual The orchestrator corrected a malformed classifier response and an erroneous |
Address Copilot and panel follow-ups with a source-neutral unknown summary, a header-sized plain divider, explicit read-only docs and truthful verbose notes. Select Latest in one pass while preserving the last equal-precedence release. Defend output and semver tie behavior with regression and mutation-break evidence. Co-authored-by: Copilot App <[email protected]>
Address the Mode B CI finding with executed req-rs-011 coverage, not a waiver. Reuse the real resolver-after-discovery contract for exact/equal/caret selectors and assert the extracted archive version. A pin-bypass mutation fails all three cases. Regenerate conformance evidence without changing normative requirements. Co-authored-by: Copilot App <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| python-architect | 0 | 0 | 1 | Final head keeps a single reporting owner: outdated stays on the canonical read-only lockfile route, and req-rs-011 now reuses the existing resolver contract instead of adding a second path. |
| cli-logging-expert | 0 | 0 | 0 | Prior CLI logging findings are folded; no remaining output-UX concerns in the final diff. |
| devx-ux-expert | 0 | 0 | 0 | Prior DevX UX findings are fixed; outdated remains read-only and update remains constraint-bound across CLI, docs, and tests. |
| supply-chain-security-expert | 0 | 0 | 0 | No in-scope supply-chain regression: outdated stays read-only, Latest stays advisory, and req-rs-011 plus no-write guards passed on final head. |
| oss-growth-hacker | 0 | 0 | 0 | Final diff keeps the adoption story coherent: outdated is explicitly read-only, update stays constraint-respecting, and no README or growth surface was widened. |
| doc-writer | 0 | 1 | 0 | Final docs and PR-body evidence now match the exact head; stale-metadata finding folded. |
| test-coverage-expert | 0 | 0 | 0 | Executed registry/outdated scenario tests cover the Latest/Wanted split, read-only reporting path, and req-rs-011 archive-selection boundary. |
| performance-expert | 0 | 0 | 0 | Previous O(p log p) latest-selection nit is fixed; final diff keeps last-equal precedence in O(p)/O(1) and introduces no new performance concerns. |
Counts reflect final panel signals: the documentation recommendation was folded in PR metadata; the architecture nit is informational. No actionable findings remain.
Architecture
classDiagram
direction LR
class commands_outdated_py {
<<Module>>
+outdated(global_, verbose, parallel_checks)
+_check_deps_with_progress(...)
+_check_one_dep(...)
}
class registry_outdated_py {
<<Module>>
+load_registry_outdated_context(project_root, lockfile)
+check_registry_locked_dep(locked, ctx, client_factory, verbose)
+_highest_semver(version_strings)
}
class RegistryOutdatedContext {
<<ValueObject>>
+manifest_index dict[str, DependencyReference]
+registries dict[str, str]
+default_registry str | None
}
class OutdatedRow {
<<ValueObject>>
+package str
+current str
+wanted str | None
+latest str
+outside_constraint bool
+source str
+status str
}
class RegistryPackageResolver {
+download_package(dep, target)
}
class DependencyReference {
<<ValueObject>>
+reference str
+source str
+registry_name str | None
+get_unique_key()
}
class TestHappyPath {
<<TestHarness>>
+test_refresh_keeps_constraint_even_when_outdated_reports_newer(...)
}
class test_resolution_reqs_py {
<<Module>>
+test_registry_refresh_preserves_constraint_after_outdated(...)
}
commands_outdated_py ..> registry_outdated_py : delegates registry rows
registry_outdated_py --> RegistryOutdatedContext : builds
registry_outdated_py --> OutdatedRow : returns
registry_outdated_py ..> DependencyReference : reads selector
TestHappyPath ..> registry_outdated_py : asserts Wanted vs Latest split
TestHappyPath ..> RegistryPackageResolver : proves install stays constraint bound
test_resolution_reqs_py ..> TestHappyPath : reuses contract
note for registry_outdated_py "Single report owner:
Wanted via pick_best,
Latest via _highest_semver"
note for test_resolution_reqs_py "Conformance binds the existing resolver contract,
not a second implementation path"
class commands_outdated_py:::touched
class registry_outdated_py:::touched
class RegistryOutdatedContext:::touched
class OutdatedRow:::touched
class TestHappyPath:::touched
class test_resolution_reqs_py:::touched
classDef touched fill:#fff3b0,stroke:#d47600
flowchart TD
cli["CLI entry: apm outdated"] --> cmd["src/apm_cli/commands/outdated.py::outdated()"]
cmd --> lockpath["[I/O] resolve_lockfile_path_for_read(project_root, read_only=True)"]
lockpath --> lockread["[I/O] LockFile.read(lockfile_path)"]
lockread -->|no lockfile| exit1["exit 1 after CommandLogger.error(No lockfile found ...)"]
lockread -->|deps loaded| ctx["src/apm_cli/deps/registry/outdated.py::load_registry_outdated_context()"]
ctx --> rows["src/apm_cli/commands/outdated.py::_check_deps_with_progress()"]
rows --> one["src/apm_cli/commands/outdated.py::_check_one_dep()"]
one -->|dep.source == registry| reg["src/apm_cli/deps/registry/outdated.py::check_registry_locked_dep()"]
reg --> versions["[NET] RegistryClient.list_versions(owner, repo)"]
versions --> latest["_highest_semver(version_strings) -> Latest"]
versions --> wanted["pick_best(manifest_range, version_strings) -> Wanted"]
latest --> outside["match_version(manifest_range, Latest) -> outside_constraint"]
wanted --> row["OutdatedRow(current, wanted, latest, outside_constraint)"]
outside --> row
row --> render["render Current / Wanted / Latest in outdated()"]
render --> exit0["exit 0 with CommandLogger.warning(...) or CommandLogger.progress(...)"]
spec["pytest tests/spec_conformance/test_resolution_reqs.py::test_registry_refresh_preserves_constraint_after_outdated"] --> bind["tests/spec_conformance/test_resolution_reqs.py::test_registry_refresh_preserves_constraint_after_outdated()"]
bind --> reuse["tests/unit/registry/test_resolver.py::TestHappyPath.test_refresh_keeps_constraint_even_when_outdated_reports_newer()"]
reuse --> reg
reuse --> dl["[NET] RegistryPackageResolver.download_package(dep, target)"]
dl --> archive["[NET] RegistryClient.download_archive(owner, repo, expected)"]
archive --> manifest["[I/O] load_yaml(tmp_path / package / apm.yml)"]
manifest --> assertv["assert installed_manifest version == expected"]
Recommendation
Ship for maintainer review. The final CEO stance is ship_now; all observed checks are green. No automatic merge is performed.
Reservations carried from strategic-alignment
- apm outdated must remain strictly read-only: report drift only, install/write nothing.
- apm update may install/write as before; it stays constraint-respecting but is NOT made read-only.
- Preserve outdated output format/compatibility; no changes to defaults, policy, force, or upgrade semantics.
- Land with tests covering outdated read-only behavior plus docs updated to match.
Folded in this run
- (copilot) Explicit read-only non-modification guarantee in CLI reference. --
f733d77d7. - (copilot) Mirror non-modification guarantee in agent command resource. --
f733d77d7. - (copilot) Derive plain divider from header and assert the rendered width. --
f733d77d7. - (copilot) Source-neutral unknown summary defended by no-matching-constraint CLI cases. --
f733d77d7. - (panel) Clarify that verbose lockfile-only registry rows list newer published versions. --
f733d77d7. - (panel) Select Latest in O(n) time/O(1) extra space, preserving last equal-precedence entry. --
f733d77d7. - (panel) Refresh live PR body with final head, current evidence and narrowly scoped conformance claim; metadata-only fold at the cited head. --
9988006d7.
Copilot signals reviewed
docs/src/content/docs/reference/cli/outdated.md:8-- LEGIT: Explicit non-modification wording makes the approved read-only contract unambiguous. Resolved inf733d77d7; inline thread answered and resolved.packages/apm-guide/.apm/skills/apm-usage/commands.md:32-- LEGIT: Mirror the explicit read-only guarantee in the agent command resource. Resolved inf733d77d7; inline thread answered and resolved.src/apm_cli/commands/outdated.py:610-- LEGIT: The optional Wanted column changes header width; derive the fallback divider from the rendered header. Resolved inf733d77d7; inline thread answered and resolved.src/apm_cli/commands/outdated.py:628-- LEGIT: Unknown registry rows are not branch/commit failures; use the source-neutral summary. Resolved inf733d77d7; inline thread answered and resolved.
No deferred findings. Copilot round 2 returned zero new comments.
Regression-trap evidence
TestCheckRegistryLockedDep::test_published_latest_is_independent_of_wanted-- Published Latest replaced by constraint-bound Wanted: 4 failures; mutation-latest.log.test_exact_registry_pin_reports_latest_without_writes and contracts-tooling-lockfile-read-- read_only=True changed to False: 6 legacy behavioral failures plus architecture boundary rejection; mutation-readonly.log and mutation-static.log.test_exact_registry_pin_reports_latest_without_writes-- Header-sized divider and source-neutral summary reverted: 20 failures; driver-mutation.log.test_highest_semver_preserves_last_equal_precedence-- Last-tie replacement changed to strictly-greater selection: 2 new tests plus existing precedence case failed; driver-mutation.log.tests/spec_conformance/test_resolution_reqs.py::test_registry_refresh_preserves_constraint_after_outdated-- Resolver pick_best(spec, versions) changed to pick_best('*', versions): all 3 cases failed; restored before final validation; driver-conformance-mutation.log.
Lint contract
Full canonical mirror exit 0 at 9988006, including Ruff check/format with no diagnostics, pylint R0801, YAML I/O, 2100-line, portable-path, auth and architecture boundaries; driver-final-lint.log.
Functional suites at the exact head: 717 passed, 2 xfailed; spec conformance: 200 passed, 2 skipped. Orphan check aligns 121 requirements, Mode B passes without waiver, regenerated statements are clean.
CI
18 checks successful/neutral/skipped at 9988006. CI: https://github.com/microsoft/apm/actions/runs/34110673609 ; Spec: https://github.com/microsoft/apm/actions/runs/34110673706 . One recovery: Mode B on f733d77 resolved by real existing req-rs-011 coverage in 9988006 plus regenerated CONFORMANCE artifacts; no waiver or normative spec change.
Mergeability status
| PR | head SHA | CEO stance | iters | folds | defers | Copilot rounds | CI | mergeable | mergeStateStatus | notes |
|---|---|---|---|---|---|---|---|---|---|---|
| #2874 | 9988006 |
ship_now | 2 | 7 | 0 | 2 | green | MERGEABLE | BLOCKED | pending required review |
Convergence
2 outer iterations; 2 Copilot rounds; 1 CI recovery. Ready for maintainer review.
Full per-persona findings
python-architect
Informational nit: no remaining architectural issue; canonical owner routing and conformance reuse are preserved. The data carriers are value objects; OutdatedRow is not claimed frozen.
cli-logging-expert
No findings.
devx-ux-expert
No findings.
supply-chain-security-expert
No findings.
oss-growth-hacker
No findings.
auth-expert
Touched files are outdated reporting, lockfile-read routing, docs, and tests only (src/apm_cli/commands/outdated.py, src/apm_cli/deps/outdated_row.py, src/apm_cli/deps/registry/outdated.py, docs/src/content/docs/reference/cli/outdated.md, docs/src/content/docs/reference/cli/update.md, docs/src/content/docs/enterprise/drift-detection.md, docs/src/content/docs/guides/operating-installed-context.md, packages/apm-guide/.apm/skills/apm-usage/commands.md, scripts/architecture_linter/checks/contracts_test_taxonomy.py, and the registry/lockfile/spec coverage tests); the only auth-adjacent hunk is a test-only patch of make_auth_context/AuthResolver in tests/unit/registry/test_outdated_reporting.py, so no AuthResolver logic, token selection, credential fallback, or host auth behavior changed.
doc-writer
- [recommended] The PR body validation metadata still points at a pre-final head and older test totals.
The actual PR head is 9988006, but the live PR body still saysFinal fix head: 963c657ab46650e9672b6cb543b7d83c6c8a9c6cand keeps the earlier704 passed, 2 xfailedvalidation snapshot. After the final conformance and docs fold, that block no longer matches the artifact set the reviewer is being asked to approve, so the body stops being a trustworthy summary of the final diff.
Resolved after this return: live PR body now names the exact final head and current executed totals.
test-coverage-expert
No findings.
performance-expert
No findings.
This panel is advisory. The maintainer decides whether and when to merge.
Stay current with main (microsoft#2872, microsoft#2873, microsoft#2874). Co-authored-by: Cursor <[email protected]>

fix(outdated): report published registry versions beyond pins
TL;DR
Registry
apm outdatednow distinguishes installed Current, constraint-bound Wanted, and highest published Latest. A satisfied exact pin no longer hides a newer release.apm updateremains writable and constraint-respecting;outdatedreads legacy lockfiles without migrating them.Closes #2871.
Important
Reporting an outside-constraint release does not authorize installing it. No save-prefix/default-pin, required-selector, policy, install-default, or
--forcechanges; no upgrade or pin-bypass flag. The broader workflow remains #1962.Problem (WHY)
1.7.0locked and pinned, a registry publishing1.8.0previously producedAll dependencies are up-to-date: the checker used its constraint-bound candidate aslatest.apm.lockdespite its read-only description.The approved decision states: "An exact pin should constrain installation, not hide available versions."
The implementation follows the Agent Skills validation loop: "do the work, run a validator (a script, a reference checklist, or a self-check), fix any issues, and repeat until validation passes." Fail-before and mutation results below demonstrate the distinction.
Approach (WHAT)
(outside constraint)With
1.7.0,1.8.0, and2.0.0published:1.7.0or=1.7.0^1.7.0>=1.7.0 <1.8.0All identify Latest as outside the constraint.
Implementation (HOW)
src/apm_cli/deps/registry/outdated.py_highest_semversupplies Latest, preserving the last equal-precedence entry; existingpick_bestandmatch_versionsupply Wanted and the outside-constraint factsrc/apm_cli/deps/outdated_row.pywantedandoutside_constraint; preserve existing positional fieldssrc/apm_cli/commands/outdated.pyscripts/architecture_linter/checks/contracts_test_taxonomy.pycontracts-tooling-lockfile-readto requireoutdatedto useread_only=Truetests/unit/registry/test_outdated.pytests/unit/registry/test_outdated_reporting.pytests/unit/registry/test_resolver.pytests/integration/test_architecture_pack_lockfile_read.pytests/spec_conformance/test_resolution_reqs.pyreq-rs-011; assert extracted manifest versionCONFORMANCE.json,CONFORMANCE.mddocs/src/content/docs/reference/cli/outdated.md,update.mdpackages/apm-guide/.apm/skills/apm-usage/commands.mddocs/src/content/docs/guides/operating-installed-context.md,enterprise/drift-detection.mdRegistry reporting owner: no new resolver or semver grammar.
Architecture: owner-extension, with behavioral and registered static guards for routing through the canonical read-only lockfile owner. The deterministic detector reports no directly touched owner implementation selectors; this does not exempt the changed consumer route from its guards.
No CHANGELOG, README, specification prose/version, requirement-manifest, or waiver changes.
Diagram
Dashed nodes show changed reporting; install/update independently consume the manifest constraint.
flowchart LR subgraph Input[Read only] L["Lockfile Current"] V["Registry list_versions"] M["Manifest constraint"] end subgraph Report[Registry outdated] W["pick_best: Wanted"] P["_highest_semver: Latest"] R["OutdatedRow"] end subgraph Consumers[Consumers] T["Current / Wanted / Latest table"] U["RegistryPackageResolver: constraint-bound install and update"] end M --> W V --> W V --> P L --> R W --> R P --> R R --> T M --> U V --> U classDef new stroke-dasharray: 5 5; class P,R,T new;Trade-offs
latestintentionally changes meaning;wantedretains the prior constraint-bound value. No top-leveloutdated --jsonor package-filter interface exists to change.unknown; unavailable Wanted never becomes false success.-. Verbose rows list matching versions when a constraint is known, or newer published versions for lockfile-only dependencies.req-rs-011cases cover its constraint-selection clause, not the entire update operation.Benefits
Validation
Final head:
9988006d73d6d735bac96e54aa79b58b9f98e833; base:8c2e0d9c352e2ed0e8c56b40063a63e1dd4a1937.origin/mainfetched/merged before each push. These are executed local results; the live GitHub checks are authoritative for CI status.Executed evidence
Targeted registry, outdated, update, ownership and lockfile suites:
Full spec conformance, after binding existing
req-rs-011to the real resolver contract:Regenerated
CONFORMANCE.jsonandCONFORMANCE.mdmatch the committed files. No waiver was used.Full canonical Ruff check/format (including architecture scripts), pylint R0801, auth and architecture boundaries, YAML I/O, portable-path and 2100-line guards passed. Assertion-quality and exact-duplicate ratchets passed (1209 files, no allowed duplicate groups). The unchanged diagram was validated with
mmdc.Every mutation was restored before final-head validation. Docs-sync reports
in_place_resolved; the earlier advisory remains the single documentation comment.Scenario Evidence
tests/unit/registry/test_outdated.py::TestCheckRegistryLockedDep::test_published_latest_is_independent_of_wantedtests/unit/registry/test_outdated_reporting.py::test_exact_registry_pin_reports_latest_without_writestests/spec_conformance/test_resolution_reqs.py::test_registry_refresh_preserves_constraint_after_outdated, reusing the real resolver regressiontest_no_matching_wanted_remains_unknownand the CLI reporting matrix abovetests/integration/test_architecture_pack_lockfile_read.py::test_outdated_cannot_bypass_read_only_lockfile_ownertests/unit/registry/test_outdated.py::test_highest_semver_preserves_last_equal_precedenceHow to test
uv run --frozen --extra dev pytest tests/unit/registry/test_outdated.py tests/unit/registry/test_outdated_reporting.py tests/unit/registry/test_resolver.py tests/integration/test_architecture_pack_lockfile_read.py tests/spec_conformance/test_resolution_reqs.py; expect all pass.1.7.0and1.8.0, installorg/pkg#1.7.0, then runapm outdated; expect Current/Wanted1.7.0, Latest1.8.0,(outside constraint).apm update --yes; exact pin remains1.7.0. Repeat with=1.7.0.org/pkg#^1.7.0; Wanted tracks highest matching 1.x while Latest can show published 2.x.apm outdated; expect no changes, including no legacyapm.lockrename.Co-authored-by: Copilot App [email protected]