Skip to content

bd-ic1 Phase 2: iterate Kleinanzeigen contact form, fill from contact_details - #67

Merged
MukhammadIbrokhimov merged 4 commits into
mainfrom
feat/bd-ic1-phase2-kleinanzeigen-iterate
May 20, 2026
Merged

bd-ic1 Phase 2: iterate Kleinanzeigen contact form, fill from contact_details#67
MukhammadIbrokhimov merged 4 commits into
mainfrom
feat/bd-ic1-phase2-kleinanzeigen-iterate

Conversation

@MukhammadIbrokhimov

Copy link
Copy Markdown
Owner

Summary

  • New pure planner src/flatpilot/fillers/kleinanzeigen_form.py maps the form's labels / names / ids to profile.contact_details attributes via a regex map and emits a list of FieldPlan(attr, selector, value, kind).
  • KleinanzeigenFiller.fill() reads form#viewad-contact-form inner HTML after _reveal_contact_form, runs the planner, and applies each plan via pg.locator(...).fill(...) / .select_option(label=...). Pre-filled fields are respected (empty-check guard); per-field failures are logged and the loop continues.
  • Two fixture variants (full + message-only) exercise the planner; three new executor tests exercise the wiring through the existing _FakePage mock.

Real-HTML caveat

The fixtures encode educated guesses about the live form's structure (no empirical capture is in this branch). The planner is intentionally lenient — match across label / name / id — so small DOM shifts should not break it. When a real capture lands, tune LABEL_MAP regexes and SELECT_OPTION_MAP candidate strings.

Test plan

  • pytest tests/test_kleinanzeigen_form_planner.py tests/test_filler_kleinanzeigen.py -v — green
  • pytest -q — full suite green (598 passed)
  • ruff check on touched files — no errors
  • Manual: run the filler in dry-run mode against a real Kleinanzeigen listing and verify field-fill diagnostics in the resulting FillReport.

Closes FlatPilot-569.

Copilot AI review requested due to automatic review settings May 20, 2026 21:06

Copilot AI 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.

Pull request overview

Adds bd-ic1 Phase 2 structured-field filling for Kleinanzeigen by planning contact-form field operations from the live form HTML and applying them best-effort from profile.contact_details.

Changes:

  • Introduces a pure HTML-based planner (plan_field_fills) that maps Kleinanzeigen form inputs/selects to ContactDetails attributes and emits FieldPlan operations.
  • Wires the planner into KleinanzeigenFiller.fill() to fill empty structured fields (and keep prefilled/user-entered values intact), continuing on per-field failures.
  • Adds planner fixtures + unit tests, and extends the Kleinanzeigen filler executor tests with _FakePage/_Locator support for inner_html, input_value, and select_option.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/flatpilot/fillers/kleinanzeigen_form.py New planner that parses form HTML and emits deterministic fill/select plans.
src/flatpilot/fillers/kleinanzeigen.py Applies planned structured contact-detail fills before the existing message fill.
tests/test_kleinanzeigen_form_planner.py Unit tests validating planner output across full/message-only/no-form fixtures.
tests/test_filler_kleinanzeigen.py Extends Playwright fakes and adds integration-ish tests verifying planner wiring + prefill guard.
tests/fixtures/kleinanzeigen/contact_form_full.html Full contact-form fixture (inputs + selects + message textarea).
tests/fixtures/kleinanzeigen/contact_form_message_only.html Minimal fixture containing only the message textarea.
.beads/issues.jsonl Updates bead status metadata associated with this work.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 191 to 196

fields_filled: dict[str, str] = {}

self._apply_contact_details(pg, profile, fields_filled)

self._fill_required(pg, SELECTORS.message_input, message, label="message")
Comment on lines +121 to +136
attr = _match_attribute(input_el, scope)
if attr is None:
continue
profile_value = getattr(contact, attr, None)
if profile_value is None:
continue
selector = _selector_for(input_el)
if input_el.name == "select" and attr in _SELECT_ATTRS:
label = _select_label_for(input_el, attr, str(profile_value))
if label is None:
continue
plans.append(FieldPlan(attr=attr, selector=selector, value=label, kind="select"))
else:
plans.append(
FieldPlan(attr=attr, selector=selector, value=str(profile_value), kind="fill")
)
@MukhammadIbrokhimov
MukhammadIbrokhimov merged commit 9a8d69e into main May 20, 2026
7 checks passed
@MukhammadIbrokhimov
MukhammadIbrokhimov deleted the feat/bd-ic1-phase2-kleinanzeigen-iterate branch May 20, 2026 21:16
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.

2 participants