operations tier

operations-privacy-scan-runner

Database-driven privacy scan worker — pulls jobs, scans sites via Chrome CDP, stores results in PostgreSQL

Database-driven privacy scan worker — pulls jobs, scans sites via Chrome CDP, stores results in PostgreSQL

Tieroperations
Roleunclassified (baselined)
Pathcrates/operations/privacy-scan-runner
Edition2021
Targetsprivacy-scan-worker, operations_privacy_scan_runner
Public items20 across 5 modules
Tests8

What it is for

This crate does not document itself. No //! block on its entry point. The facts below are complete; the reason this crate exists is not written down anywhere, and belongs in src/lib.rs rather than here.

Capabilities

BrowserManager

_No module-level documentation is present in the source._

Item
pub struct BrowserManager
BrowserManager :: fn new(chrome_url : & str) -> Self
BrowserManager :: fn ensure_connected(& mut self) -> Result <& BrowserEndpoint, ScanError>
BrowserManager :: fn open_and_navigate(& mut self, url : & str, load_timeout : Duration,) -> Result <CdpSession, ScanError>
BrowserManager :: fn cleanup_session(& self, session : CdpSession)
BrowserManager :: fn disconnect(& mut self)

WorkerConfig

_No module-level documentation is present in the source._

Item
pub struct WorkerConfig
WorkerConfig :: fn default() -> Self
WorkerConfig :: fn from_env() -> Self
WorkerConfig :: fn inter_scan_delay(& self) ->(Duration, Duration)

ScanError

_No module-level documentation is present in the source._

Item
pub enum ScanError

ScanBundle

_No module-level documentation is present in the source._

Item
pub struct ScanBundle

ScanRunner

_No module-level documentation is present in the source._

Item
pub struct ScanRunner
ScanRunner :: fn new(store : PrivacyResearchStore) -> Self
ScanRunner :: async fn scan_and_store(& self, session : & CdpSession, url : & str, category : Option <& str>, _store_raw : bool,) -> Result <ScanBundle, ScanError>

worker (other)

Privacy-scan runner worker.

Item
async fn scan_once(config : & WorkerConfig, url : & str, category : Option <& str>,) -> Result <crate::runner::ScanBundle, ScanError>
async fn connect_db(database_url : & str) -> Result <sqlx::PgPool, ScanError>

ScanWorker

Privacy-scan runner worker.

Item
pub struct ScanWorker
ScanWorker :: fn new(config : WorkerConfig, pool : sqlx::PgPool) -> Self
ScanWorker :: async fn run(& mut self) -> Result <(), ScanError>

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

operations_privacy_scan_runner

flowchart TD
  n_operations_privacy_scan_runner["operations_privacy_scan_runner"]
  n_operations_privacy_scan_runner --> n_browser["browser"]
  n_operations_privacy_scan_runner --> n_config["config"]
  n_operations_privacy_scan_runner --> n_error["error"]
  n_operations_privacy_scan_runner --> n_runner["runner"]
  n_operations_privacy_scan_runner --> n_worker["worker"]

Public surface

`browser`

ItemWhat it is
pub struct BrowserManagerManages Chrome browser lifecycle for scanning.
BrowserManager :: fn new(chrome_url : & str) -> Self
BrowserManager :: fn ensure_connected(& mut self) -> Result <& BrowserEndpoint, ScanError>Connect to Chrome (or reconnect if disconnected).
BrowserManager :: fn open_and_navigate(& mut self, url : & str, load_timeout : Duration,) -> Result <CdpSession, ScanError>Open a fresh tab, navigate to URL, wait for load, return session.
BrowserManager :: fn cleanup_session(& self, session : CdpSession)Navigate back to blank page and close session.
BrowserManager :: fn disconnect(& mut self)Mark the connection as stale (forces reconnect on next use).

`config`

ItemWhat it is
pub struct WorkerConfigWorker configuration.
WorkerConfig :: fn default() -> Self
WorkerConfig :: fn from_env() -> SelfLoad from environment variables.
WorkerConfig :: fn inter_scan_delay(& self) ->(Duration, Duration)

`error`

ItemWhat it is
pub enum ScanError

`runner`

ItemWhat it is
pub struct ScanBundleResult bundle from a single site scan.
pub struct ScanRunnerRuns privacy audits on a CDP session and stores results.
ScanRunner :: fn new(store : PrivacyResearchStore) -> Self
ScanRunner :: async fn scan_and_store(& self, session : & CdpSession, url : & str, category : Option <& str>, _store_raw : bool,) -> Result <ScanBundle, ScanError>Run a full scan: Privacy X-Ray + Detection Lab + Fingerprint audit

`worker`

ItemWhat it is
pub struct ScanWorkerMain worker that polls the database for scan jobs and executes them.
ScanWorker :: fn new(config : WorkerConfig, pool : sqlx::PgPool) -> Self
ScanWorker :: async fn run(& mut self) -> Result <(), ScanError>Run the worker loop
async fn scan_once(config : & WorkerConfig, url : & str, category : Option <& str>,) -> Result <crate::runner::ScanBundle, ScanError>Run a one-off scan without the job queue (for testing/CLI use).
async fn connect_db(database_url : & str) -> Result <sqlx::PgPool, ScanError>Connect to the database with clear error messages.

Re-exports. Exported here, defined elsewhere.

ExportDefined in
ScanErrorerror::ScanError
WorkerConfigconfig::WorkerConfig
{ScanBundle,ScanRunner}runner::{ScanBundle,ScanRunner}
{connect_db,scan_once,ScanWorker}worker::{connect_db,scan_once,ScanWorker}

Boundary

Reaches into domain, infrastructure.

Shares tier operations with 40 other crates: operations-approval-workflow, operations-assessments, operations-block-imaging, operations-boot-media, operations-browser-agent-worker, operations-camera-discovery, operations-camera-liveview, operations-camera-registry, … (40 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)operations
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/operations/privacy-scan-runner
Vocabulary in force (lexicon)current

Tier flow. Which tiers this crate's own edges cross.

flowchart LR
  n_operations["operations"] --> n_domain["domain"]
  n_operations["operations"] --> n_infrastructure["infrastructure"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`domain-privacy-research`domainnoalways
`infrastructure-browser-automation`infrastructurenoalways
`infrastructure-browser-cdp`infrastructurenoalways
`infrastructure-tenant-pool`infrastructurenoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
chrono^0.4serdenoalways
rand^0.9small_rngnoalways
serde^1derivenoalways
serde_json^1noalways
sqlx^0.8runtime-tokio, postgres, chrono, uuid, json, sqlitenoalways
thiserror^2noalways
tokio^1fullnoalways
tracing^0.1noalways
tracing-subscriber^0.3env-filternoalways
uuid^1v4, v7, serde, jsnoalways

Development. None.

Build. None.

Depended on by. Nothing in this workspace.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  SELF["operations-privacy-scan-runner"]
  SELF -->|runtime| n_domain_privacy_research["domain-privacy-research"]
  SELF -->|runtime| n_infrastructure_browser_automation["infrastructure-browser-automation"]
  SELF -->|runtime| n_infrastructure_browser_cdp["infrastructure-browser-cdp"]
  SELF -->|runtime| n_infrastructure_tenant_pool["infrastructure-tenant-pool"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
binprivacy-scan-worker`src/bin/worker.rs`
liboperations_privacy_scan_runner`src/lib.rs`

Error model

Error typeNamed by
ScanErrorconnect_db, scan_once

Operational characteristics

PropertyEvidence
async public surfaceyes
async runtimeyes
database accessyes
network I/Onone detected
unsafe codenone detected
environment variablesyes

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

VariableRead in
CHROME_URLsrc/config.rs
DATABASE_URLsrc/config.rs
HOSTNAMEsrc/config.rs
MAX_DELAY_SECSsrc/config.rs
MIN_DELAY_SECSsrc/config.rs
POLL_INTERVAL_SECSsrc/config.rs
STORE_RAW_PROBESsrc/config.rs
WORKER_NAMEsrc/config.rs

No workspace crate depends on this one.

Verification

KindCount
Unit tests8
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
browser100
config100
error100
runner200
worker300

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc1420
Public modules with a //! block15
pie showData
    title Public items with rustdoc
    "Documented" : 14
    "No rustdoc detected" : 6

Metrics

MetricValue
Rust source files7
Source lines1333
Code lines1106
Public API items20
Public modules5
Tests8
Examples0
Cargo features0
Direct runtime dependencies14
Workspace reverse dependencies0
pie showData
    title Public API by kind
    "enum" : 1
    "function" : 2
    "method" : 12
    "struct" : 5
pie showData
    title Rust source composition
    "Code" : 1106
    "Blank or comment" : 227

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

All operations · Manual