Copy of .claude/rules/ats-extractor-delta.md from aetherion-autoapply
Generated from aetherion-autoapply/.claude/rules/ats-extractor-delta.md at commit 89a92b10. Edit the source file, not this copy.
paths: - "src/aetherion_web/automation/extract/" - "backend/tests/fixtures/extract/" - "backend/tests/test_extract_*.py"
Per-ATS extractor deltas¶
A delta is a thin subclass of GenericExtractor (automation/extract/base.py). It only
corrects what the shared scan (dom_scan.js) and normalizer (normalizer.py) get wrong on
one ATS. It is never a rewrite. greenhouse.py, lever.py and ashby.py are the
reference examples.
When to add one¶
- Only for a high-volume ATS where the generic extractor gets a real captured fixture
wrong. The tail stays on generic extraction, then the LLM, then park (return
Noneand the bidder finishes by hand). - First check whether shared code should change instead. If the problem isn't specific to
one ATS (a label pattern, a required marker, a common widget), fix
dom_scan.jsornormalizer.pyand regenerate every golden.
Structure: one file, automation/extract/<ats>.py, aim for < 150 lines¶
"""<ATS> delta.
- matches: <hosts>
- prepare: <how the form is reached>
- scan_config / patch_raw: <one line per quirk, naming the widget>
"""
from .base import GenericExtractor, Log, Question, ScanConfig, settle
class <Ats>Extractor(GenericExtractor):
name = "<ats>" # lowercase; equals the fixture folder name
def matches(self, url: str) -> bool: ... # required. Host regex, no I/O. The
# registry also tries frame URLs.
async def prepare(self, page, log) -> Frame: ... # reach the form, return its frame
def scan_config(self) -> ScanConfig: ... # declarative tuning (preferred)
async def patch_raw(self, frame, records, log): ... # widgets that need the live page
def patch_fields(self, fields): ... # post-normalize fixups (rare)
detect_state if you must. __init_subclass__
rejects a class that overrides extract(). Never call normalize() yourself, and never
bypass registry.extract_inventory.
- Leave out the hooks you don't need. Prefer ScanConfig (root, ignore, questions,
choice_groups, type_overrides) over code. Lever is config only. Use patch_raw
only when the page must be driven, e.g. Greenhouse opens each React-select menu to read
its options. Patch records by sid ([data-aeth-sid="…"]).
- Emit only the canonical schema (schema.py). A new key or field type is a schema
change: update schema.py and validate(), then regenerate all goldens, in one change.
- No per-ATS JavaScript files. If ScanConfig can't express something, add a generic
option to dom_scan.js and ScanConfig.
- Selectors: use stable hooks such as name, id, data-*, ARIA roles, the vendor's
public class prefixes (ashby-application-form-*, React-select's select__*) and
structure. Never use hashed CSS-module classes (_label_1e3gg_42, remix-css-*).
- prepare must be idempotent: running extraction twice on the same page gives the same
output (the conformance suite checks this). Report progress through log. Never
fill, submit or log in.
- Interactions in patch_raw must leave the page as they found it: close menus, scroll
back. Bail out after the first widget that doesn't respond (static snapshots have no JS).
- Bidders watch the live view, so keep extraction to a few seconds.
Fixtures and conformance¶
- Capture ≥1 real posting:
uv run python -m aetherion_web.automation.extract.capture <url> <name> --ats <ats>. If the site shows a bot check to headless browsers, save the page from a real browser and add--from-html saved.html. - Add hand-written fixtures for live widget behaviour (a minimal inline script with the
same DOM contract, as in
greenhouse/react_select.html) and for embedding, with iframes mapped in the meta'sroutes. - Add the class to
registry._register()(specific matchers before broad ones). - Review every
<name>.expected.jsonby hand against the live page. The web app's "Extracted fields" panel with "Show refs on page" helps here. Regenerate after intended changes withcapture --regen [ats], and review the diff. uv run python -m unittest discover tests. The conformance suite enrolls every registered extractor automatically. It fails if one has no fixtures, if its fixture URLs don't match it, if refs don't resolve, if the output isn't repeatable, or if it differs from the golden.- Add the ATS to the extraction bullet in
CLAUDE.md.