Skip to content

C3: SessionContext construction in Crawler::process_job #51

Description

@filipeforattini

Parent

#46

What to build

Crawler::process_job constructs a concrete SessionContext per Job from the existing Crawler state — proxy router lease, antibot session state, render budgets, resolved policy profile, impersonate profile identity. This is the precursor to the runner cutover: the SessionContext exists at the right point in process_job but is not yet consumed by runner.run.

After this slice, Crawler::process_job builds let ctx = SessionContext { ... }; from self.proxy_router, self.session_states[session_id], self.render_budgets, self.config.policy_profile, and the ImpersonateClient identity. The context is held in a local variable, ready for C4 to thread into runner.run(&job, &ctx).await.

Acceptance criteria

  • Crawler::process_job constructs a fully-populated SessionContext per Job
  • SessionContext.identity carries the active profile name + locale + session id
  • SessionContext.proxy is Some(ProxyLease) when a lease is acquired, None otherwise
  • SessionContext.session_state mirrors self.session_states[session_id]
  • SessionContext.budgets reflects self.render_budgets remaining values + self.config.max_retries - job.attempts
  • SessionContext.policy reflects the resolved PolicyProfile from config
  • The SessionContext is constructed but not yet consumed by runner.run (consumption lands in C4)
  • No behavior change observable to integration tests; NDJSON regression byte-stable
  • All 44 runner unit tests pass; 4 integration tests pass

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageAwaiting triagerustPull requests that update rust code

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions