Skip to content

Web Fetch: move per-provider projection and routing into adapters #319

Done

Description

@lanyue-llk

Part of the convergence on the repository specification (#313). Rules: 1, 7, 10. Size: L.

Problem

Adding a provider edits shared modules. Commit 9f6862e44 (Kimi, Z.AI, remote Claude) changed native_projection.py (+43, a new if provider_type in {...} branch at :206-209), native_routes.py:522 (a hardcoded frozenset), the shared providers/hosted_fetch.py, failure_diagnosis.py and a hardcoded test tuple, besides the registry and data files.

  • web_fetch/native_projection.py:105-343 is one function with an if-chain over every provider type (33 provider_type references).
  • web_fetch/native_routes.py:522,538,552,587,604 list or special-case provider types.
  • web_fetch/providers/hosted_fetch.py:108-212 serves seven vendors through 35 self.type branches.
  • Engine names appear in task_outputs.py:179-311, network_preflight.py:11,74,78, assembly.py:634, refresh_assembly.py:77 and comparison_audit.py:170,312.

Direction

Each adapter declares its projection, malformed-envelope policy and network or extractor capabilities; shared code dispatches through the registry. Split the hosted adapter into a declarative vendor description or small subclasses. The projection policy source is hash-frozen (native_projection.py:88-92), so keep historical policy versions readable as data.

Done when

  • Adding a hosted fetch vendor touches one adapter module, its registry entry and data files.
  • native_projection.py, native_routes.py and the other shared modules name no provider or engine.
  • Saved projections from earlier policy versions still verify.

Paths are relative to src/harness/ unless prefixed; line numbers are from main at 997a228.

Activity

  1. added
    refactor
    on Nov 24, 2026
  2. lanyue-llk commented on Nov 24, 2026

    @lanyue-llk
    ContributorAuthor

    Leftovers after #349 (instance names in Web Fetch shared modules): task_outputs.py (headless engine names), network_preflight.py (retired provider types), assembly.py / refresh_assembly.py (records matched by configured provider name), comparison_audit.py (Moli-only audit), failure_diagnosis.py (vendor error text), vendor request shapes in normalized_http_parameters. The instance-literal scan does not yet cover Web Fetch shared modules (would list ~56 entries).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactor

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions