Skip to content

Remove dead cache-server fallback from BootstrapRequirementResolver #1297

Description

@LalatenduMohanty

Problem

PR #1289 introduced AgeFallback.NEWEST for multi-version mode, which always returns at least one candidate. This made the cache-server fallback in BootstrapRequirementResolver._resolve_and_extend() unreachable dead code.

The dead fallback creates a misleading picture — it looks like multi-version resolution has a three-layer fallback chain when it actually has one.

Why it's dead code

AgeFallback.NEWEST takes candidates_list[0], and candidates_list is always non-empty because BaseProvider.find_matches() raises on empty. So find_all_matching_from_provider() never returns [] in multi-version mode, and this block never executes:

if not results and self.multiple_versions and self.cache_wheel_server_url:
    results = self._resolve_from_cache_server(req)

Before #1289, multi-version mode used the equivalent of AgeFallback.NONE (returned [] when all candidates were too old), so the cache fallback was reachable. NEWEST replaced that role.

What to remove

src/fromager/bootstrap_requirement_resolver.py

  • cache_wheel_server_url parameter and attribute from __init__
  • The dead fallback block in _resolve_and_extend()
  • The entire _resolve_from_cache_server() method
  • The finders import (only used by that method)
  • Simplify the warning log to drop the cache_wheel_server_url reference

src/fromager/bootstrapper/_bootstrapper.py

  • Remove cache_wheel_server_url=... from the BootstrapRequirementResolver() call

tests/test_bootstrap_requirement_resolver.py

What to leave alone

  • Bootstrapper.cache_wheel_server_url — still used by _cache.py, _prepare_source.py, _resolve.py
  • Error handling in _handle_phase_error — inherent to multi-version mode
  • AgeFallback enum and find_all_matching_from_provider — no changes needed

Follows up on #1289.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions