Skip to content

feat(core): add the shared adapter registry and extension-point contracts - #341

Merged
lanyue-llk merged 1 commit into
mainfrom
refactor/interfaces
Nov 24, 2026
Merged

lanyue-llk merged 1 commit into
mainfrom
refactor/interfaces

Conversation

@lanyue-llk

Copy link
Copy Markdown
Contributor

Purpose

Add src/harness/adapters.py, the shared vocabulary that the track migrations (#318, #338, #316) build on. Each track keeps its own call signature, because a fetch, a search, an extraction and a browser episode return different things; this module defines only what every track shares.

flowchart LR
    R["Registry[T]<br/>one per extension point"] --> M["MethodAdapter<br/>name, capabilities,<br/>identity, validate"]
    R --> B["BenchmarkAdapter<br/>cases, inputs, score,<br/>populations"]
    R --> T["TrackStages<br/>run · score · report · check ·<br/>package · publish · export"]
    M -. "track adds" .-> MC["fetch / search / extract / episode"]
Loading

Decisions

  • One generic Registry type for methods, benchmarks and tracks. Command choices, validation sets and contract tests derive from names(); a second hardcoded name list is not allowed.
  • Capabilities is how shared code branches: declared flags and values, never instance names.
  • MethodAdapter and BenchmarkAdapter are Protocols, so existing classes (Web Fetch Provider, Web Search Adapter, Web Extract benchmark modules) conform by adding methods rather than by changing base classes.
  • TrackStages fixes the seven stage verbs; extra preparation commands cannot shadow a fixed verb.

No caller changes in this PR; the migrations adopt it track by track.

Verification

uv run --frozen --extra test python -m pytest tests/test_adapters.py (5 passed), ruff check and ruff format --check clean.

Part of #318 and #338.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Review complete · aa7f2ee

No findings in this review.

@lanyue-llk
lanyue-llk merged commit 6568cd6 into main Nov 24, 2026
8 checks passed
@lanyue-llk
lanyue-llk deleted the refactor/interfaces branch November 24, 2026 05:15
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.

1 participant