Skip to content

Web Extract: replace per-method chains with adapter objects #320

Done

Description

@lanyue-llk

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

Problem

Shared Extract code branches on method and engine names (about 23 provider conditionals in pipeline.py, 13 engine conditionals in self_hosted.py).

  • web_extract/pipeline.py:1169-1225: normalize is an elif method == chain.
  • pipeline.py:1114-1153: provider_call branches for firecrawl-parse-json, zyte-custom, browserbase-json.
  • pipeline.py:606-620, 693, 709, 752-780: method names inside request builders.
  • self_hosted.py:211-215, 274, 552-557, 646-652: engine dispatch.
  • Local copies of shared helpers: read_json, save_json, digest (pipeline.py:97-135) beside record_io.py.

Direction

Each METHODS entry becomes an adapter carrying its request, normalisation and post-call behaviour under the shared method protocol. Self-hosted engines get a registry of extract, identity and failure functions. Use record_io helpers.

Done when

  • normalize, provider_call and self_hosted.py contain no method or engine names.
  • Adding an Extract method adds one adapter and its data.

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

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