Skip to content

refactor(pydantic-ai)!: Require entering the selector extractor before extract() - #2448

Draft
Mantisus wants to merge 3 commits into
apify:v2from
Mantisus:selector-extractor-lifecycle
Draft

Mantisus wants to merge 3 commits into
apify:v2from
Mantisus:selector-extractor-lifecycle

Conversation

@Mantisus

Copy link
Copy Markdown
Collaborator

Description

  • PydanticAiSelectorExtractor loads its selector cache when it's entered with async with and saves it when it's exited. extract() raises a RuntimeError on an extractor that isn't entered.
  • It enters and exits its fallback together with itself. A failed or cancelled entry exits whatever it already entered.
  • A fallback that several selector extractors use one after another counts its usage into the extractor that is using it.

Issues

Testing

  • Unit tests for entering and exiting the selector extractor and its fallback chain, failures at each step, and a fallback used by several extractors.

✍️ Drafted by Claude Code

@Mantisus
Mantisus marked this pull request as draft November 15, 2026 00:40
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Nov 15, 2026
@Mantisus Mantisus self-assigned this Nov 15, 2026
@Mantisus
Mantisus force-pushed the selector-extractor-lifecycle branch from f788375 to 4a18870 Compare November 15, 2026 22:35

This branch has not been deployed

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

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant