Skip to main content

Module escalation

Module escalation 

Source
Expand description

Tiered request escalation port — decide when to escalate from plain HTTP to browser Tiered request escalation port.

Defines the EscalationPolicy trait for deciding when and how to escalate a failed request from a lightweight tier (plain HTTP) to a heavier one (TLS-profiled HTTP, basic browser, advanced browser).

This is a pure domain concept — no I/O, no adapter imports. Concrete policies are implemented in adapter modules (see T19).

§Tiers

TierDescription
HttpPlainStandard HTTP client, no stealth
HttpTlsProfiledHTTP with TLS fingerprint matching
BrowserBasicHeadless browser with basic stealth
BrowserAdvancedFull stealth browser (CDP fixes, JS patches)

§Example

use stygian_graph::ports::escalation::{
    EscalationPolicy, EscalationTier, ResponseContext,
};

struct AlwaysEscalate;

impl EscalationPolicy for AlwaysEscalate {
    fn initial_tier(&self) -> EscalationTier {
        EscalationTier::HttpPlain
    }

    fn should_escalate(
        &self,
        ctx: &ResponseContext,
        current: EscalationTier,
    ) -> Option<EscalationTier> {
        current.next()
    }

    fn max_tier(&self) -> EscalationTier {
        EscalationTier::BrowserAdvanced
    }
}

let policy = AlwaysEscalate;
assert_eq!(policy.initial_tier(), EscalationTier::HttpPlain);

Structs§

EscalationResult
The outcome of a tiered escalation run.
ResponseContext
Contextual information about an HTTP response used by EscalationPolicy::should_escalate to decide whether to move to a higher tier.

Enums§

EscalationTier
A request-handling tier, ordered from cheapest to most expensive.

Traits§

EscalationPolicy
Port trait for tiered request escalation.