Database-driven privacy scan worker — pulls jobs, scans sites via Chrome CDP, stores results in PostgreSQL
| Tier | operations |
| Role | unclassified (baselined) |
| Path | crates/operations/privacy-scan-runner |
| Edition | 2021 |
| Targets | privacy-scan-worker, operations_privacy_scan_runner |
| Public items | 20 across 5 modules |
| Tests | 8 |
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
browserconfigerrorrunnerworker
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`
| Item | What it is |
|---|---|
pub struct BrowserManager | Manages 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`
| Item | What it is |
|---|---|
pub struct WorkerConfig | Worker configuration. |
WorkerConfig :: fn default() -> Self | — |
WorkerConfig :: fn from_env() -> Self | Load from environment variables. |
WorkerConfig :: fn inter_scan_delay(& self) ->(Duration, Duration) | — |
`error`
| Item | What it is |
|---|---|
pub enum ScanError | — |
`runner`
| Item | What it is |
|---|---|
pub struct ScanBundle | Result bundle from a single site scan. |
pub struct ScanRunner | Runs 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`
| Item | What it is |
|---|---|
pub struct ScanWorker | Main 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.
| Export | Defined in |
|---|---|
ScanError | error::ScanError |
WorkerConfig | config::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) |
| Location | crates/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.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `domain-privacy-research` | domain | no | always |
| `infrastructure-browser-automation` | infrastructure | no | always |
| `infrastructure-browser-cdp` | infrastructure | no | always |
| `infrastructure-tenant-pool` | infrastructure | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
chrono | ^0.4 | serde | no | always |
rand | ^0.9 | small_rng | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json, sqlite | no | always |
thiserror | ^2 | — | no | always |
tokio | ^1 | full | no | always |
tracing | ^0.1 | — | no | always |
tracing-subscriber | ^0.3 | env-filter | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
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
| Kind | Name | Source |
|---|---|---|
| bin | privacy-scan-worker | `src/bin/worker.rs` |
| lib | operations_privacy_scan_runner | `src/lib.rs` |
Error model
| Error type | Named by |
|---|---|
ScanError | connect_db, scan_once |
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | yes |
| async runtime | yes |
| database access | yes |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | yes |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
| Variable | Read in |
|---|---|
CHROME_URL | src/config.rs |
DATABASE_URL | src/config.rs |
HOSTNAME | src/config.rs |
MAX_DELAY_SECS | src/config.rs |
MIN_DELAY_SECS | src/config.rs |
POLL_INTERVAL_SECS | src/config.rs |
STORE_RAW_PROBES | src/config.rs |
WORKER_NAME | src/config.rs |
Related capabilities
No workspace crate depends on this one.
Verification
| Kind | Count |
|---|---|
| Unit tests | 8 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
browser | 1 | 0 | 0 |
config | 1 | 0 | 0 |
error | 1 | 0 | 0 |
runner | 2 | 0 | 0 |
worker | 3 | 0 | 0 |
What the tests establish, by name:
browser_manager_starts_disconnected—src/browser.rsdefault_config_has_reasonable_values—src/config.rsextract_host_bare—src/runner.rsextract_host_empty—src/runner.rsextract_host_http_with_port—src/runner.rsextract_host_https—src/runner.rsmask_password_no_password—src/worker.rsmask_password_works—src/worker.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 14 | 20 |
Public modules with a //! block | 1 | 5 |
pie showData
title Public items with rustdoc
"Documented" : 14
"No rustdoc detected" : 6
Metrics
| Metric | Value |
|---|---|
| Rust source files | 7 |
| Source lines | 1333 |
| Code lines | 1106 |
| Public API items | 20 |
| Public modules | 5 |
| Tests | 8 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 14 |
| Workspace reverse dependencies | 0 |
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.