tools tier

tools-sighting-ingest

Extracts sighting profile/message/read-pointer records from captured .har archives and pushes them to platform-privacy-scan-api's ingest route

Extracts sighting profile/message/read-pointer records from captured .har archives and pushes them to platform-privacy-scan-api's ingest route

Tiertools
Roletooling
Pathcrates/tools/sighting-ingest
Edition2021
Targetschat-drive, chat-record, har-request, media-session, page-probe, tools-sighting-ingest, ws-probe, ws-tap, tools_sighting_ingest
Public items19 across 0 modules
Tests56

What it is for

Extraction of sightings records from captured .har archives.

Lifted from infrastructure-har/examples/push_sniffies.rs (sprint 3.129), which was an example invoked by hand — rule 14: the repeatable step is a program, tested, not a remembered cargo run --example line. The parsing shapes are that example's, unchanged where they were right; what changed is stated in the sprint doc.

Site-specific by construction: these are sniffies.com's endpoint shapes. The records this module emits are the normalized shape platform-privacy-scan-api's /api/sightings/ingest accepts, which knows nothing about any site.

Capabilities

crate root

Extraction of sightings records from captured .har archives.

Item
pub const MAX_RESPONSE_BYTES: usize
pub const BATCH_ITEM_CAP: usize
pub const ASSUMED_TYPING_CPM: u64
fn pace_before(chars : usize, gap_seconds : u64) -> std::time::Duration
fn send_payload(site : & str, conversation_id : Option <& str>, user_id_to : & str, body : & str, file : Option <& str>,) -> Value
fn send_verdict(status : u16, body : & str) -> Result <String, String>

Endpoint

Extraction of sightings records from captured .har archives.

Item
pub enum Endpoint
fn classify(method : & str, url : & str) -> Option <Endpoint>

Extractor

Extraction of sightings records from captured .har archives.

Item
Extractor :: fn on_request(& mut self, _meta : EntryMeta <'_>, request : RequestView <'_>,) -> Result <EntryAction <Self::Response>, Self::Error>

Findings

Extraction of sightings records from captured .har archives.

Item
pub struct Findings
Findings :: fn absorb(& mut self, endpoint : Endpoint, body : & u8)
Findings :: fn is_empty(& self) -> bool
fn read_har(path : & std::path::Path, findings : & Rc <RefCell <Findings>>) -> Result <usize, String>
fn batches(site : & str, findings : & Findings) -> Vec <Value>

RawMessage

Extraction of sightings records from captured .har archives.

Item
pub struct RawMessage

ReadPointer

Extraction of sightings records from captured .har archives.

Item
pub struct ReadPointer

Sink

Extraction of sightings records from captured .har archives.

Item
Sink :: fn on_head(& mut self, head : ResponseHead <'_>) -> Result <HeadDecision, Self::Error>
Sink :: fn on_body(& mut self, body : & u8) -> Result <(), Self::Error>
Sink :: fn on_end(self, _outcome : ResponseOutcome) -> Result <(), Self::Error>

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

No public modules: the crate root is its whole surface.

Public surface

`crate root`

ItemWhat it is
pub enum EndpointThe endpoints that carry profile, message, or read-pointer data
fn classify(method : & str, url : & str) -> Option <Endpoint>Which endpoint a request hit, or None to decline it
pub struct RawMessage
pub struct ReadPointerOne read pointer, in the shape /api/sightings/ingest accepts.
pub struct FindingsEverything one or more captures yielded, deduplicated by natural key.
Findings :: fn absorb(& mut self, endpoint : Endpoint, body : & u8)Fold one response body into the findings
Findings :: fn is_empty(& self) -> bool
pub const MAX_RESPONSE_BYTES: usizeGate 1.5.6 input limit
Sink :: fn on_head(& mut self, head : ResponseHead <'_>) -> Result <HeadDecision, Self::Error>
Sink :: fn on_body(& mut self, body : & u8) -> Result <(), Self::Error>
Sink :: fn on_end(self, _outcome : ResponseOutcome) -> Result <(), Self::Error>
Extractor :: fn on_request(& mut self, _meta : EntryMeta <'_>, request : RequestView <'_>,) -> Result <EntryAction <Self::Response>, Self::Error>
fn read_har(path : & std::path::Path, findings : & Rc <RefCell <Findings>>) -> Result <usize, String>Fold one .har into findings, returning how many entries the archive held.
pub const BATCH_ITEM_CAP: usizeUnder the ingest route's 500-item cap, with room to spare — the route counts profiles, messages and read pointers together.
fn batches(site : & str, findings : & Findings) -> Vec <Value>The ingest batches one findings set produces, each already under the route's cap
pub const ASSUMED_TYPING_CPM: u64Characters a minute, used to price the pause in front of a message
fn pace_before(chars : usize, gap_seconds : u64) -> std::time::DurationHow long to wait before sending a message of this length
fn send_payload(site : & str, conversation_id : Option <& str>, user_id_to : & str, body : & str, file : Option <& str>,) -> ValueThe POST /api/sightings/send request body
fn send_verdict(status : u16, body : & str) -> Result <String, String>What the server's answer means, as an outcome rather than a status code

No pub use re-exports: every item above is declared in this crate.

Boundary

Reaches into infrastructure.

Shares tier tools with 84 other crates: tools-advisory-reach, tools-archive-guard, tools-artifact-scaffold, tools-ask-ai-core, tools-ask-ais, tools-ask-gemini, tools-book, tools-book-report, … (84 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)tools
Architectural role (taxonomy)tooling
Locationcrates/tools/sighting-ingest
Vocabulary in force (lexicon)current

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

flowchart LR
  n_tools["tools"] --> n_infrastructure["infrastructure"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`infrastructure-browser-cdp`infrastructurenoalways
`infrastructure-har`infrastructurenoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
clap^4derive, envnoalways
reqwest^0.12blocking, jsonnoalways
serde^1derivenoalways
serde_json^1noalways
url^2noalways

Development, in this workspace.

CrateTierOptionalOnly on
`tools-cli-conformance`toolsnoalways

Build. None.

Depended on by. Nothing in this workspace.

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

flowchart LR
  SELF["tools-sighting-ingest"]
  SELF -->|development| n_tools_cli_conformance["tools-cli-conformance"]
  SELF -->|runtime| n_infrastructure_browser_cdp["infrastructure-browser-cdp"]
  SELF -->|runtime| n_infrastructure_har["infrastructure-har"]
  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
binchat-drive`src/bin/chat-drive.rs`
binchat-record`src/bin/chat-record.rs`
binhar-request`src/bin/har-request.rs`
binmedia-session`src/bin/media-session.rs`
binpage-probe`src/bin/page-probe.rs`
bintools-sighting-ingest`src/main.rs`
binws-probe`src/bin/ws-probe.rs`
binws-tap`src/bin/ws-tap.rs`
libtools_sighting_ingest`src/lib.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Oyes
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
API_KEYsrc/bin/media-session.rs
CARGO_MANIFEST_DIRsrc/bin/chat-drive.rs

No workspace crate depends on this one.

Verification

KindCount
Unit tests56
Integration tests0
Examples0
Doctests0

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

ModuleTestsExamplesConsumers
crate root1300

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc1319
Public modules with a //! block00
pie showData
    title Public items with rustdoc
    "Documented" : 13
    "No rustdoc detected" : 6

Metrics

MetricValue
Rust source files9
Source lines4356
Code lines3175
Public API items19
Public modules0
Tests56
Examples0
Cargo features0
Direct runtime dependencies7
Workspace reverse dependencies0
pie showData
    title Public API by kind
    "constant" : 3
    "enum" : 1
    "function" : 6
    "method" : 6
    "struct" : 3
pie showData
    title Rust source composition
    "Code" : 3175
    "Blank or comment" : 1181

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 tools · Manual