Skip to content

fix(outdated): key the per-run ref listing on host type and provider (#4560) - #4622

Merged
Daniel Meppiel (danielmeppiel) merged 3 commits into
mainfrom
danielmeppiel-p1-4560-outdated-cache-key
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 3 commits into
mainfrom
danielmeppiel-p1-4560-outdated-cache-key

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Cache-key correctness for apm outdated. The per-run git ls-remote dedup in src/apm_cli/deps/outdated_ref_cache.py keyed listings on host, repo URL, port, insecure flag and ref family only. Its key (_identity_key) now also includes the manifest host_type and the provider the host resolves to through classify_host_provider (provider kind and credential purpose). Two dependencies on the same host and path with a different provider therefore never share a cached listing, and each runs its own provider and credential resolution. Identical dependencies still share one listing. The cache stays per-run and token-free; the module docstring states the full key. An unclassifiable host/type pair keeps its own bucket so the wrapped downloader reports its error exactly as without the cache.

Issue and approved scope

Issue: Fixes #4560

Human scope-approval comment: #4560 (comment)

Does this PR complete the issue, or what remains? Completes it. Install-path ref reuse (install/helpers/ref_reuse) was not changed (out of scope).

Dependency order: none (independent of open PRs).

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally

  • All existing tests pass

  • Added tests for new functionality (if applicable)

  • tests/unit/deps/test_outdated_ref_cache.py::test_same_host_and_path_with_another_provider_gets_its_own_listing: same host and path, host_type unset vs gitlab: different keys, the wrapped downloader is called once for each, and each gets its own listing. Fails on main (1 failed).

  • test_identical_typed_deps_still_share_one_listing: dedup control, one call for two identical typed deps.

  • pytest -q tests/unit/deps/test_outdated_ref_cache.py -> all passed (existing outdated cache tests green).

  • uvx [email protected] check/format, scripts/lint_architecture_boundaries.py --root ., complexity ratchet vs main, tests.quality.taxonomy --changed, scripts/check_test_assertions.py -> clean.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md:
    user-visible effect first, 25 words or fewer, ending with (#PR);
    breaking changes only under upgrade notes; no Highlights; see
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • N/A -- this PR does not change OpenAPM-observable behaviour.

apm-spec-waiver: apm outdated cache-key correctness only; no OpenAPM-observable behaviour change

…4560)

The apm outdated ls-remote cache key now includes the manifest host_type
and the provider the host resolves to (classify_host_provider: kind and
credential purpose), so two dependencies on the same host and path with a
different provider never share a cached listing and each runs its own
provider and credential resolution. The cache stays per-run and token-free.

Co-authored-by: Copilot App <[email protected]>

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 cache duplicates the canonical provider-identity projection, risking divergence from future identity changes, and needs delegation plus regression and static-guard coverage.

1 open issue
What changed in this PR

Fixes #4560 by separating apm outdated ref-cache entries for dependencies with different host types or resolved providers, while preserving per-run deduplication for identical dependencies.

Changes:

  • Adds host type and resolved provider identity to the token-free cache key.
  • Adds regression tests for provider isolation and identical-dependency reuse.
  • Documents the user-visible fix in the changelog.
File Description
tests/​unit/​deps/​test_outdated_ref_cache.py Tests separate provider listings and continued deduplication.
src/​apm_cli/​deps/​outdated_ref_cache.py Extends cache identity and handles unclassifiable providers.
CHANGELOG.md Records the corrected ref-listing isolation.

Review effort: Balanced

Comment thread src/apm_cli/deps/outdated_ref_cache.py Resolved
apm-spec-waiver: apm outdated cache-key correctness only; no OpenAPM-observable behaviour change

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) force-pushed the danielmeppiel-p1-4560-outdated-cache-key branch from 6a6c47b to e35dd0e Compare November 21, 2026 13:11
…4560)

Delegate the cache key's provider identity to
core/host_providers.effective_host_provider_identity (keeping the
ValueError fallback), register the cache as a consumer of the
host-credential-resolution owner and extend its static guard.

apm-spec-waiver: apm outdated cache-key correctness only; no OpenAPM-observable behaviour change

Co-authored-by: Copilot App <[email protected]>
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.

Per-invocation remote-ref cache key omits host_type, mixing authentication contexts

2 participants